diff --git a/third_party/winsdk_samples/BUILD.gn b/third_party/winsdk_samples/BUILD.gn index 82d12332e3..114f31ff89 100644 --- a/third_party/winsdk_samples/BUILD.gn +++ b/third_party/winsdk_samples/BUILD.gn @@ -13,6 +13,29 @@ if (is_win) { include_dirs = [ baseclasses_dir ] } + config("winsdk_samples_warnings_config") { + if (is_win && is_clang) { + cflags = [ + # Disable warnings failing when compiling with Clang on Windows. + # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 + "-Wno-comment", + "-Wno-delete-non-virtual-dtor", + "-Wno-ignored-attributes", + "-Wno-logical-op-parentheses", + "-Wno-non-pod-varargs", + "-Wno-microsoft-extra-qualification", + "-Wno-missing-braces", + "-Wno-overloaded-virtual", + "-Wno-parentheses", + "-Wno-reorder", + "-Wno-string-conversion", + "-Wno-tautological-constant-out-of-range-compare", + "-Wno-unused-private-field", + "-Wno-writable-strings", + ] + } + } + static_library("winsdk_samples") { sources = [ "$baseclasses_dir/amextra.cpp", @@ -84,26 +107,9 @@ if (is_win) { "//build/config/compiler:chromium_code", "//build/config/win:nominmax", ] - configs += [ "//build/config/compiler:no_chromium_code" ] - if (is_win && is_clang) { - cflags += [ - # Disable warnings failing when compiling with Clang on Windows. - # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 - "-Wno-comment", - "-Wno-delete-non-virtual-dtor", - "-Wno-ignored-attributes", - "-Wno-logical-op-parentheses", - "-Wno-non-pod-varargs", - "-Wno-microsoft-extra-qualification", - "-Wno-missing-braces", - "-Wno-overloaded-virtual", - "-Wno-parentheses", - "-Wno-reorder", - "-Wno-string-conversion", - "-Wno-tautological-constant-out-of-range-compare", - "-Wno-unused-private-field", - "-Wno-writable-strings", - ] - } + configs += [ + "//build/config/compiler:no_chromium_code", + ":winsdk_samples_warnings_config", + ] } } diff --git a/webrtc/api/BUILD.gn b/webrtc/api/BUILD.gn index a1a4a86217..2c26724917 100644 --- a/webrtc/api/BUILD.gn +++ b/webrtc/api/BUILD.gn @@ -301,7 +301,12 @@ if (rtc_include_tests) { # TODO(kjellander): Make the code compile without disabling these flags. # See https://bugs.webrtc.org/3307. if (is_clang && is_win) { - cflags = [ "-Wno-unused-function" ] + cflags = [ + # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6267 + # for -Wno-sign-compare + "-Wno-sign-compare", + "-Wno-unused-function", + ] } if (!is_win) { diff --git a/webrtc/base/BUILD.gn b/webrtc/base/BUILD.gn index 49bd66ae06..a1748cadc4 100644 --- a/webrtc/base/BUILD.gn +++ b/webrtc/base/BUILD.gn @@ -236,6 +236,17 @@ static_library("rtc_task_queue") { } } +config("rtc_base_warnings_config") { + if (is_win && is_clang) { + cflags = [ + # Disable warnings failing when compiling with Clang on Windows. + # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 + "-Wno-sign-compare", + "-Wno-missing-braces", + ] + } +} + static_library("rtc_base") { cflags = [] cflags_cc = [] @@ -260,7 +271,6 @@ static_library("rtc_base") { ] all_dependent_configs = [ ":rtc_base_all_dependent_config" ] - defines = [ "LOGGING=1" ] sources = [ @@ -405,6 +415,14 @@ static_library("rtc_base") { "worker.h", ] + # TODO(henrike): issue 3307, make rtc_base build with the Chromium default + # compiler settings. + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + if (!is_win) { + cflags += [ "-Wno-uninitialized" ] + } + if (build_with_chromium) { if (is_win) { sources += [ "../../webrtc_overrides/webrtc/base/win32socketinit.cc" ] @@ -417,6 +435,7 @@ static_library("rtc_base") { public_configs += [ ":rtc_base_chromium_config" ] } else { + configs += [ ":rtc_base_warnings_config" ] sources += [ "bandwidthsmoother.cc", "bandwidthsmoother.h", @@ -508,14 +527,6 @@ static_library("rtc_base") { "win32socketserver.h", ] } - if (is_win && is_clang) { - cflags += [ - # Disable warnings failing when compiling with Clang on Windows. - # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 - "-Wno-sign-compare", - "-Wno-missing-braces", - ] - } if (rtc_build_json) { deps += [ "//third_party/jsoncpp" ] @@ -528,14 +539,6 @@ static_library("rtc_base") { } } # !build_with_chromium - # TODO(henrike): issue 3307, make rtc_base build with the Chromium default - # compiler settings. - configs -= [ "//build/config/compiler:chromium_code" ] - configs += [ "//build/config/compiler:no_chromium_code" ] - if (!is_win) { - cflags += [ "-Wno-uninitialized" ] - } - if (rtc_build_ssl) { deps += [ "//third_party/boringssl" ] } else { @@ -665,6 +668,10 @@ static_library("rtc_base") { defines += [ "timezone=_timezone" ] sources -= [ "ifaddrs_converter.cc" ] } + if (is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ "//build/config/clang:find_bad_constructs" ] + } } source_set("gtest_prod") { @@ -678,6 +685,16 @@ if (rtc_include_tests) { defines = [ "GTEST_RELATIVE_PATH" ] } + config("rtc_base_tests_utils_warnings_config") { + if (is_win && is_clang) { + cflags = [ + # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6270 + "-Wno-reorder", + "-Wno-sign-compare", + ] + } + } + source_set("rtc_base_tests_utils") { testonly = true sources = [ @@ -696,7 +713,10 @@ if (rtc_include_tests) { "timedelta.h", "unittest_main.cc", ] - configs += [ "..:common_config" ] + configs += [ + "..:common_config", + ":rtc_base_tests_utils_warnings_config", + ] public_configs = [ "..:common_inherited_config", ":rtc_base_tests_utils_exported_config", @@ -709,6 +729,11 @@ if (rtc_include_tests) { public_deps = [ "//testing/gtest", ] + + if (is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ "//build/config/clang:find_bad_constructs" ] + } } } diff --git a/webrtc/examples/BUILD.gn b/webrtc/examples/BUILD.gn index 8b1f187764..c8078f46bf 100644 --- a/webrtc/examples/BUILD.gn +++ b/webrtc/examples/BUILD.gn @@ -391,6 +391,21 @@ if (is_linux || is_win) { } } + config("peerconnection_client_warnings_config") { + if (is_win && is_clang) { + cflags = [ + # Disable warnings failing when compiling with Clang on Windows. + # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 + "-Wno-format", + + # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6271 + # for -Wno-reorder and -Wno-sign-compare + "-Wno-reorder", + "-Wno-sign-compare", + ] + } + } + executable("peerconnection_client") { sources = [ "peerconnection/client/conductor.cc", @@ -415,14 +430,6 @@ if (is_linux || is_win) { cflags = [ "/wd4245" ] configs += [ "//build/config/win:windowed" ] } - if (is_win && is_clang) { - cflags = [ - # Disable warnings failing when compiling with Clang on Windows. - # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 - "-Wno-reorder", - "-Wno-unused-function", - ] - } if (is_linux) { sources += [ "peerconnection/client/linux/main.cc", @@ -443,6 +450,7 @@ if (is_linux || is_win) { "//webrtc/system_wrappers:field_trial_default", "//webrtc/system_wrappers:metrics_default", ] + configs += [ ":peerconnection_client_warnings_config" ] if (rtc_build_json) { deps += [ "//third_party/jsoncpp" ] } diff --git a/webrtc/media/BUILD.gn b/webrtc/media/BUILD.gn index 5f9a0af422..c1eaea257d 100644 --- a/webrtc/media/BUILD.gn +++ b/webrtc/media/BUILD.gn @@ -285,7 +285,12 @@ if (rtc_include_tests) { # TODO(kjellander): Make the code compile without disabling these flags. # See https://bugs.webrtc.org/3307. if (is_clang && is_win) { - cflags = [ "-Wno-unused-function" ] + cflags = [ + # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6266 + # for -Wno-sign-compare + "-Wno-sign-compare", + "-Wno-unused-function", + ] } if (!is_win) { cflags = [ "-Wno-sign-compare" ] diff --git a/webrtc/modules/audio_coding/BUILD.gn b/webrtc/modules/audio_coding/BUILD.gn index 0ea5035bdd..8918347649 100644 --- a/webrtc/modules/audio_coding/BUILD.gn +++ b/webrtc/modules/audio_coding/BUILD.gn @@ -1537,6 +1537,16 @@ if (rtc_include_tests) { } } + config("isac_test_warnings_config") { + if (is_win && is_clang) { + cflags = [ + # Disable warnings failing when compiling with Clang on Windows. + # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 + "-Wno-format", + ] + } + } + executable("isac_test") { testonly = true @@ -1557,13 +1567,7 @@ if (rtc_include_tests) { "//build/config/sanitizers:deps", ] - if (is_win && is_clang) { - cflags = [ - # Disable warnings failing when compiling with Clang on Windows. - # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 - "-Wno-format", - ] - } + configs += [ ":isac_test_warnings_config" ] } executable("g711_test") { diff --git a/webrtc/modules/audio_device/BUILD.gn b/webrtc/modules/audio_device/BUILD.gn index 81242105ac..a8867afe5f 100644 --- a/webrtc/modules/audio_device/BUILD.gn +++ b/webrtc/modules/audio_device/BUILD.gn @@ -24,7 +24,37 @@ config("audio_device_config") { } } +config("audio_device_warnings_config") { + if (is_win && is_clang) { + cflags = [ + # Disable warnings failing when compiling with Clang on Windows. + # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 + "-Wno-bool-conversion", + "-Wno-delete-non-virtual-dtor", + "-Wno-logical-op-parentheses", + "-Wno-microsoft-extra-qualification", + "-Wno-microsoft-goto", + "-Wno-missing-braces", + "-Wno-parentheses-equality", + "-Wno-reorder", + "-Wno-shift-overflow", + "-Wno-tautological-compare", + + # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6265 + # for -Wno-thread-safety-analysis + "-Wno-thread-safety-analysis", + "-Wno-unused-private-field", + ] + } +} + source_set("audio_device") { + configs += [ "../..:common_config" ] + public_configs = [ + "../..:common_inherited_config", + ":audio_device_config", + ] + deps = [ "../..:webrtc_common", "../../base:rtc_base", @@ -193,23 +223,7 @@ source_set("audio_device") { "msdmo.lib", ] } - if (is_win && is_clang) { - cflags += [ - # Disable warnings failing when compiling with Clang on Windows. - # https://bugs.chromium.org/p/webrtc/issues/detail?id=5366 - "-Wno-bool-conversion", - "-Wno-delete-non-virtual-dtor", - "-Wno-logical-op-parentheses", - "-Wno-microsoft-extra-qualification", - "-Wno-microsoft-goto", - "-Wno-missing-braces", - "-Wno-parentheses-equality", - "-Wno-reorder", - "-Wno-shift-overflow", - "-Wno-tautological-compare", - "-Wno-unused-private-field", - ] - } + configs += [ ":audio_device_warnings_config" ] } } else { defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ] @@ -223,12 +237,6 @@ source_set("audio_device") { ] } - configs += [ "../..:common_config" ] - public_configs = [ - "../..:common_inherited_config", - ":audio_device_config", - ] - if (is_clang) { # Suppress warnings from Chrome's Clang plugins. # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. diff --git a/webrtc/modules/video_capture/BUILD.gn b/webrtc/modules/video_capture/BUILD.gn index 8edac8941a..0875ed8ea6 100644 --- a/webrtc/modules/video_capture/BUILD.gn +++ b/webrtc/modules/video_capture/BUILD.gn @@ -76,7 +76,27 @@ if (!build_with_chromium) { } } + config("video_capture_internal_impl_warnings_config") { + if (is_win && is_clang) { + cflags = [ + "-Wno-comment", + "-Wno-ignored-attributes", + + # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6269 + # for -Wno-ignored-qualifiers + "-Wno-ignored-qualifiers", + "-Wno-microsoft-extra-qualification", + "-Wno-missing-braces", + "-Wno-overloaded-virtual", + "-Wno-reorder", + "-Wno-writable-strings", + ] + } + } + source_set("video_capture_internal_impl") { + configs += [ ":video_capture_internal_impl_warnings_config" ] + deps = [ ":video_capture_module", "../../system_wrappers", @@ -136,17 +156,6 @@ if (!build_with_chromium) { deps += [ "//third_party/winsdk_samples" ] } - if (is_win && is_clang) { - cflags = [ - "-Wno-comment", - "-Wno-ignored-attributes", - "-Wno-microsoft-extra-qualification", - "-Wno-missing-braces", - "-Wno-overloaded-virtual", - "-Wno-reorder", - "-Wno-writable-strings", - ] - } if (is_ios) { sources = [ "ios/device_info_ios.h", diff --git a/webrtc/stats/BUILD.gn b/webrtc/stats/BUILD.gn index 3ef6188a18..50f43515d4 100644 --- a/webrtc/stats/BUILD.gn +++ b/webrtc/stats/BUILD.gn @@ -52,5 +52,11 @@ if (rtc_include_tests) { if (is_android) { deps += [ "//testing/android/native_test:native_test_native_code" ] } + + if (is_clang) { + # Suppress warnings from Chrome's Clang plugins. + # See http://code.google.com/p/webrtc/issues/detail?id=163 for details. + configs -= [ "//build/config/clang:find_bad_constructs" ] + } } } diff --git a/webrtc/system_wrappers/BUILD.gn b/webrtc/system_wrappers/BUILD.gn index 6e1b0ae407..826113dae4 100644 --- a/webrtc/system_wrappers/BUILD.gn +++ b/webrtc/system_wrappers/BUILD.gn @@ -133,6 +133,11 @@ source_set("system_wrappers") { cflags = [ "/wd4334" ] # Ignore warning on shift operator promotion. } + if (is_clang) { + # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163). + configs -= [ "//build/config/clang:find_bad_constructs" ] + } + deps += [ "../base:rtc_base_approved" ] } diff --git a/webrtc/test/BUILD.gn b/webrtc/test/BUILD.gn index 2487976094..9fd7d1af69 100644 --- a/webrtc/test/BUILD.gn +++ b/webrtc/test/BUILD.gn @@ -33,13 +33,17 @@ config("channel_transport_warnings_config") { cflags = [ "/wd4302" ] # cast truncation if (is_clang) { - # GN orders flags on a target before flags from configs. The default config - # adds -Wall, and this flag have to be after -Wall -- so they need to - # come from a config and cannot be on the target directly. + # GN orders flags on a target before flags from configs. The default + # config adds -Wall, and this flag have to be after -Wall -- so they need + # to come from a config and cannot be on the target directly. cflags += [ "-Wno-parentheses-equality", "-Wno-reorder", "-Wno-tautological-constant-out-of-range-compare", + + # See https://bugs.chromium.org/p/webrtc/issues/detail?id=6268 + # for -Wno-thread-safety-analysis + "-Wno-thread-safety-analysis", "-Wno-unused-private-field", ] }