Skip to content

Commit bab37b1

Browse files
Enable -Wconversion tree-wide on darwin. (#25376)
* Enable -Wconversion tree-wide on darwin. * Also fix mbedtls, since apparently someone is building with that on Darwin.
1 parent e75d35a commit bab37b1

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

build/config/compiler/BUILD.gn

+4
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,10 @@ config("strict_warnings") {
249249
]
250250
}
251251

252+
if (current_os == "mac" || current_os == "ios") {
253+
cflags += [ "-Wconversion" ]
254+
}
255+
252256
if (build_java_matter_controller) {
253257
cflags -= [ "-Wshadow" ]
254258
}

src/crypto/CHIPCryptoPALmbedTLS.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1445,8 +1445,9 @@ CHIP_ERROR VerifyAttestationCertificateFormat(const ByteSpan & cert, Attestation
14451445
{
14461446
bool keyCertSignFlag = keyUsage & MBEDTLS_X509_KU_KEY_CERT_SIGN;
14471447
bool crlSignFlag = keyUsage & MBEDTLS_X509_KU_CRL_SIGN;
1448-
bool otherFlags =
1449-
keyUsage & ~(MBEDTLS_X509_KU_CRL_SIGN | MBEDTLS_X509_KU_KEY_CERT_SIGN | MBEDTLS_X509_KU_DIGITAL_SIGNATURE);
1448+
bool otherFlags = keyUsage &
1449+
~static_cast<unsigned int>(MBEDTLS_X509_KU_CRL_SIGN | MBEDTLS_X509_KU_KEY_CERT_SIGN |
1450+
MBEDTLS_X509_KU_DIGITAL_SIGNATURE);
14501451
VerifyOrExit(keyCertSignFlag && crlSignFlag && !otherFlags, error = CHIP_ERROR_INTERNAL);
14511452
}
14521453
}

third_party/boringssl/repo/BUILD.gn

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import("BUILD.generated.gni")
2020
config("boringssl_config") {
2121
include_dirs = [ "src/include" ]
2222

23-
cflags = [ "-Wno-unused-variable" ]
23+
cflags = [
24+
"-Wno-unused-variable",
25+
"-Wno-conversion",
26+
]
2427

2528
if (is_clang) {
2629
cflags += [ "-Wno-shorten-64-to-32" ]

third_party/editline/BUILD.gn

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ import("${build_root}/config/compiler/compiler.gni")
1818
config("editline_config") {
1919
include_dirs = [ "repo/include" ]
2020

21+
cflags = [ "-Wno-conversion" ]
22+
2123
if (is_clang) {
22-
cflags = [ "-Wno-shorten-64-to-32" ]
24+
cflags += [ "-Wno-shorten-64-to-32" ]
2325
}
2426
}
2527

third_party/mbedtls/mbedtls.gni

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ template("mbedtls_target") {
2828
"-Wno-string-concatenation",
2929
"-Wno-unused-but-set-parameter",
3030
"-Wno-format-nonliteral", # Because of mbedtls_debug_print_msg
31+
"-Wno-conversion", # Lots of -Wconversion warnings, sadly.
3132
]
3233

3334
if (is_clang) {

third_party/nlunit-test/BUILD.gn

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ import("${build_root}/config/compiler/compiler.gni")
1818
config("nlunit-test_config") {
1919
include_dirs = [ "repo/src" ]
2020

21+
cflags = [ "-Wno-conversion" ]
22+
2123
if (is_clang) {
22-
cflags = [ "-Wno-shorten-64-to-32" ]
24+
cflags += [ "-Wno-shorten-64-to-32" ]
2325
}
2426
}
2527

0 commit comments

Comments
 (0)