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

Unified Diff: build/set_clang_warning_flags.gypi

Issue 437543007: Refactor how clang warning flags are set. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 months 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
Index: build/set_clang_warning_flags.gypi
diff --git a/build/set_clang_warning_flags.gypi b/build/set_clang_warning_flags.gypi
new file mode 100644
index 0000000000000000000000000000000000000000..a7450c29467094f73e70817000c16b8049858bc2
--- /dev/null
+++ b/build/set_clang_warning_flags.gypi
@@ -0,0 +1,44 @@
+# Copyright (c) 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This file is meant to be included to set clang-specific compiler flags.
+# To use this the following variable can be defined:
+# clang_warning_flags: list: Compiler flags to pass to clang.
+# clang_warning_flags_unset: list: Compiler flags to not pass to clang.
+#
+# Only use this in third-party code. In chromium_code, fix your code to not
+# warn instead!
scottmg 2014/08/01 21:00:13 Maybe consider calling this file set_clang_warning
+#
+# To use this, create a gyp target with the following form:
+# Note that the gypi file is included in target_defaults, so it does not need
+# to be explicitly included.
+#
+# Warning flags set by this will be used on all platforms. If you want to set
+# warning flags on only some platforms, you have to do so manually.
+#
+# {
+# 'target_name': 'my_target',
+# 'variables': {
+# 'clang_warning_flags': ['-Wno-awesome-warning'],
+# 'clang_warning_flags_unset': ['-Wpreviously-set-flag'],
+# }
+# }
+
+{
+ 'variables': {
+ 'clang_warning_flags_unset%': [], # Provide a default value.
+ },
+ 'conditions': [
+ ['clang==1', {
+ # This uses >@ instead of @< to also see clang_warning_flags set in
+ # targets directly, not just the clang_warning_flags in target_defaults.
+ 'cflags': [ '>@(clang_warning_flags)' ],
+ 'cflags!': [ '>@(clang_warning_flags_unset)' ],
+ 'xcode_settings': {
+ 'WARNING_CFLAGS': ['>@(clang_warning_flags)'],
+ 'WARNING_CFLAGS!': ['>@(clang_warning_flags_unset)'],
+ },
+ }],
+ ],
+}
« no previous file with comments | « build/common.gypi ('k') | skia/skia_chrome.gypi » ('j') | skia/skia_common.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698