blob: 22d5331968518a6f5d83fa0661263489279a4d75 [file] [log] [blame]
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Platform specific compiler flags for Linux on Starboard. Included from
# gyp_configuration.gypi.
#
{
'variables': {
'compiler_flags_host': [
'-O2',
],
'linker_flags': [
],
'compiler_flags_debug': [
'-frtti',
'-O0',
],
'compiler_flags_devel': [
'-frtti',
'-O2',
],
'compiler_flags_qa': [
'-fno-rtti',
'-O2',
'-gline-tables-only',
],
'compiler_flags_gold': [
'-fno-rtti',
'-O2',
'-gline-tables-only',
],
'conditions': [
['clang==1', {
'common_clang_flags': [
'-Werror',
'-fcolor-diagnostics',
# Default visibility to hidden, to enable dead stripping.
'-fvisibility=hidden',
# protobuf uses hash_map.
'-Wno-deprecated',
'-fno-exceptions',
# Don't warn about the "struct foo f = {0};" initialization pattern.
'-Wno-missing-field-initializers',
'-fno-strict-aliasing', # See http://crbug.com/32204
# Don't warn for invalid access to non-static data member of NULL object.
'-Wno-invalid-offsetof',
# Don't warn about any conversions.
'-Wno-conversion',
# Don't complain about unknown warning options
'-Wno-unknown-warning-option',
# Suppress: "warning: 'override' keyword is a C++11 extension"
'-Wno-c++11-extensions',
# Suppress "case value not in enumerated type"
'-Wno-switch',
# Suppress "'&&' within '||'"
'-Wno-logical-op-parentheses',
# Suppress "error: unused function"
'-Wno-unused-function',
# Suppress "comparison of unsigned enum expression < 0 is always false"
'-Wno-tautological-compare',
# Suppress "[type1] has C-linkage specified, but returns user-defined type [type2] which is incompatible with C"
'-Wno-return-type-c-linkage',
# Suppress "will never be executed"
'-Wno-unreachable-code',
# Suppress "++98 requires a copy constructor when binding a reference to a temporary"
'-Wno-bind-to-temporary-copy',
'-DHAS_LEAK_SANITIZER=0', # Clang 3.3 does not have Leak Sanitizer. This is
# is important because it's assumed in chromium
# that the two always are enabled together.
# Suppress "template argument uses unnamed type"
'-Wno-unnamed-type-template-args',
],
}],
['cobalt_fastbuild==0', {
'compiler_flags_debug': [
'-g',
],
'compiler_flags_devel': [
'-g',
],
'compiler_flags_qa': [
'-gline-tables-only',
],
'compiler_flags_gold': [
'-gline-tables-only',
],
}],
],
},
'target_defaults': {
'cflags_c': [
# Limit to C99. This allows Linux to be a canary build for any
# C11 features that are not supported on some platforms' compilers.
'-std=c99',
],
'cflags_cc': [
'-std=gnu++98',
],
'target_conditions': [
['sb_pedantic_warnings==1', {
'cflags': [
'-Wall',
'-Wextra',
'<@(common_clang_flags)',
],
},{
'cflags': [
'<@(common_clang_flags)',
# 'this' pointer cannot be NULL...pointer may be assumed
# to always convert to true.
'-Wno-undefined-bool-conversion',
# Skia doesn't use overrides.
'-Wno-inconsistent-missing-override',
# Do not warn about unused function params.
'-Wno-unused-parameter',
# shifting a negative signed value is undefined
'-Wno-shift-negative-value',
# Width of bit-field exceeds width of its type- value will be truncated
'-Wno-bitfield-width',
],
}],
['use_asan==1', {
'cflags': [
'-fsanitize=address',
'-fno-omit-frame-pointer',
],
'ldflags': [
'-fsanitize=address',
# Force linking of the helpers in sanitizer_options.cc
'-Wl,-u_sanitizer_options_link_helper',
],
'defines': [
'ADDRESS_SANITIZER',
],
}],
['use_tsan==1', {
'cflags': [
'-fsanitize=thread',
'-fno-omit-frame-pointer',
],
'ldflags': [
'-fsanitize=thread',
],
'defines': [
'THREAD_SANITIZER',
],
}],
],
}, # end of target_defaults
}