From 4bc4d2747b297b3d770fe4bb2d6bee0786d2164a Mon Sep 17 00:00:00 2001 From: ehmaldonado Date: Thu, 25 Aug 2016 04:15:40 -0700 Subject: [PATCH] GN: Fix Windows Clang errors BUG=webrtc:6255 NOTRY=True Review-Url: https://codereview.webrtc.org/2274713005 Cr-Commit-Position: refs/heads/master@{#13919} --- .gn | 1 + third_party/winsdk_samples/BUILD.gn | 26 ++++++++++++++++++++++---- webrtc/base/BUILD.gn | 9 +++++++++ webrtc/examples/BUILD.gn | 8 ++++++++ webrtc/media/BUILD.gn | 2 +- webrtc/modules/audio_device/BUILD.gn | 17 +++++++++++++++++ webrtc/modules/video_capture/BUILD.gn | 11 +++++++++++ webrtc/test/BUILD.gn | 2 +- 8 files changed, 70 insertions(+), 6 deletions(-) diff --git a/.gn b/.gn index cc35c5f36b..52f4402b14 100644 --- a/.gn +++ b/.gn @@ -47,6 +47,7 @@ exec_script_whitelist = [ "//build/config/mac/mac_sdk.gni", "//build/config/posix/BUILD.gn", "//build/config/sysroot.gni", + "//build/config/win/BUILD.gn", "//build/config/win/visual_studio_version.gni", "//build/gn_helpers.py", "//build/gypi_to_gn.py", diff --git a/third_party/winsdk_samples/BUILD.gn b/third_party/winsdk_samples/BUILD.gn index ec2d4591ee..82d12332e3 100644 --- a/third_party/winsdk_samples/BUILD.gn +++ b/third_party/winsdk_samples/BUILD.gn @@ -10,9 +10,7 @@ if (is_win) { baseclasses_dir = "src/Samples/multimedia/directshow/baseclasses" config("winsdk_samples_config") { - include_dirs = [ - baseclasses_dir, - ] + include_dirs = [ baseclasses_dir ] } static_library("winsdk_samples") { @@ -87,5 +85,25 @@ if (is_win) { "//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", + ] + } } -} \ No newline at end of file +} diff --git a/webrtc/base/BUILD.gn b/webrtc/base/BUILD.gn index 08c79e2c56..baf6bfd533 100644 --- a/webrtc/base/BUILD.gn +++ b/webrtc/base/BUILD.gn @@ -508,6 +508,15 @@ 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" ] } else { diff --git a/webrtc/examples/BUILD.gn b/webrtc/examples/BUILD.gn index e1fce2c521..8b1f187764 100644 --- a/webrtc/examples/BUILD.gn +++ b/webrtc/examples/BUILD.gn @@ -415,6 +415,14 @@ 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", diff --git a/webrtc/media/BUILD.gn b/webrtc/media/BUILD.gn index d0453c7db8..7793dfa879 100644 --- a/webrtc/media/BUILD.gn +++ b/webrtc/media/BUILD.gn @@ -279,7 +279,7 @@ 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 = [ "-Wno-unused-function" ] } if (!is_win) { cflags = [ "-Wno-sign-compare" ] diff --git a/webrtc/modules/audio_device/BUILD.gn b/webrtc/modules/audio_device/BUILD.gn index 3f74ff68be..81242105ac 100644 --- a/webrtc/modules/audio_device/BUILD.gn +++ b/webrtc/modules/audio_device/BUILD.gn @@ -193,6 +193,23 @@ 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", + ] + } } } else { defines = [ "WEBRTC_DUMMY_AUDIO_BUILD" ] diff --git a/webrtc/modules/video_capture/BUILD.gn b/webrtc/modules/video_capture/BUILD.gn index 5cd06c6117..8edac8941a 100644 --- a/webrtc/modules/video_capture/BUILD.gn +++ b/webrtc/modules/video_capture/BUILD.gn @@ -136,6 +136,17 @@ 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/test/BUILD.gn b/webrtc/test/BUILD.gn index cf23282253..2487976094 100644 --- a/webrtc/test/BUILD.gn +++ b/webrtc/test/BUILD.gn @@ -417,7 +417,7 @@ config("test_renderer_exported_config") { # 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 += [ + cflags = [ "-Wno-bool-conversion", "-Wno-comment", "-Wno-delete-non-virtual-dtor",