Bug 1222166 - use gcc/clang warning flags for clang-cl in moz.build files; r=glandium

This patch turns off a number of gcc/clang-specific warnings for
clang-cl as well, as clang-cl understands all the warning flags that
clang understands.  We currently don't turn on all the gcc/clang
warnings for clang-cl in configure, but that can be done separately, and
this patch addresses some pain points (particularly for cairo).
This commit is contained in:
Nathan Froyd 2015-11-05 16:05:26 -05:00
parent 4da9ad5af4
commit b83566b4a1
8 changed files with 86 additions and 68 deletions

View File

@ -108,8 +108,7 @@ SOURCES += [
'src/compiler/translator/glslang_tab.cpp',
]
if CONFIG['GNU_CXX']:
if CONFIG['GNU_CXX'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-attributes',
'-Wno-shadow',
@ -117,16 +116,16 @@ if CONFIG['GNU_CXX']:
'-Wno-unknown-pragmas',
'-Wno-unreachable-code',
]
if CONFIG['CLANG_CXX']:
CXXFLAGS += [
'-Wno-inconsistent-missing-override',
'-Wno-unused-private-field',
]
else:
CXXFLAGS += [
'-Wno-shadow-compatible-local',
'-Wno-shadow-local',
]
if CONFIG['GNU_CXX'] and not CONFIG['CLANG_CXX'] and not CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-shadow-compatible-local',
'-Wno-shadow-local',
]
if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-inconsistent-missing-override',
'-Wno-unused-private-field',
]
if CONFIG['MOZ_DIRECTX_SDK_PATH'] and not CONFIG['MOZ_HAS_WINSDK_WITH_D3D']:
LOCAL_INCLUDES += ['%' + '%s/include/' % CONFIG['MOZ_DIRECTX_SDK_PATH']]

View File

@ -220,7 +220,7 @@ if CONFIG['MOZ_TREE_FREETYPE']:
DEFINES['FT_LCD_FILTER_H'] = '%s/modules/freetype2/include/freetype/ftlcdfil.h' % TOPSRCDIR
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-enum-compare',
'-Wno-int-to-pointer-cast',
@ -229,13 +229,19 @@ if CONFIG['GNU_CC']:
'-Wno-missing-field-initializers',
'-Wno-conversion',
]
if CONFIG['CLANG_CXX']:
CFLAGS += [
'-Wno-incompatible-pointer-types',
'-Wno-tautological-compare',
'-Wno-tautological-constant-out-of-range-compare',
'-Wno-error=uninitialized',
]
if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-incompatible-pointer-types',
'-Wno-tautological-compare',
'-Wno-tautological-constant-out-of-range-compare',
'-Wno-error=uninitialized',
]
if CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-deprecated-register',
'-Wno-macro-redefined',
'-Wno-unused-variable',
]
# See bug 386897.
if CONFIG['GNU_CC'] and CONFIG['OS_TARGET'] == 'Android' and CONFIG['MOZ_OPTIMIZE']:

View File

@ -136,19 +136,23 @@ if use_arm_neon_gcc:
SOURCES['pixman-arm-neon.c'].flags += ['-mfpu=neon']
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-address',
'-Wno-missing-field-initializers',
'-Wno-sign-compare',
'-Wno-unused', # too many unused warnings; ignore
]
if CONFIG['CLANG_CXX']:
CFLAGS += [
'-Wno-incompatible-pointer-types',
'-Wno-tautological-compare',
'-Wno-tautological-constant-out-of-range-compare',
]
if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-incompatible-pointer-types',
'-Wno-tautological-compare',
'-Wno-tautological-constant-out-of-range-compare',
]
if CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-unused-variable',
]
# See bug 386897.
if CONFIG['OS_TARGET'] == 'Android' and CONFIG['MOZ_OPTIMIZE']:

View File

