Skip to content

Commit 298d9eb

Browse files
Stop disabling warnings in some public configs. (#25854)
Disabling warnings in a public config will disable those warnings for anything that depends on the thing using the config. This led to a bunch of warnings being disabled incorrectly for consumers of third-party libraries.
1 parent a5e9259 commit 298d9eb

File tree

11 files changed

+40
-9
lines changed

11 files changed

+40
-9
lines changed

examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class ExampleCredentialIssuerCommands : public CredentialIssuerCommands
8181
{
8282
mDacVerifier->EnableCdTestKeySupport(isEnabled);
8383
}
84-
84+
break;
8585
default:
8686
break;
8787
}

examples/chip-tool/commands/pairing/PairingCommand.h

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class PairingCommand : public CHIPCommand,
8585
break;
8686
case PairingMode::Code:
8787
AddArgument("skip-commissioning-complete", 0, 1, &mSkipCommissioningComplete);
88+
FALLTHROUGH;
8889
case PairingMode::CodePaseOnly:
8990
AddArgument("payload", &mOnboardingPayload);
9091
AddArgument("discover-once", 0, 1, &mDiscoverOnce);

examples/common/websocket-server/BUILD.gn

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
import("//build_overrides/build.gni")
1616
import("//build_overrides/chip.gni")
1717

18+
config("websocket_server_config_disable_warnings") {
19+
# Unfortunately, some of the libwebsockets headers include -Wshadow failures.
20+
cflags = [ "-Wno-shadow" ]
21+
}
22+
1823
static_library("websocket-server") {
1924
output_name = "libWebSocketServer"
2025

@@ -28,4 +33,6 @@ static_library("websocket-server") {
2833
"${chip_root}/src/lib/support",
2934
"${chip_root}/third_party/libwebsockets",
3035
]
36+
37+
configs += [ ":websocket_server_config_disable_warnings" ]
3138
}

examples/darwin-framework-tool/commands/common/MTRError.mm

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ CHIP_ERROR MTRErrorToCHIPErrorCode(NSError * error)
8787
break;
8888
}
8989
// Weird error we did not create. Fall through.
90+
FALLTHROUGH;
9091
default:
9192
code = CHIP_ERROR_INTERNAL.AsInteger();
9293
break;

examples/darwin-framework-tool/commands/tests/TestCommandBridge.h

-2
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,6 @@ class TestCommandBridge : public CHIPCommandBridge,
236236

237237
MTRBaseDevice * _Nullable GetDevice(const char * _Nullable identity)
238238
{
239-
MTRDeviceController * controller = GetCommissioner(identity);
240-
241239
SetIdentity(identity);
242240
return mConnectedDevices[identity];
243241
}

src/lib/support/CodeUtils.h

+2
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,8 @@ inline void chipDie(void)
677677

678678
#if defined(__clang__)
679679
#define FALLTHROUGH [[clang::fallthrough]]
680+
#elif defined(__GNUC__)
681+
#define FALLTHROUGH __attribute__((fallthrough))
680682
#else
681683
#define FALLTHROUGH (void) 0
682684
#endif

third_party/boringssl/repo/BUILD.gn

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

23+
# We want the basic crypto impl with no asm primitives until we hook-up platform-based
24+
# support to the build later.
25+
defines = [ "OPENSSL_NO_ASM=1" ]
26+
}
27+
28+
config("boringssl_config_disable_warnings") {
2329
cflags = [
2430
"-Wno-unused-variable",
2531
"-Wno-conversion",
@@ -28,11 +34,8 @@ config("boringssl_config") {
2834
if (is_clang) {
2935
cflags += [ "-Wno-shorten-64-to-32" ]
3036
}
31-
32-
# We want the basic crypto impl with no asm primitives until we hook-up platform-based
33-
# support to the build later.
34-
defines = [ "OPENSSL_NO_ASM=1" ]
3537
}
38+
3639
all_sources = crypto_sources
3740

3841
all_headers = crypto_headers
@@ -45,4 +48,9 @@ static_library("boringssl") {
4548
sources = all_sources
4649

4750
public_configs = [ ":boringssl_config" ]
51+
52+
# The disable-warnings config should not be a public config, since
53+
# that would make it apply to compilations of anything that depends
54+
# on boringssl, not just boringssl itself.
55+
configs += [ ":boringssl_config_disable_warnings" ]
4856
}

third_party/editline/BUILD.gn

+4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import("${build_root}/config/compiler/compiler.gni")
1717

1818
config("editline_config") {
1919
include_dirs = [ "repo/include" ]
20+
}
2021

22+
config("editline_config_disable_warnings") {
2123
cflags = [ "-Wno-conversion" ]
2224

2325
if (is_clang) {
@@ -38,5 +40,7 @@ static_library("editline") {
3840

3941
public_configs = [ ":editline_config" ]
4042

43+
configs += [ ":editline_config_disable_warnings" ]
44+
4145
include_dirs = [ "include" ]
4246
}

third_party/jsoncpp/BUILD.gn

+4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import("//build_overrides/chip.gni")
1717

1818
config("jsoncpp_config") {
1919
include_dirs = [ "repo/include" ]
20+
}
2021

22+
config("jsoncpp_config_disable_warnings") {
2123
cflags = [ "-Wno-implicit-fallthrough" ]
2224
}
2325

@@ -41,6 +43,8 @@ source_set("jsoncpp") {
4143

4244
public_configs = [ ":jsoncpp_config" ]
4345

46+
configs += [ ":jsoncpp_config_disable_warnings" ]
47+
4448
defines = [
4549
"JSON_USE_EXCEPTION=0",
4650
"JSON_USE_NULLREF=0",

third_party/libwebsockets/BUILD.gn

+5-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ config("libwebsockets_config") {
1818
"repo/include",
1919
]
2020

21+
defines = []
22+
}
23+
24+
config("libwebsockets_config_disable_warnings") {
2125
cflags = [
2226
"-Wno-shadow",
2327
"-Wno-unreachable-code",
2428
"-Wno-format-nonliteral",
2529
"-Wno-implicit-fallthrough",
2630
]
27-
28-
defines = []
2931
}
3032

3133
source_set("libwebsockets") {
@@ -107,4 +109,5 @@ source_set("libwebsockets") {
107109
}
108110

109111
public_configs = [ ":libwebsockets_config" ]
112+
configs += [ ":libwebsockets_config_disable_warnings" ]
110113
}

third_party/nlunit-test/BUILD.gn

+3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ import("${build_root}/config/compiler/compiler.gni")
1717

1818
config("nlunit-test_config") {
1919
include_dirs = [ "repo/src" ]
20+
}
2021

22+
config("nlunit-test_config_disable_warnings") {
2123
cflags = [ "-Wno-conversion" ]
2224

2325
if (is_clang) {
@@ -36,4 +38,5 @@ static_library("nlunit-test") {
3638
]
3739

3840
public_configs = [ ":nlunit-test_config" ]
41+
configs += [ ":nlunit-test_config_disable_warnings" ]
3942
}

0 commit comments

Comments
 (0)