| Index: build/config/compiler/BUILD.gn
|
| diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
|
| index 4d3c6ba0c09093bd5137cd32c4d37cdee1db6d40..71d9dc345f89f0f86e0e4e079f3124b682f558c1 100644
|
| --- a/build/config/compiler/BUILD.gn
|
| +++ b/build/config/compiler/BUILD.gn
|
| @@ -22,6 +22,11 @@ if (is_win) {
|
| }
|
|
|
| declare_args() {
|
| + # Default to warnings as errors for default workflow, where we catch
|
| + # warnings with known toolchains. Allow overriding this e.g. for Chromium
|
| + # builds on Linux that could use a different version of the compiler.
|
| + treat_warnings_as_errors = true
|
| +
|
| # Normally, Android builds are lightly optimized, even for debug builds, to
|
| # keep binary size down. Setting this flag to true disables such optimization
|
| android_full_debug = false
|
| @@ -601,10 +606,11 @@ config("default_warnings") {
|
| cflags_cc = []
|
|
|
| if (is_win) {
|
| - cflags += [
|
| - # Treat warnings as errors.
|
| - "/WX",
|
| + if (treat_warnings_as_errors) {
|
| + cflags += [ "/WX" ]
|
| + }
|
|
|
| + cflags += [
|
| # Warnings permanently disabled:
|
|
|
| # C4127: conditional expression is constant
|
| @@ -704,13 +710,16 @@ config("default_warnings") {
|
| cflags += [
|
| # Enables.
|
| "-Wendif-labels", # Weird old-style text after an #endif.
|
| - "-Werror", # Warnings as errors.
|
|
|
| # Disables.
|
| "-Wno-missing-field-initializers", # "struct foo f = {0};"
|
| "-Wno-unused-parameter", # Unused function parameters.
|
| ]
|
|
|
| + if (treat_warnings_as_errors) {
|
| + cflags += [ "-Werror" ]
|
| + }
|
| +
|
| if (is_mac) {
|
| cflags += [ "-Wnewline-eof" ]
|
| if (!is_nacl) {
|
|
|