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