GN: Fix Windows Clang errors
BUG=webrtc:6255
NOTRY=True
Review-Url: https://codereview.webrtc.org/2274713005
Cr-Commit-Position: refs/heads/master@{#13919}
diff --git a/.gn b/.gn
index cc35c5f..52f4402 100644
--- a/.gn
+++ b/.gn
@@ -47,6 +47,7 @@
"//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 ec2d459..82d1233 100644
--- a/third_party/winsdk_samples/BUILD.gn
+++ b/third_party/winsdk_samples/BUILD.gn
@@ -10,9 +10,7 @@
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 @@
"//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 08c79e2..baf6bfd 100644
--- a/webrtc/base/BUILD.gn
+++ b/webrtc/base/BUILD.gn
@@ -508,6 +508,15 @@
"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 e1fce2c..8b1f187 100644
--- a/webrtc/examples/BUILD.gn
+++ b/webrtc/examples/BUILD.gn
@@ -415,6 +415,14 @@
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 d0453c7..7793dfa 100644
--- a/webrtc/media/BUILD.gn
+++ b/webrtc/media/BUILD.gn
@@ -279,7 +279,7 @@
# 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 3f74ff6..8124210 100644
--- a/webrtc/modules/audio_device/BUILD.gn
+++ b/webrtc/modules/audio_device/BUILD.gn
@@ -193,6 +193,23 @@
"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 5cd06c6..8edac89 100644
--- a/webrtc/modules/video_capture/BUILD.gn
+++ b/webrtc/modules/video_capture/BUILD.gn
@@ -136,6 +136,17 @@
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 cf23282..2487976 100644
--- a/webrtc/test/BUILD.gn
+++ b/webrtc/test/BUILD.gn
@@ -417,7 +417,7 @@
# 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",