Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Unified Diff: build/config/compiler/BUILD.gn

Issue 1422463013: Allow disabling warnings as errors in GN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698