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.
diff --git a/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h b/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h
index a8694f0..a23b45e 100644
--- a/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h
+++ b/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h
@@ -81,7 +81,7 @@
             {
                 mDacVerifier->EnableCdTestKeySupport(isEnabled);
             }
-
+            break;
         default:
             break;
         }
diff --git a/examples/chip-tool/commands/pairing/PairingCommand.h b/examples/chip-tool/commands/pairing/PairingCommand.h
index f12353e..5c2a356 100644
--- a/examples/chip-tool/commands/pairing/PairingCommand.h
+++ b/examples/chip-tool/commands/pairing/PairingCommand.h
@@ -85,6 +85,7 @@
             break;
         case PairingMode::Code:
             AddArgument("skip-commissioning-complete", 0, 1, &mSkipCommissioningComplete);
+            FALLTHROUGH;
         case PairingMode::CodePaseOnly:
             AddArgument("payload", &mOnboardingPayload);
             AddArgument("discover-once", 0, 1, &mDiscoverOnce);
diff --git a/examples/common/websocket-server/BUILD.gn b/examples/common/websocket-server/BUILD.gn
index fdd1730..d3f2aa3 100644
--- a/examples/common/websocket-server/BUILD.gn
+++ b/examples/common/websocket-server/BUILD.gn
@@ -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"
 
@@ -28,4 +33,6 @@
     "${chip_root}/src/lib/support",
     "${chip_root}/third_party/libwebsockets",
   ]
+
+  configs += [ ":websocket_server_config_disable_warnings" ]
 }
diff --git a/examples/darwin-framework-tool/commands/common/MTRError.mm b/examples/darwin-framework-tool/commands/common/MTRError.mm
index 5d348c8..770c947 100644
--- a/examples/darwin-framework-tool/commands/common/MTRError.mm
+++ b/examples/darwin-framework-tool/commands/common/MTRError.mm
@@ -87,6 +87,7 @@
             break;
         }
         // Weird error we did not create.  Fall through.
+        FALLTHROUGH;
     default:
         code = CHIP_ERROR_INTERNAL.AsInteger();
         break;
diff --git a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h
index 0828e1d..b99c597 100644
--- a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h
+++ b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h
@@ -236,8 +236,6 @@
 
     MTRBaseDevice * _Nullable GetDevice(const char * _Nullable identity)
     {
-        MTRDeviceController * controller = GetCommissioner(identity);
-
         SetIdentity(identity);
         return mConnectedDevices[identity];
     }
diff --git a/src/lib/support/CodeUtils.h b/src/lib/support/CodeUtils.h
index 3b754e0..4f393df 100644
--- a/src/lib/support/CodeUtils.h
+++ b/src/lib/support/CodeUtils.h
@@ -677,6 +677,8 @@
 
 #if defined(__clang__)
 #define FALLTHROUGH [[clang::fallthrough]]
+#elif defined(__GNUC__)
+#define FALLTHROUGH __attribute__((fallthrough))
 #else
 #define FALLTHROUGH (void) 0
 #endif
diff --git a/third_party/boringssl/repo/BUILD.gn b/third_party/boringssl/repo/BUILD.gn
index 634be16..425f522 100644
--- a/third_party/boringssl/repo/BUILD.gn
+++ b/third_party/boringssl/repo/BUILD.gn
@@ -20,6 +20,12 @@
 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",
@@ -28,11 +34,8 @@
   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
@@ -45,4 +48,9 @@
   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" ]
 }
diff --git a/third_party/editline/BUILD.gn b/third_party/editline/BUILD.gn
index ec2cdd4..cc48d31 100644
--- a/third_party/editline/BUILD.gn
+++ b/third_party/editline/BUILD.gn
@@ -17,7 +17,9 @@
 
 config("editline_config") {
   include_dirs = [ "repo/include" ]
+}
 
+config("editline_config_disable_warnings") {
   cflags = [ "-Wno-conversion" ]
 
   if (is_clang) {
@@ -38,5 +40,7 @@
 
   public_configs = [ ":editline_config" ]
 
+  configs += [ ":editline_config_disable_warnings" ]
+
   include_dirs = [ "include" ]
 }
diff --git a/third_party/jsoncpp/BUILD.gn b/third_party/jsoncpp/BUILD.gn
index aae8f02..13dcc20 100644
--- a/third_party/jsoncpp/BUILD.gn
+++ b/third_party/jsoncpp/BUILD.gn
@@ -17,7 +17,9 @@
 
 config("jsoncpp_config") {
   include_dirs = [ "repo/include" ]
+}
 
+config("jsoncpp_config_disable_warnings") {
   cflags = [ "-Wno-implicit-fallthrough" ]
 }
 
@@ -41,6 +43,8 @@
 
   public_configs = [ ":jsoncpp_config" ]
 
+  configs += [ ":jsoncpp_config_disable_warnings" ]
+
   defines = [
     "JSON_USE_EXCEPTION=0",
     "JSON_USE_NULLREF=0",
diff --git a/third_party/libwebsockets/BUILD.gn b/third_party/libwebsockets/BUILD.gn
index 37d7bf1..9b96fb7 100644
--- a/third_party/libwebsockets/BUILD.gn
+++ b/third_party/libwebsockets/BUILD.gn
@@ -18,14 +18,16 @@
     "repo/include",
   ]
 
+  defines = []
+}
+
+config("libwebsockets_config_disable_warnings") {
   cflags = [
     "-Wno-shadow",
     "-Wno-unreachable-code",
     "-Wno-format-nonliteral",
     "-Wno-implicit-fallthrough",
   ]
-
-  defines = []
 }
 
 source_set("libwebsockets") {
@@ -107,4 +109,5 @@
   }
 
   public_configs = [ ":libwebsockets_config" ]
+  configs += [ ":libwebsockets_config_disable_warnings" ]
 }
diff --git a/third_party/nlunit-test/BUILD.gn b/third_party/nlunit-test/BUILD.gn
index d690771..f56d0a5 100644
--- a/third_party/nlunit-test/BUILD.gn
+++ b/third_party/nlunit-test/BUILD.gn
@@ -17,7 +17,9 @@
 
 config("nlunit-test_config") {
   include_dirs = [ "repo/src" ]
+}
 
+config("nlunit-test_config_disable_warnings") {
   cflags = [ "-Wno-conversion" ]
 
   if (is_clang) {
@@ -36,4 +38,5 @@
   ]
 
   public_configs = [ ":nlunit-test_config" ]
+  configs += [ ":nlunit-test_config_disable_warnings" ]
 }