@ -106,32 +106,34 @@ elif CONFIG['CLANG_CL']:
SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-msse4.1']
SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-mavx']
if CONFIG['GNU_CXX'] and CONFIG['CPU_ARCH'] == 'arm':
SOURCES['skia/src/opts/SkBlitRow_opts_arm.cpp'].flags += ['-fomit-frame-pointer']
DEFINES['SKIA_IMPLEMENTATION'] = 1
if not CONFIG['MOZ_ENABLE_SKIA_GPU']:
DEFINES['SK_SUPPORT_GPU'] = 0
if CONFIG['GNU_CXX']:
# Suppress warnings in third-party code.
if CONFIG['GNU_CXX'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-deprecated-declarations',
'-Wno-overloaded-virtual',
'-Wno-sign-compare',
'-Wno-unused-function',
]
if CONFIG['CLANG_CXX']:
CXXFLAGS += [
'-Wno-implicit-fallthrough',
'-Wno-inconsistent-missing-override',
'-Wno-macro-redefined',
'-Wno-unused-private-field',
]
else:
CXXFLAGS += [
'-Wno-logical-op',
'-Wno-maybe-uninitialized',
]
if CONFIG['CPU_ARCH'] == 'arm':
SOURCES['skia/src/opts/SkBlitRow_opts_arm.cpp'].flags += ['-fomit-frame-pointer']
if CONFIG['GNU_CXX'] and not CONFIG['CLANG_CXX'] and not CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-logical-op',
'-Wno-maybe-uninitialized',
]
if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-implicit-fallthrough',
'-Wno-inconsistent-missing-override',
'-Wno-macro-redefined',
'-Wno-unused-private-field',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android', 'gonk', 'qt'):
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']

View File

@ -723,32 +723,34 @@ elif CONFIG['CLANG_CL']:
SOURCES['skia/src/opts/SkOpts_sse41.cpp'].flags += ['-msse4.1']
SOURCES['skia/src/opts/SkOpts_avx.cpp'].flags += ['-mavx']
if CONFIG['GNU_CXX'] and CONFIG['CPU_ARCH'] == 'arm':
SOURCES['skia/src/opts/SkBlitRow_opts_arm.cpp'].flags += ['-fomit-frame-pointer']
DEFINES['SKIA_IMPLEMENTATION'] = 1
if not CONFIG['MOZ_ENABLE_SKIA_GPU']:
DEFINES['SK_SUPPORT_GPU'] = 0
if CONFIG['GNU_CXX']:
# Suppress warnings in third-party code.
if CONFIG['GNU_CXX'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-deprecated-declarations',
'-Wno-overloaded-virtual',
'-Wno-sign-compare',
'-Wno-unused-function',
]
if CONFIG['CLANG_CXX']:
CXXFLAGS += [
'-Wno-implicit-fallthrough',
'-Wno-inconsistent-missing-override',
'-Wno-macro-redefined',
'-Wno-unused-private-field',
]
else:
CXXFLAGS += [
'-Wno-logical-op',
'-Wno-maybe-uninitialized',
]
if CONFIG['CPU_ARCH'] == 'arm':
SOURCES['skia/src/opts/SkBlitRow_opts_arm.cpp'].flags += ['-fomit-frame-pointer']
if CONFIG['GNU_CXX'] and not CONFIG['CLANG_CXX'] and not CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-logical-op',
'-Wno-maybe-uninitialized',
]
if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-implicit-fallthrough',
'-Wno-inconsistent-missing-override',
'-Wno-macro-redefined',
'-Wno-unused-private-field',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3', 'android', 'gonk', 'qt'):
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']

View File

@ -29,7 +29,7 @@ else:
LOCAL_INCLUDES += ['/media/libav']
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-parentheses',
'-Wno-pointer-sign',
@ -37,12 +37,12 @@ if CONFIG['GNU_CC']:
'-Wno-switch',
'-Wno-type-limits',
]
if CONFIG['CLANG_CXX']:
CFLAGS += [
'-Wno-incompatible-pointer-types-discards-qualifiers',
'-Wno-logical-op-parentheses',
]
elif CONFIG['_MSC_VER']:
if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-incompatible-pointer-types-discards-qualifiers',
'-Wno-logical-op-parentheses',
]
if CONFIG['_MSC_VER'] and not CONFIG['CLANG_CL']:
CFLAGS += [
'-wd4090', # 'return' : different 'const' qualifiers
'-wd4018', # '>' : signed/unsigned mismatch

View File

@ -22,10 +22,15 @@ FINAL_LIBRARY = 'gkmedias'
DEFINES['THEORA_DISABLE_ENCODE'] = True
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CFLAGS += ['-Wno-type-limits']
if CONFIG['CLANG_CXX']:
CFLAGS += ['-Wno-tautological-compare']
if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
CFLAGS += ['-Wno-tautological-compare']
if CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-pointer-sign',
'-Wno-shift-op-parentheses',
]
UNIFIED_SOURCES += [
'lib/apiwrapper.c',

View File

@ -82,7 +82,7 @@ if CONFIG['CLANG_CL'] or not CONFIG['_MSC_VER']:
SOURCES[f].flags += ['-mavx2']
# Suppress warnings in third-party code.
if CONFIG['GNU_CC']:
if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
CFLAGS += [
'-Wno-sign-compare',
'-Wno-unused-function', # so many of these warnings; just ignore them