summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-09-02 10:57:05 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-02 17:57:52 +0000
commit6dd952c77209619a445205998173fc40fb817be1 (patch)
tree19bfb128fb9e34c4be876041cb3e60d88a1a3d6c
parent5698e42ca565654da35056bcf03ee42bbf87fd11 (diff)
downloadchromium_src-6dd952c77209619a445205998173fc40fb817be1.zip
chromium_src-6dd952c77209619a445205998173fc40fb817be1.tar.gz
chromium_src-6dd952c77209619a445205998173fc40fb817be1.tar.bz2
Un-nest configs in GN files.
People sometimes nest targets or configs, usually with the assumption that this limits the visibility of a config to within a target. But this nesting provides no visibility restrictions over declaring it outside of a block. Un-nest for clarity. Re-land of http://crrev.com/1318823008 while preserving config ordering. Review URL: https://codereview.chromium.org/1307223010 Cr-Commit-Position: refs/heads/master@{#346964}
-rw-r--r--build/secondary/testing/gtest/BUILD.gn26
-rw-r--r--sdch/BUILD.gn24
-rw-r--r--third_party/brotli/BUILD.gn25
-rw-r--r--third_party/cld_2/BUILD.gn22
-rw-r--r--third_party/harfbuzz-ng/BUILD.gn66
-rw-r--r--third_party/hunspell/BUILD.gn14
-rw-r--r--third_party/libpng/BUILD.gn17
-rw-r--r--third_party/libusb/BUILD.gn28
-rw-r--r--third_party/libwebp/BUILD.gn13
-rw-r--r--third_party/libxml/BUILD.gn85
-rw-r--r--third_party/libxslt/BUILD.gn33
-rw-r--r--third_party/lzma_sdk/BUILD.gn25
-rw-r--r--third_party/mesa/BUILD.gn18
-rw-r--r--third_party/snappy/BUILD.gn23
-rw-r--r--third_party/sqlite/BUILD.gn50
-rw-r--r--third_party/usrsctp/BUILD.gn24
-rw-r--r--third_party/yasm/BUILD.gn53
-rw-r--r--third_party/zlib/BUILD.gn44
18 files changed, 334 insertions, 256 deletions
diff --git a/build/secondary/testing/gtest/BUILD.gn b/build/secondary/testing/gtest/BUILD.gn
index a9f5007..8e5cdcc 100644
--- a/build/secondary/testing/gtest/BUILD.gn
+++ b/build/secondary/testing/gtest/BUILD.gn
@@ -58,6 +58,15 @@ config("gtest_direct_config") {
defines = [ "UNIT_TEST" ]
}
+config("gtest_warnings") {
+ if (is_win && is_clang) {
+ # The Mutex constructor initializer list in gtest-port.cc is incorrectly
+ # ordered. See
+ # https://groups.google.com/d/msg/googletestframework/S5uSV8L2TX8/U1FaTDa6J6sJ.
+ cflags = [ "-Wno-reorder" ]
+ }
+}
+
static_library("gtest") {
# TODO http://crbug.com/412064 enable this flag all the time.
testonly = !is_component_build
@@ -121,17 +130,12 @@ static_library("gtest") {
public_configs = [ ":gtest_direct_config" ]
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
-
- config("gtest_warnings") {
- if (is_win && is_clang) {
- # The Mutex constructor initializer list in gtest-port.cc is incorrectly
- # ordered. See
- # https://groups.google.com/d/msg/googletestframework/S5uSV8L2TX8/U1FaTDa6J6sJ.
- cflags = [ "-Wno-reorder" ]
- }
- }
- configs += [ ":gtest_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":gtest_warnings",
+ ]
}
source_set("gtest_main") {
diff --git a/sdch/BUILD.gn b/sdch/BUILD.gn
index 6121dfc..4c6c520 100644
--- a/sdch/BUILD.gn
+++ b/sdch/BUILD.gn
@@ -6,6 +6,17 @@ config("sdch_config") {
include_dirs = [ "open-vcdiff/src" ]
}
+# gn orders flags on a target before flags from configs. The default config
+# adds -Wall, and these flags have to be after -Wall -- so they need to come
+# from a config and can't be on the target directly.
+config("sdch_warnings") {
+ cflags = []
+ if (is_linux) {
+ # TODO(mostynb): remove this if open-vcdiff is ever updated for c++11:
+ cflags += [ "-Wno-deprecated-declarations" ]
+ }
+}
+
static_library("sdch") {
sources = [
"logging_forward.h",
@@ -42,6 +53,7 @@ static_library("sdch") {
"open-vcdiff/vsprojects/stdint.h",
]
+ configs += [ ":sdch_warnings" ]
public_configs = [ ":sdch_config" ]
deps = [
@@ -49,18 +61,6 @@ static_library("sdch") {
"//third_party/zlib",
]
- # gn orders flags on a target before flags from configs. The default config
- # adds -Wall, and these flags have to be after -Wall -- so they need to come
- # from a config and can't be on the target directly.
- config("sdch_warnings") {
- cflags = []
- if (is_linux) {
- # TODO(mostynb): remove this if open-vcdiff is ever updated for c++11:
- cflags += [ "-Wno-deprecated-declarations" ]
- }
- }
- configs += [ ":sdch_warnings" ]
-
if (is_linux || is_android) {
include_dirs = [ "linux" ]
} else if (is_ios) {
diff --git a/third_party/brotli/BUILD.gn b/third_party/brotli/BUILD.gn
index 2975f03..d50c694 100644
--- a/third_party/brotli/BUILD.gn
+++ b/third_party/brotli/BUILD.gn
@@ -2,6 +2,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+config("brotli_warnings") {
+ if (is_clang) {
+ # IncrementalCopyFastPath in decode.c can be unused.
+ # (The file looks very different upstream, this is probably no longer
+ # needed after rolling brotli the next time.)
+ cflags = [ "-Wno-unused-function" ]
+ }
+}
+
source_set("brotli") {
sources = [
"dec/bit_reader.c",
@@ -23,17 +32,13 @@ source_set("brotli") {
"dec/types.h",
]
- config("brotli_warnings") {
- if (is_clang) {
- # IncrementalCopyFastPath in decode.c can be unused.
- # (The file looks very different upstream, this is probably no longer
- # needed after rolling brotli the next time.)
- cflags = [ "-Wno-unused-function" ]
- }
- }
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
- configs += [ ":brotli_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":brotli_warnings",
+ ]
# Since we are never debug brotli, freeze the optimizations to -O2.
if (is_debug) {
diff --git a/third_party/cld_2/BUILD.gn b/third_party/cld_2/BUILD.gn
index fc42c4f..bd3a181 100644
--- a/third_party/cld_2/BUILD.gn
+++ b/third_party/cld_2/BUILD.gn
@@ -33,6 +33,14 @@ cld2_platform_support = "static"
cld2_table_size = 2
+config("cld2_data_warnings") {
+ visibility = [ ":*" ]
+ if (is_clang) {
+ # The generated files don't have braces around subobject initializers.
+ cflags = [ "-Wno-missing-braces" ]
+ }
+}
+
source_set("cld2_data") {
sources = gypi_values.cld2_data_sources
if (cld2_table_size == 0) {
@@ -46,15 +54,13 @@ source_set("cld2_data") {
"src/public",
]
- config("cld2_data_warnings") {
- if (is_clang) {
- # The generated files don't have braces around subobject initializers.
- cflags = [ "-Wno-missing-braces" ]
- }
- }
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
- configs += [ ":cld2_data_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":cld2_data_warnings",
+ ]
}
# As in the corresponding gyp file, this just builds the core interfaces for
diff --git a/third_party/harfbuzz-ng/BUILD.gn b/third_party/harfbuzz-ng/BUILD.gn
index 144130a..24aa16f 100644
--- a/third_party/harfbuzz-ng/BUILD.gn
+++ b/third_party/harfbuzz-ng/BUILD.gn
@@ -41,6 +41,36 @@ if (use_system_harfbuzz) {
include_dirs = [ "src" ]
}
+ config("harfbuzz_warnings") {
+ cflags = []
+ if (is_clang) {
+ cflags += [
+ "-Wno-unused-value",
+
+ # Harfbuzz uses unused typedefs for its static asserts (and its
+ # static asserts are strange enough that they can't be replaced
+ # by static_assert).
+ "-Wno-unused-local-typedef",
+ ]
+ }
+ if (is_win) {
+ # Result of 32-bit shift implicitly converted to 64 bits.
+ cflags += [ "/wd4334" ]
+ }
+ }
+
+ # See also chrome/browser/ui/libgtk2ui/BUILD.gn which pulls this.
+ config("pangoft2_link_hack") {
+ if (is_linux && use_pango && !is_chromeos && !is_official_build &&
+ current_cpu != "arm" && current_cpu != "mipsel" &&
+ !is_component_build) {
+ # These symbols are referenced from libpangoft2, which will be
+ # dynamically linked later.
+ ldflags =
+ [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ]
+ }
+ }
+
static_library("harfbuzz-ng") {
sources = [
"src/hb-atomic-private.hh",
@@ -146,26 +176,13 @@ if (use_system_harfbuzz) {
]
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
-
- config("harfbuzz_warnings") {
- cflags = []
- if (is_clang) {
- cflags += [
- "-Wno-unused-value",
-
- # Harfbuzz uses unused typedefs for its static asserts (and its
- # static asserts are strange enough that they can't be replaced
- # by static_assert).
- "-Wno-unused-local-typedef",
- ]
- }
- if (is_win) {
- cflags += [ "/wd4334" ] # Result of 32-bit shift implicitly converted to 64 bits.
- }
- }
- configs += [ ":harfbuzz_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+ # Must be after no_chromium_code for warning flags to be ordered
+ # correctly.
+ ":harfbuzz_warnings",
+ ]
public_configs = [ ":harfbuzz-ng_config" ]
deps = [
@@ -199,16 +216,5 @@ if (use_system_harfbuzz) {
]
}
- # See also chrome/browser/ui/libgtk2ui/BUILD.gn which pulls this.
- config("pangoft2_link_hack") {
- if (is_linux && use_pango && !is_chromeos && !is_official_build &&
- current_cpu != "arm" && current_cpu != "mipsel" &&
- !is_component_build) {
- # These symbols are referenced from libpangoft2, which will be
- # dynamically linked later.
- ldflags =
- [ "-Wl,-uhb_ft_face_create_cached,-uhb_glib_get_unicode_funcs" ]
- }
- }
}
}
diff --git a/third_party/hunspell/BUILD.gn b/third_party/hunspell/BUILD.gn
index 9e9f249..87f5aec 100644
--- a/third_party/hunspell/BUILD.gn
+++ b/third_party/hunspell/BUILD.gn
@@ -10,6 +10,12 @@ config("hunspell_config") {
]
}
+config("hunspell_warnings") {
+ if (is_clang) {
+ cflags = [ "-Wno-unused-private-field" ]
+ }
+}
+
source_set("hunspell") {
sources = [
"google/bdict.cc",
@@ -51,15 +57,11 @@ source_set("hunspell") {
"src/parsers/textparser.hxx",
]
- config("hunspell_warnings") {
- if (is_clang) {
- cflags = [ "-Wno-unused-private-field" ]
- }
- }
-
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
"//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
":hunspell_warnings",
]
public_configs = [ ":hunspell_config" ]
diff --git a/third_party/libpng/BUILD.gn b/third_party/libpng/BUILD.gn
index c4e2650c..2142059 100644
--- a/third_party/libpng/BUILD.gn
+++ b/third_party/libpng/BUILD.gn
@@ -25,6 +25,15 @@ config("libpng_config") {
}
}
+# Must be in a config because of how GN orders flags (otherwise -Wall will
+# appear after this, and turn it back on).
+config("clang_warnings") {
+ if (is_clang) {
+ # Upstream uses self-assignment to avoid warnings.
+ cflags = [ "-Wno-self-assign" ]
+ }
+}
+
source_set("libpng_sources") {
sources = [
"png.c",
@@ -62,14 +71,6 @@ source_set("libpng_sources") {
"//third_party/zlib",
]
- # Must be in a config because of how GN orders flags (otherwise -Wall will
- # appear after this, and turn it back on).
- config("clang_warnings") {
- if (is_clang) {
- # Upstream uses self-assignment to avoid warnings.
- cflags = [ "-Wno-self-assign" ]
- }
- }
configs += [ ":clang_warnings" ]
}
diff --git a/third_party/libusb/BUILD.gn b/third_party/libusb/BUILD.gn
index cce639e..0d7c929 100644
--- a/third_party/libusb/BUILD.gn
+++ b/third_party/libusb/BUILD.gn
@@ -10,6 +10,17 @@ config("libusb_config") {
include_dirs = [ "src/libusb" ]
}
+config("libusb_warnings") {
+ visibility = [ ":*" ]
+ if (is_clang) {
+ # guid_eq in windows_usb.c is unused.
+ cflags = [ "-Wno-unused-function" ]
+ if (is_linux && !use_udev) {
+ cflags += [ "-Wno-pointer-sign" ]
+ }
+ }
+}
+
static_library("libusb") {
sources = [
"src/config.h",
@@ -46,18 +57,13 @@ static_library("libusb") {
deps = []
include_dirs = [ "src/libusb/os" ]
- config("libusb_warnings") {
- if (is_clang) {
- # guid_eq in windows_usb.c is unused.
- cflags = [ "-Wno-unused-function" ]
- if (is_linux && !use_udev) {
- cflags += [ "-Wno-pointer-sign" ]
- }
- }
- }
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
- configs += [ ":libusb_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":libusb_warnings",
+ ]
public_configs = [ ":libusb_config" ]
diff --git a/third_party/libwebp/BUILD.gn b/third_party/libwebp/BUILD.gn
index 3259ec3..d52e1da 100644
--- a/third_party/libwebp/BUILD.gn
+++ b/third_party/libwebp/BUILD.gn
@@ -162,6 +162,13 @@ source_set("libwebp_enc") {
]
}
+config("libwebp_utils_warnings") {
+ if (is_clang) {
+ # See https://code.google.com/p/webp/issues/detail?id=253.
+ cflags = [ "-Wno-incompatible-pointer-types" ]
+ }
+}
+
source_set("libwebp_utils") {
sources = [
"utils/bit_reader.c",
@@ -182,12 +189,6 @@ source_set("libwebp_utils") {
all_dependent_configs = [ ":libwebp_config" ]
- config("libwebp_utils_warnings") {
- if (is_clang) {
- # See https://code.google.com/p/webp/issues/detail?id=253.
- cflags = [ "-Wno-incompatible-pointer-types" ]
- }
- }
public_configs = [ ":libwebp_utils_warnings" ]
}
diff --git a/third_party/libxml/BUILD.gn b/third_party/libxml/BUILD.gn
index c967608..5e633c0 100644
--- a/third_party/libxml/BUILD.gn
+++ b/third_party/libxml/BUILD.gn
@@ -24,6 +24,44 @@ config("libxml_config") {
]
}
+config("libxml_warnings") {
+ if (is_win) {
+ cflags_c = [
+ "/wd4018", # Signed/unsigned mismatch in comparison.
+ "/wd4101", # Unreferenced local variable.
+ ]
+ }
+ if (is_clang) {
+ cflags = [
+ # libxml passes `const unsigned char*` through `const char*`.
+ "-Wno-pointer-sign",
+
+ # pattern.c and uri.c both have an intentional `for (...);` /
+ # `while(...);` loop. I submitted a patch to move the `'` to its own
+ # line, but until that's landed suppress the warning:
+ "-Wno-empty-body",
+
+ # debugXML.c compares array 'arg' to NULL.
+ "-Wno-tautological-pointer-compare",
+
+ # threads.c attempts to forward declare a pthread_equal which doesn't
+ # match the prototype in pthreads.h
+ "-Wno-ignored-attributes",
+
+ # libxml casts from int to long to void*.
+ "-Wno-int-to-void-pointer-cast",
+
+ # libxml passes a volatile LPCRITICAL_SECTION* to a function expecting
+ # a void* volatile*.
+ "-Wno-incompatible-pointer-types",
+
+ # trio_is_special_quantity and trio_is_negative are only
+ # used with certain preprocessor defines set.
+ "-Wno-unused-function",
+ ]
+ }
+}
+
static_library("libxml") {
output_name = "libxml2"
sources = [
@@ -144,7 +182,12 @@ static_library("libxml") {
]
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":libxml_warnings",
+ ]
public_configs = [ ":libxml_config" ]
public_deps = [
@@ -154,12 +197,7 @@ static_library("libxml") {
"//third_party/zlib",
]
- if (is_win) {
- cflags_c = [
- "/wd4018", # Signed/unsigned mismatch in comparison.
- "/wd4101", # Unreferenced local variable.
- ]
- } else if (is_mac || is_ios || is_android) {
+ if (is_mac || is_ios || is_android) {
# http://www.xmlsoft.org/threads.html says that this is required when using
# libxml from several threads, which can possibly happen in chrome. On
# linux, this is picked up by transitivity from pkg-config output from
@@ -167,38 +205,5 @@ static_library("libxml") {
defines = [ "_REENTRANT" ]
}
- config("libxml_warnings") {
- if (is_clang) {
- cflags = [
- # libxml passes `const unsigned char*` through `const char*`.
- "-Wno-pointer-sign",
-
- # pattern.c and uri.c both have an intentional `for (...);` /
- # `while(...);` loop. I submitted a patch to move the `'` to its own
- # line, but until that's landed suppress the warning:
- "-Wno-empty-body",
-
- # debugXML.c compares array 'arg' to NULL.
- "-Wno-tautological-pointer-compare",
-
- # threads.c attempts to forward declare a pthread_equal which doesn't
- # match the prototype in pthreads.h
- "-Wno-ignored-attributes",
-
- # libxml casts from int to long to void*.
- "-Wno-int-to-void-pointer-cast",
-
- # libxml passes a volatile LPCRITICAL_SECTION* to a function expecting
- # a void* volatile*.
- "-Wno-incompatible-pointer-types",
-
- # trio_is_special_quantity and trio_is_negative are only
- # used with certain preprocessor defines set.
- "-Wno-unused-function",
- ]
- }
- }
- configs += [ ":libxml_warnings" ]
-
include_dirs = [ "$os_include" ]
}
diff --git a/third_party/libxslt/BUILD.gn b/third_party/libxslt/BUILD.gn
index 6b46db3..3f27c5de5 100644
--- a/third_party/libxslt/BUILD.gn
+++ b/third_party/libxslt/BUILD.gn
@@ -7,6 +7,19 @@ config("libxslt_config") {
include_dirs = [ "." ]
}
+config("libxslt_warnings") {
+ if (is_clang) {
+ cflags = [
+ # libxslt stores a char[3] in a `const unsigned char*`.
+ "-Wno-pointer-sign",
+
+ # xsltDefaultRegion and xsltCalibrateTimestamps are only
+ # used with certain preprocessor defines set.
+ "-Wno-unused-function",
+ ]
+ }
+}
+
static_library("libxslt") {
sources = [
"libxslt/attributes.c",
@@ -59,21 +72,13 @@ static_library("libxslt") {
"win32/config.h",
]
- config("libxslt_warnings") {
- if (is_clang) {
- cflags = [
- # libxslt stores a char[3] in a `const unsigned char*`.
- "-Wno-pointer-sign",
-
- # xsltDefaultRegion and xsltCalibrateTimestamps are only
- # used with certain preprocessor defines set.
- "-Wno-unused-function",
- ]
- }
- }
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
- configs += [ ":libxslt_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":libxslt_warnings",
+ ]
public_configs = [ ":libxslt_config" ]
cflags = []
diff --git a/third_party/lzma_sdk/BUILD.gn b/third_party/lzma_sdk/BUILD.gn
index 2afe7b4..1f36abd 100644
--- a/third_party/lzma_sdk/BUILD.gn
+++ b/third_party/lzma_sdk/BUILD.gn
@@ -6,6 +6,15 @@ config("lzma_sdk_config") {
include_dirs = [ "." ]
}
+# Must be in a config because of how GN orders flags (otherwise -Wall will
+# appear after this, and turn it back on).
+config("clang_warnings") {
+ if (is_clang) {
+ # Upstream uses self-assignment to avoid warnings.
+ cflags = [ "-Wno-self-assign" ]
+ }
+}
+
static_library("lzma_sdk") {
sources = [
"7z.h",
@@ -50,17 +59,11 @@ static_library("lzma_sdk") {
]
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":clang_warnings",
+ ]
public_configs = [ ":lzma_sdk_config" ]
-
- # Must be in a config because of how GN orders flags (otherwise -Wall will
- # appear after this, and turn it back on).
- config("clang_warnings") {
- if (is_clang) {
- # Upstream uses self-assignment to avoid warnings.
- cflags = [ "-Wno-self-assign" ]
- }
- }
- configs += [ ":clang_warnings" ]
}
diff --git a/third_party/mesa/BUILD.gn b/third_party/mesa/BUILD.gn
index 052401f..58cb60c 100644
--- a/third_party/mesa/BUILD.gn
+++ b/third_party/mesa/BUILD.gn
@@ -148,6 +148,15 @@ config("mesa_internal_warnings") {
}
}
+config("mesa_libglslcommon_warnings") {
+ if (is_clang) {
+ cflags = [
+ # https://bugs.freedesktop.org/show_bug.cgi?id=91645:
+ "-Wno-overloaded-virtual",
+ ]
+ }
+}
+
static_library("mesa_libglslcommon") {
sources = [
"$generated_src_dir/mesa/glcpp-lex.c",
@@ -252,15 +261,6 @@ static_library("mesa_libglslcommon") {
"src/src/glsl/strtod.h",
]
- config("mesa_libglslcommon_warnings") {
- if (is_clang) {
- cflags = [
- # https://bugs.freedesktop.org/show_bug.cgi?id=91645:
- "-Wno-overloaded-virtual",
- ]
- }
- }
-
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
previous_configs = configs
diff --git a/third_party/snappy/BUILD.gn b/third_party/snappy/BUILD.gn
index 97cce89..7eabb7b 100644
--- a/third_party/snappy/BUILD.gn
+++ b/third_party/snappy/BUILD.gn
@@ -16,6 +16,14 @@ config("snappy_config") {
}
}
+config("snappy_warnings") {
+ if (is_clang) {
+ # ComputeTable is unused,
+ # https://code.google.com/p/snappy/issues/detail?id=96
+ cflags = [ "-Wno-unused-function" ]
+ }
+}
+
static_library("snappy") {
sources = [
"src/snappy-internal.h",
@@ -27,16 +35,13 @@ static_library("snappy") {
"src/snappy.h",
]
- config("snappy_warnings") {
- if (is_clang) {
- # ComputeTable is unused,
- # https://code.google.com/p/snappy/issues/detail?id=96
- cflags = [ "-Wno-unused-function" ]
- }
- }
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
- configs += [ ":snappy_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":snappy_warnings",
+ ]
public_configs = [ ":snappy_config" ]
if (is_win) {
diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn
index af6381c..daeda72 100644
--- a/third_party/sqlite/BUILD.gn
+++ b/third_party/sqlite/BUILD.gn
@@ -16,6 +16,27 @@ if (!use_system_sqlite) {
include_dirs = [ "." ]
}
+ config("sqlite_warnings") {
+ cflags = []
+ if (is_clang) {
+ # sqlite contains a few functions that are unused, at least on
+ # Windows with Chromium's sqlite patches applied
+ # (interiorCursorEOF fts3EvalDeferredPhrase
+ # fts3EvalSelectDeferred sqlite3Fts3InitHashTable
+ # sqlite3Fts3InitTok).
+ cflags += [ "-Wno-unused-function" ]
+ }
+ if (is_linux) {
+ cflags += [
+ # SQLite doesn"t believe in compiler warnings,
+ # preferring testing.
+ # http://www.sqlite.org/faq.html#q17
+ "-Wno-int-to-pointer-cast",
+ "-Wno-pointer-to-int-cast",
+ ]
+ }
+ }
+
# "sqlite3" can cause conflicts with the system library.
component("chromium_sqlite3") {
visibility = [ ":*" ]
@@ -69,29 +90,14 @@ if (!use_system_sqlite) {
include_dirs = [ "amalgamation" ]
- config("sqlite_warnings") {
- cflags = []
- if (is_clang) {
- # sqlite contains a few functions that are unused, at least on
- # Windows with Chromium's sqlite patches applied
- # (interiorCursorEOF fts3EvalDeferredPhrase
- # fts3EvalSelectDeferred sqlite3Fts3InitHashTable
- # sqlite3Fts3InitTok).
- cflags += [ "-Wno-unused-function" ]
- }
- if (is_linux) {
- cflags += [
- # SQLite doesn"t believe in compiler warnings,
- # preferring testing.
- # http://www.sqlite.org/faq.html#q17
- "-Wno-int-to-pointer-cast",
- "-Wno-pointer-to-int-cast",
- ]
- }
- }
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
- configs += [ ":sqlite_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered
+ # correctly.
+ ":sqlite_warnings",
+ ]
if (is_linux) {
libs = [ "dl" ]
diff --git a/third_party/usrsctp/BUILD.gn b/third_party/usrsctp/BUILD.gn
index bbea24b..ee77057 100644
--- a/third_party/usrsctp/BUILD.gn
+++ b/third_party/usrsctp/BUILD.gn
@@ -11,6 +11,13 @@ config("usrsctp_config") {
]
}
+config("usrsctp_warnings") {
+ if (is_clang) {
+ # atomic_init in user_atomic.h is a static function in a header.
+ cflags = [ "-Wno-unused-function" ]
+ }
+}
+
static_library("usrsctp") {
sources = [
"usrsctplib/netinet/sctp.h",
@@ -84,16 +91,15 @@ static_library("usrsctp") {
# "SCTP_DEBUG", # Uncomment for SCTP debugging.
]
- config("usrsctp_warnings") {
- if (is_clang) {
- # atomic_init in user_atomic.h is a static function in a header.
- cflags = [ "-Wno-unused-function" ]
- }
- }
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
- configs += [ "//build/config/compiler:no_incompatible_pointer_warnings" ]
- configs += [ ":usrsctp_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # These must be after no_chromium_code for warning flags to be ordered
+ # correctly.
+ "//build/config/compiler:no_incompatible_pointer_warnings",
+ ":usrsctp_warnings",
+ ]
public_configs = [ ":usrsctp_config" ]
diff --git a/third_party/yasm/BUILD.gn b/third_party/yasm/BUILD.gn
index fcb779a..36937b8 100644
--- a/third_party/yasm/BUILD.gn
+++ b/third_party/yasm/BUILD.gn
@@ -135,6 +135,20 @@ if (current_toolchain == host_toolchain) {
]
}
+ config("re2c_warnings") {
+ # re2c is missing CLOSEVOP from one switch.
+ if (is_clang) {
+ cflags = [
+ # re2c is missing CLOSEVOP from one switch.
+ "-Wno-switch",
+
+ # re2c contains many static functions in headers (because it's
+ # a C library predating C99.)
+ "-Wno-unused-function",
+ ]
+ }
+ }
+
executable("re2c") {
sources = [
"source/patched-yasm/tools/re2c/actions.c",
@@ -148,23 +162,13 @@ if (current_toolchain == host_toolchain) {
"source/patched-yasm/tools/re2c/translate.c",
]
- config("re2c_warnings") {
- # re2c is missing CLOSEVOP from one switch.
- if (is_clang) {
- cflags = [
- # re2c is missing CLOSEVOP from one switch.
- "-Wno-switch",
-
- # re2c contains many static functions in headers (because it's
- # a C library predating C99.)
- "-Wno-unused-function",
- ]
- }
- }
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
":yasm_config",
"//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered
+ # correctly.
":re2c_warnings",
]
deps = [
@@ -172,6 +176,15 @@ if (current_toolchain == host_toolchain) {
]
}
+ config("yasm_warnings") {
+ if (is_clang) {
+ cflags = [
+ # reg3264type in x86expr.c is unused.
+ "-Wno-unused-local-typedef",
+ ]
+ }
+ }
+
executable("yasm") {
sources = [
"source/patched-yasm/frontends/yasm/yasm-options.c",
@@ -260,17 +273,11 @@ if (current_toolchain == host_toolchain) {
":yasm_config",
"//build/config/compiler:no_chromium_code",
"//build/config/compiler:no_incompatible_pointer_warnings",
- ]
- config("yasm_warnings") {
- if (is_clang) {
- cflags = [
- # reg3264type in x86expr.c is unused.
- "-Wno-unused-local-typedef",
- ]
- }
- }
- configs += [ ":yasm_warnings" ]
+ # Must be after no_chromium_code for warning flags to be ordered
+ # correctly.
+ ":yasm_warnings",
+ ]
# Yasm generates a bunch of .c files which its source file #include.
# Add the |target_gen_dir| into the include path so it can find them.
diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn
index 0d59218..161d4f5 100644
--- a/third_party/zlib/BUILD.gn
+++ b/third_party/zlib/BUILD.gn
@@ -28,6 +28,13 @@ static_library("zlib_x86_simd") {
configs += [ "//build/config/compiler:no_chromium_code" ]
}
+config("zlib_warnings") {
+ if (is_clang && !is_ios &&
+ (current_cpu == "x86" || current_cpu == "x64")) {
+ cflags = [ "-Wno-incompatible-pointer-types" ]
+ }
+}
+
static_library("zlib") {
if (!is_win) {
# Don't stomp on "libzlib" on other platforms.
@@ -67,17 +74,15 @@ static_library("zlib") {
if (!is_ios && (current_cpu == "x86" || current_cpu == "x64")) {
sources += [ "x86.c" ]
-
- config("zlib_warnings") {
- if (is_clang) {
- cflags = [ "-Wno-incompatible-pointer-types" ]
- }
- }
- configs += [ ":zlib_warnings" ]
}
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":zlib_warnings",
+ ]
public_configs = [ ":zlib_config" ]
deps = [
@@ -85,6 +90,14 @@ static_library("zlib") {
]
}
+config("minizip_warnings") {
+ visibility = [ ":*" ]
+ if (is_clang) {
+ # zlib uses `if ((a == b))` for some reason.
+ cflags = [ "-Wno-parentheses-equality" ]
+ }
+}
+
static_library("minizip") {
sources = [
"contrib/minizip/ioapi.c",
@@ -113,16 +126,13 @@ static_library("minizip") {
":zlib",
]
- config("minizip_warnings") {
- if (is_clang) {
- # zlib uses `if ((a == b))` for some reason.
- cflags = [ "-Wno-parentheses-equality" ]
- }
- }
-
configs -= [ "//build/config/compiler:chromium_code" ]
- configs += [ "//build/config/compiler:no_chromium_code" ]
- configs += [ ":minizip_warnings" ]
+ configs += [
+ "//build/config/compiler:no_chromium_code",
+
+ # Must be after no_chromium_code for warning flags to be ordered correctly.
+ ":minizip_warnings",
+ ]
public_configs = [ ":zlib_config" ]
}