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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 import("//build/config/compiler/compiler.gni") 7 import("//build/config/compiler/compiler.gni")
8 import("//build/config/nacl/config.gni") 8 import("//build/config/nacl/config.gni")
9 import("//build/toolchain/ccache.gni") 9 import("//build/toolchain/ccache.gni")
10 10
11 if (current_cpu == "arm") { 11 if (current_cpu == "arm") {
12 import("//build/config/arm.gni") 12 import("//build/config/arm.gni")
13 } 13 }
14 if (current_cpu == "mipsel" || current_cpu == "mips64el") { 14 if (current_cpu == "mipsel" || current_cpu == "mips64el") {
15 import("//build/config/mips.gni") 15 import("//build/config/mips.gni")
16 } 16 }
17 if (is_posix) { 17 if (is_posix) {
18 import("//build/config/gcc/gcc_version.gni") 18 import("//build/config/gcc/gcc_version.gni")
19 } 19 }
20 if (is_win) { 20 if (is_win) {
21 import("//build/config/win/visual_studio_version.gni") 21 import("//build/config/win/visual_studio_version.gni")
22 } 22 }
23 23
24 declare_args() { 24 declare_args() {
25 # Default to warnings as errors for default workflow, where we catch
26 # warnings with known toolchains. Allow overriding this e.g. for Chromium
27 # builds on Linux that could use a different version of the compiler.
28 treat_warnings_as_errors = true
29
25 # Normally, Android builds are lightly optimized, even for debug builds, to 30 # Normally, Android builds are lightly optimized, even for debug builds, to
26 # keep binary size down. Setting this flag to true disables such optimization 31 # keep binary size down. Setting this flag to true disables such optimization
27 android_full_debug = false 32 android_full_debug = false
28 33
29 # Whether to use the binary binutils checked into third_party/binutils. 34 # Whether to use the binary binutils checked into third_party/binutils.
30 # These are not multi-arch so cannot be used except on x86 and x86-64 (the 35 # These are not multi-arch so cannot be used except on x86 and x86-64 (the
31 # only two architectures that are currently checked in). Turn this off when 36 # only two architectures that are currently checked in). Turn this off when
32 # you are using a custom toolchain and need to control -B in cflags. 37 # you are using a custom toolchain and need to control -B in cflags.
33 linux_use_bundled_binutils = is_linux && current_cpu == "x64" 38 linux_use_bundled_binutils = is_linux && current_cpu == "x64"
34 binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin", 39 binutils_path = rebase_path("//third_party/binutils/Linux_x64/Release/bin",
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 # Disable unused-value (crbug.com/505318) except -Wunused-result. 702 # Disable unused-value (crbug.com/505318) except -Wunused-result.
698 "-Wno-unused-value", 703 "-Wno-unused-value",
699 "-Wunused-result", 704 "-Wunused-result",
700 ] 705 ]
701 } 706 }
702 } else { 707 } else {
703 # Common GCC warning setup. 708 # Common GCC warning setup.
704 cflags += [ 709 cflags += [
705 # Enables. 710 # Enables.
706 "-Wendif-labels", # Weird old-style text after an #endif. 711 "-Wendif-labels", # Weird old-style text after an #endif.
707 "-Werror", # Warnings as errors.
708 712
709 # Disables. 713 # Disables.
710 "-Wno-missing-field-initializers", # "struct foo f = {0};" 714 "-Wno-missing-field-initializers", # "struct foo f = {0};"
711 "-Wno-unused-parameter", # Unused function parameters. 715 "-Wno-unused-parameter", # Unused function parameters.
712 ] 716 ]
713 717
718 if (treat_warnings_as_errors) {
719 cflags += [ "-Werror" ]
Dirk Pranke 2015/11/06 17:56:54 Does it make sense to make this work with the othe
brettw 2015/11/09 02:25:02 Yeah, it makes sense to put this check around the
720 }
721
714 if (is_mac) { 722 if (is_mac) {
715 cflags += [ "-Wnewline-eof" ] 723 cflags += [ "-Wnewline-eof" ]
716 if (!is_nacl) { 724 if (!is_nacl) {
717 # When compiling Objective-C, warns if a method is used whose 725 # When compiling Objective-C, warns if a method is used whose
718 # availability is newer than the deployment target. This is not 726 # availability is newer than the deployment target. This is not
719 # required when compiling Chrome for iOS. 727 # required when compiling Chrome for iOS.
720 cflags += [ "-Wpartial-availability" ] 728 cflags += [ "-Wpartial-availability" ]
721 } 729 }
722 } 730 }
723 731
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 if (symbol_level == 0) { 1235 if (symbol_level == 0) {
1228 configs = [ ":no_symbols" ] 1236 configs = [ ":no_symbols" ]
1229 } else if (symbol_level == 1) { 1237 } else if (symbol_level == 1) {
1230 configs = [ ":minimal_symbols" ] 1238 configs = [ ":minimal_symbols" ]
1231 } else if (symbol_level == 2) { 1239 } else if (symbol_level == 2) {
1232 configs = [ ":symbols" ] 1240 configs = [ ":symbols" ]
1233 } else { 1241 } else {
1234 assert(false) 1242 assert(false)
1235 } 1243 }
1236 } 1244 }
OLDNEW
« 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