Skip to content

Commit

Permalink
Bug 1222166 - use gcc/clang warning flags for clang-cl in moz.build f…
Browse files Browse the repository at this point in the history
…iles; 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).
  • Loading branch information
froydnj committed Nov 5, 2015
1 parent 4da9ad5 commit b83566b
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 68 deletions.
23 changes: 11 additions & 12 deletions gfx/angle/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -108,25 +108,24 @@ SOURCES += [
'src/compiler/translator/glslang_tab.cpp',
]


if CONFIG['GNU_CXX']:
if CONFIG['GNU_CXX'] or CONFIG['CLANG_CL']:
CXXFLAGS += [
'-Wno-attributes',
'-Wno-shadow',
'-Wno-sign-compare',
'-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']]
Expand Down
22 changes: 14 additions & 8 deletions gfx/cairo/cairo/src/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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']:
Expand Down
18 changes: 11 additions & 7 deletions gfx/cairo/libpixman/src/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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']:
Expand Down
32 changes: 17 additions & 15 deletions gfx/skia/generate_mozbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,32 +106,34 @@
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']
Expand Down
32 changes: 17 additions & 15 deletions gfx/skia/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
14 changes: 7 additions & 7 deletions media/libav/libavcommon.mozbuild
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ 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',
'-Wno-sign-compare',
'-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
Expand Down
11 changes: 8 additions & 3 deletions media/libtheora/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion media/libvpx/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b83566b

Please sign in to comment.