Skip to content

Commit dbca369

Browse files
authored
Fix CMake build with Clang 10 (#3972)
The as-of-yet-unreleased Clang 10 adds some new warnings which make the CMake build fail (due to `-Werror`): * BoringSSL build now fails because some of its C code contains fallthroughs in switch statements that aren't properly annotated. This wasn't an issue before because previous versions of Clang ignored `-Wimplicit-fallthrough` in C mode; * serializer test contains an expression that produces the following warning: ``` /src/firebase-ios-sdk/Firestore/core/test/firebase/firestore/remote/serializer_test.cc:446:29: error: implicit conversion from 'std::__1::numeric_limits<long>::type' (aka 'long') to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror, -Wimplicit-int-float-conversion] ``` Fixes: * upgrade the version of BoringSSL used to the latest master. There's no particular reason to choose this commit, other than it happens to be the latest. The actual fixes we need are [this](google/boringssl@05cd930) and [this](google/boringssl@fbebe83); * apply `static_cast` to the serializer test. Also, because the cast produces a different value, add a couple of additional values to test. The breakage was discovered thanks to the fuzz build (which already uses Clang 10 from trunk).
1 parent 10ef0bb commit dbca369

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

Firestore/core/test/firebase/firestore/remote/serializer_test.cc

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -426,26 +426,31 @@ TEST_F(SerializerTest, EncodesDoubles) {
426426
static_assert(std::numeric_limits<double>::is_iec559,
427427
"IEC559/IEEE764 floating point required");
428428

429-
std::vector<double> cases{-std::numeric_limits<double>::infinity(),
430-
std::numeric_limits<double>::lowest(),
431-
std::numeric_limits<int64_t>::min() - 1.0,
432-
-2.0,
433-
-1.1,
434-
-1.0,
435-
-std::numeric_limits<double>::epsilon(),
436-
-std::numeric_limits<double>::min(),
437-
-std::numeric_limits<double>::denorm_min(),
438-
-0.0,
439-
0.0,
440-
std::numeric_limits<double>::denorm_min(),
441-
std::numeric_limits<double>::min(),
442-
std::numeric_limits<double>::epsilon(),
443-
1.0,
444-
1.1,
445-
2.0,
446-
std::numeric_limits<int64_t>::max() + 1.0,
447-
std::numeric_limits<double>::max(),
448-
std::numeric_limits<double>::infinity()};
429+
std::vector<double> cases{
430+
-std::numeric_limits<double>::infinity(),
431+
std::numeric_limits<double>::lowest(),
432+
std::numeric_limits<int64_t>::min() - 1.0,
433+
-2.0,
434+
-1.1,
435+
-1.0,
436+
-std::numeric_limits<double>::epsilon(),
437+
-std::numeric_limits<double>::min(),
438+
-std::numeric_limits<double>::denorm_min(),
439+
-0.0,
440+
0.0,
441+
std::numeric_limits<double>::denorm_min(),
442+
std::numeric_limits<double>::min(),
443+
std::numeric_limits<double>::epsilon(),
444+
1.0,
445+
1.1,
446+
2.0,
447+
// Static cast silences warning about the conversion changing the value.
448+
static_cast<double>(std::numeric_limits<int64_t>::max()) - 1.0,
449+
static_cast<double>(std::numeric_limits<int64_t>::max()),
450+
static_cast<double>(std::numeric_limits<int64_t>::max()) + 1.0,
451+
std::numeric_limits<double>::max(),
452+
std::numeric_limits<double>::infinity(),
453+
};
449454

450455
for (double double_value : cases) {
451456
FieldValue model = FieldValue::FromDouble(double_value);

cmake/external/boringssl.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif()
2626
# (2017-02-03). Unfortunately, that boringssl includes a conflicting gtest
2727
# target that makes it unsuitable for use via add_subdirectory.
2828

29-
set(commit e0afc85719db9a0842bcfddcf4b15e856b253ee2) # master@{2018-07-10}
29+
set(commit 9638f8fba961a593c064e3036bb580bdace29e8f) # master@{2019-10-01}
3030

3131
ExternalProject_Add(
3232
boringssl
@@ -36,7 +36,7 @@ ExternalProject_Add(
3636
DOWNLOAD_DIR ${FIREBASE_DOWNLOAD_DIR}
3737
DOWNLOAD_NAME boringssl-${commit}.tar.gz
3838
URL https://github.com/google/boringssl/archive/${commit}.tar.gz
39-
URL_HASH SHA256=2aa66e912651d2256ab266b712a2647c22e7e9347a09544e684732a599a194a8
39+
URL_HASH SHA256=cfd843fda9fdf9ea92b1ae5f5d379ec7d7cb09d5c7d41197ee935a0e30aecb23
4040

4141
PREFIX ${PROJECT_BINARY_DIR}
4242
SOURCE_DIR ${PROJECT_BINARY_DIR}/src/grpc/third_party/boringssl

0 commit comments

Comments
 (0)