Skip to content

Commit

Permalink
Stop disabling warnings in some public configs. (#25854)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Jun 30, 2023
1 parent 8a5b96c commit 4401624
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ExampleCredentialIssuerCommands : public CredentialIssuerCommands
{
mDacVerifier->EnableCdTestKeySupport(isEnabled);
}

break;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions examples/chip-tool/commands/pairing/PairingCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class PairingCommand : public CHIPCommand,
break;
case PairingMode::Code:
AddArgument("skip-commissioning-complete", 0, 1, &mSkipCommissioningComplete);
FALLTHROUGH;
case PairingMode::CodePaseOnly:
AddArgument("payload", &mOnboardingPayload);
AddArgument("discover-once", 0, 1, &mDiscoverOnce);
Expand Down
7 changes: 7 additions & 0 deletions examples/common/websocket-server/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

config("websocket_server_config_disable_warnings") {
# Unfortunately, some of the libwebsockets headers include -Wshadow failures.
cflags = [ "-Wno-shadow" ]
}

static_library("websocket-server") {
output_name = "libWebSocketServer"

Expand All @@ -28,4 +33,6 @@ static_library("websocket-server") {
"${chip_root}/src/lib/support",
"${chip_root}/third_party/libwebsockets",
]

configs += [ ":websocket_server_config_disable_warnings" ]
}
1 change: 1 addition & 0 deletions examples/darwin-framework-tool/commands/common/MTRError.mm
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ CHIP_ERROR MTRErrorToCHIPErrorCode(NSError * error)
break;
}
// Weird error we did not create. Fall through.
FALLTHROUGH;
default:
code = CHIP_ERROR_INTERNAL.AsInteger();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ class TestCommandBridge : public CHIPCommandBridge,

MTRBaseDevice * _Nullable GetDevice(const char * _Nullable identity)
{
MTRDeviceController * controller = GetCommissioner(identity);

SetIdentity(identity);
return mConnectedDevices[identity];
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib/support/CodeUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,8 @@ inline void chipDie(void)

#if defined(__clang__)
#define FALLTHROUGH [[clang::fallthrough]]
#elif defined(__GNUC__)
#define FALLTHROUGH __attribute__((fallthrough))
#else
#define FALLTHROUGH (void) 0
#endif
Expand Down
16 changes: 12 additions & 4 deletions third_party/boringssl/repo/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ import("BUILD.generated.gni")
config("boringssl_config") {
include_dirs = [ "src/include" ]

# We want the basic crypto impl with no asm primitives until we hook-up platform-based
# support to the build later.
defines = [ "OPENSSL_NO_ASM=1" ]
}

config("boringssl_config_disable_warnings") {
cflags = [
"-Wno-unused-variable",
"-Wno-conversion",
Expand All @@ -28,11 +34,8 @@ config("boringssl_config") {
if (is_clang) {
cflags += [ "-Wno-shorten-64-to-32" ]
}

# We want the basic crypto impl with no asm primitives until we hook-up platform-based
# support to the build later.
defines = [ "OPENSSL_NO_ASM=1" ]
}

all_sources = crypto_sources

all_headers = crypto_headers
Expand All @@ -45,4 +48,9 @@ static_library("boringssl") {
sources = all_sources

public_configs = [ ":boringssl_config" ]

# The disable-warnings config should not be a public config, since
# that would make it apply to compilations of anything that depends
# on boringssl, not just boringssl itself.
configs += [ ":boringssl_config_disable_warnings" ]
}
4 changes: 4 additions & 0 deletions third_party/editline/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import("${build_root}/config/compiler/compiler.gni")

config("editline_config") {
include_dirs = [ "repo/include" ]
}

config("editline_config_disable_warnings") {
cflags = [ "-Wno-conversion" ]

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

public_configs = [ ":editline_config" ]

configs += [ ":editline_config_disable_warnings" ]

include_dirs = [ "include" ]
}
4 changes: 4 additions & 0 deletions third_party/jsoncpp/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import("//build_overrides/chip.gni")

config("jsoncpp_config") {
include_dirs = [ "repo/include" ]
}

config("jsoncpp_config_disable_warnings") {
cflags = [ "-Wno-implicit-fallthrough" ]
}

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

public_configs = [ ":jsoncpp_config" ]

configs += [ ":jsoncpp_config_disable_warnings" ]

defines = [
"JSON_USE_EXCEPTION=0",
"JSON_USE_NULLREF=0",
Expand Down
7 changes: 5 additions & 2 deletions third_party/libwebsockets/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ config("libwebsockets_config") {
"repo/include",
]

defines = []
}

config("libwebsockets_config_disable_warnings") {
cflags = [
"-Wno-shadow",
"-Wno-unreachable-code",
"-Wno-format-nonliteral",
"-Wno-implicit-fallthrough",
]

defines = []
}

source_set("libwebsockets") {
Expand Down Expand Up @@ -107,4 +109,5 @@ source_set("libwebsockets") {
}

public_configs = [ ":libwebsockets_config" ]
configs += [ ":libwebsockets_config_disable_warnings" ]
}
3 changes: 3 additions & 0 deletions third_party/nlunit-test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import("${build_root}/config/compiler/compiler.gni")

config("nlunit-test_config") {
include_dirs = [ "repo/src" ]
}

config("nlunit-test_config_disable_warnings") {
cflags = [ "-Wno-conversion" ]

if (is_clang) {
Expand All @@ -36,4 +38,5 @@ static_library("nlunit-test") {
]

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

0 comments on commit 4401624

Please sign in to comment.