1# Copyright (c) 2014 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5# This file is meant to be included to set clang-specific compiler flags. 6# To use this the following variable can be defined: 7# clang_warning_flags: list: Compiler flags to pass to clang. 8# clang_warning_flags_unset: list: Compiler flags to not pass to clang. 9# 10# Only use this in third-party code. In chromium_code, fix your code to not 11# warn instead! 12# 13# Note that the gypi file is included in target_defaults, so it does not need 14# to be explicitly included. 15# 16# Warning flags set by this will be used on all platforms. If you want to set 17# warning flags on only some platforms, you have to do so manually. 18# 19# To use this, create a gyp target with the following form: 20# { 21# 'target_name': 'my_target', 22# 'variables': { 23# 'clang_warning_flags': ['-Wno-awesome-warning'], 24# 'clang_warning_flags_unset': ['-Wpreviously-set-flag'], 25# } 26# } 27 28{ 29 'variables': { 30 'clang_warning_flags_unset%': [], # Provide a default value. 31 }, 32 'conditions': [ 33 ['clang==1', { 34 # This uses >@ instead of @< to also see clang_warning_flags set in 35 # targets directly, not just the clang_warning_flags in target_defaults. 36 'cflags': [ '>@(clang_warning_flags)' ], 37 'cflags!': [ '>@(clang_warning_flags_unset)' ], 38 'xcode_settings': { 39 'WARNING_CFLAGS': ['>@(clang_warning_flags)'], 40 'WARNING_CFLAGS!': ['>@(clang_warning_flags_unset)'], 41 }, 42 'msvs_settings': { 43 'VCCLCompilerTool': { 44 'AdditionalOptions': [ '>@(clang_warning_flags)' ], 45 'AdditionalOptions!': [ '>@(clang_warning_flags_unset)' ], 46 }, 47 }, 48 }], 49 ['clang==0 and host_clang==1', { 50 'target_conditions': [ 51 ['_toolset=="host"', { 52 'cflags': [ '>@(clang_warning_flags)' ], 53 'cflags!': [ '>@(clang_warning_flags_unset)' ], 54 }], 55 ], 56 }], 57 ], 58} 59