Bug 1528074 - Remove MSVC warning flags that clang-cl doesn't understand r=chmanchester

Per the previous patch, clang-cl only understands five MSVC-style warning flags: 7219c7e9af/clang/include/clang/Driver/CLCompatOptions.td (L188-L197)

This patch removes the flags that clang-cl doesn't understand.

Differential Revision: https://phabricator.services.mozilla.com/D22588

--HG--
extra : moz-landing-system : lando
This commit is contained in:
David Major 2019-03-13 20:19:08 +00:00
parent 7c11182619
commit e5773183d6
21 changed files with 1 additions and 201 deletions

View File

@ -48,12 +48,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
UNIFIED_SOURCES += ['OSXRunLoopSingleton.cpp']
EXPORTS += ['OSXRunLoopSingleton.h']
if CONFIG['CC_TYPE'] == 'clang-cl':
# This is intended as a temporary workaround to enable building with VS2015.
# media\webrtc\trunk\webrtc/base/criticalsection.h(59): warning C4312:
# 'reinterpret_cast': conversion from 'DWORD' to 'HANDLE' of greater size
CXXFLAGS += ['-wd4312']
EXPORTS.mozilla += ['ShmemPool.h',]
EXPORTS.mozilla.media += ['CamerasTypes.h',

View File

@ -88,10 +88,3 @@ CXXFLAGS += [
DEFINES['TRACING'] = True
FINAL_LIBRARY = 'xul'
if CONFIG['CC_TYPE'] == 'clang-cl':
CXXFLAGS += [
'-wd4275', # non dll-interface class used as base for dll-interface class
'-wd4312', # This is intended as a temporary hack to support building with VS2015
# 'reinterpret_cast': conversion from 'DWORD' to 'HANDLE' of greater size
]

View File

@ -147,11 +147,3 @@ CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-error=shadow']
if CONFIG['CC_TYPE'] == 'clang-cl':
# This is intended as a temporary hack to support building with VS2015.
# conversion from 'X' to 'Y' requires a narrowing conversion
CXXFLAGS += ['-wd4838']
# 'type cast': conversion from 'unsigned int' to 'HIMC' of greater size
CXXFLAGS += ['-wd4312']

View File

@ -55,11 +55,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
OS_LIBS += CONFIG['XLIBS']
OS_LIBS += CONFIG['XEXT_LIBS']
if CONFIG['CC_TYPE'] == 'clang-cl':
# This is intended as a temporary hack to support building with VS2015.
# conversion from 'X' to 'Y' requires a narrowing conversion
CXXFLAGS += ['-wd4838']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
FINAL_TARGET = 'dist/plugins/%s.plugin/Contents/MacOS' % cocoa_name
OBJDIR_FILES.dist.plugins['%s.plugin' % cocoa_name].Contents += ['%s/Info.plist' % relative_path]

View File

@ -38,9 +38,3 @@ if CONFIG['OS_TARGET'] in ('WINNT', 'Linux', 'Darwin'):
]
FINAL_LIBRARY = 'xul'
# This is intended as a temporary hack to enable VS2015 builds.
if CONFIG['CC_TYPE'] == 'clang-cl':
# ovr_capi_dynamic.h '<unnamed-tag>': Alignment specifier is less than
# actual alignment (8), and will be ignored
CXXFLAGS += ['-wd4359']

View File

@ -189,12 +189,6 @@ else:
'GeckoChildProcessHost.cpp',
]
if CONFIG['CC_TYPE'] == 'clang-cl':
# This is intended as a temporary hack to support building with VS2015.
# 'reinterpret_cast': conversion from 'DWORD' to 'HANDLE' of greater size
SOURCES['BackgroundChildImpl.cpp'].flags += ['-wd4312']
SOURCES['BackgroundParentImpl.cpp'].flags += ['-wd4312']
LOCAL_INCLUDES += [
'/caps',
'/dom/broadcastchannel',

View File

@ -7,22 +7,6 @@
# ICU pkg-config flags
CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
if CONFIG['CC_TYPE'] == 'clang-cl':
# C4805 warns mixing bool with other integral types in computation.
# But given the conversion from bool is specified, and this is a
# pattern widely used in code in js/src, suppress this warning here.
CXXFLAGS += ['-wd4805']
# C4661 ("no suitable definition provided for explicit template
# instantiation request") is emitted for all Parser methods that
# have a Parser<FullParseHandler> definition but no
# Parser<SyntaxParseHandler> definition, see bug 1167030.
CXXFLAGS += ['-wd4661']
# FIXME: unary minus operator applied to unsigned type (bug 1229189)
CXXFLAGS += ['-wd4146']
# FIXME: 'operation' : conversion from 'type1' to 'type2' of
# greater size (bug 1259304)
CXXFLAGS += ['-wd4312']
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
# Also disable strict-aliasing for GCC compiler, that is enabled by default
# starting with version 7.1, see Bug 1363009

View File

@ -134,15 +134,9 @@ case "$target" in
if test -z "$CLANG_CL"; then
CPPFLAGS="$CPPFLAGS -utf-8"
fi
# MSVC warning C4800 warns when a value is implicitly cast to bool,
# because this also forces narrowing to a single byte, which can be a
# perf hit. But this matters so little in practice (and often we want
# that behavior) that it's better to turn it off.
# _CRT_SECURE_NO_WARNINGS disables warnings about using MSVC-specific
# secure CRT functions.
# MSVC warning C4595 warns non-member operator new or delete functions
# may not be declared inline, as of VS2015 Update 2.
CXXFLAGS="$CXXFLAGS -wd4800 -wd4595 -D_CRT_SECURE_NO_WARNINGS"
CXXFLAGS="$CXXFLAGS -D_CRT_SECURE_NO_WARNINGS"
AC_LANG_SAVE
AC_LANG_C
AC_TRY_COMPILE([#include <stdio.h>],
@ -163,24 +157,10 @@ case "$target" in
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
# C5038: Enable initializer list order warnings
# The -w1#### flag treats warning C#### as if it was a warning level
# 1 warning, and thus enables it because we enable /W3 warnings. We
# don't use -we#### because it would enable warning C#### but treat
# it as an error, even in third-party code.
# https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
CXXFLAGS="$CXXFLAGS -w15038"
_CC_SUITE=14
MSVC_C_RUNTIME_DLL=vcruntime140.dll
MSVC_CXX_RUNTIME_DLL=msvcp140.dll
# C5026: move constructor was implicitly defined as deleted
CXXFLAGS="$CXXFLAGS -wd5026"
# C5027: move assignment operator was implicitly defined as deleted
CXXFLAGS="$CXXFLAGS -wd5027"
# -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
@ -624,19 +604,6 @@ case "$target" in
# String tail merging doesn't play nice with ASan's ODR checker.
LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
fi
# khuey says we can safely ignore MSVC warning C4251
# MSVC warning C4244 (implicit type conversion may lose data) warns
# and requires workarounds for perfectly valid code. Also, GCC/clang
# don't warn about it by default. So for consistency/sanity, we turn
# it off on MSVC, too.
# MSVC warning C4267 warns for narrowing type conversions from size_t
# to 32-bit integer types on 64-bit platforms. Since this is virtually
# the same thing as C4244, we disable C4267, too.
CFLAGS="$CFLAGS -wd4244 -wd4267"
CXXFLAGS="$CXXFLAGS -wd4244 -wd4267 -wd4251"
# Silence "warning C4065: switch statement contains 'default' but no
# 'case' labels". See bug 1461304.
CXXFLAGS="$CXXFLAGS -wd4065"
if test -n "$CLANG_CL"; then
# XXX We should combine some of these with our generic GCC-style
# warning checks.
@ -702,9 +669,6 @@ case "$target" in
# is annoying, and rather noisy.
CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
fi
# make 'foo == bar;' error out
CFLAGS="$CFLAGS -we4553"
CXXFLAGS="$CXXFLAGS -we4553"
LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib"
MOZ_DEBUG_LDFLAGS='-DEBUG'
WARNINGS_AS_ERRORS='-WX'

View File

@ -21,12 +21,6 @@ SOURCES += [
'XrayWrapper.cpp',
]
# warning C4661 for FilteringWrapper
if CONFIG['CC_TYPE'] == 'clang-cl':
CXXFLAGS += [
'-wd4661', # no suitable definition provided for explicit template instantiation request
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'

View File

@ -165,10 +165,5 @@ MARIONETTE_LAYOUT_MANIFESTS += ['tests/marionette/manifest.ini']
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini']
if CONFIG['CC_TYPE'] == 'clang-cl':
# This is intended as a temporary hack to support building with VS2015.
# 'type cast': conversion from 'unsigned int' to 'void *' of greater size
CXXFLAGS += ['-wd4312']
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-error=shadow']

View File

@ -68,10 +68,5 @@ FINAL_LIBRARY = 'xul'
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
if CONFIG['CC_TYPE'] == 'clang-cl':
# This is intended as a temporary hack to support building with VS2015.
# 'type cast': conversion from 'unsigned int' to 'void *' of greater size
CXXFLAGS += ['-wd4312']
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-error=shadow']

View File

@ -41,12 +41,3 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uikit' and CONFIG['OS_TARGET'] != 'Android':
]
FINAL_LIBRARY = 'xul-gtest'
if CONFIG['CC_TYPE'] == 'clang-cl':
# This is intended as a temporary workaround to enable warning free building
# with VS2015.
# reinterpret_cast': conversion from 'DWORD' to 'HANDLE' of greater size
CXXFLAGS += ['-wd4312']
# Disable warning for decorated name length exceeded, name was truncated
CXXFLAGS += ['-wd4503']

View File

@ -481,10 +481,4 @@ if CONFIG['OS_TARGET'] in ['Darwin', 'Linux', 'WINNT']:
if CONFIG['CC_TYPE'] == 'clang':
CXXFLAGS += ['-Wno-comma']
if CONFIG['CC_TYPE'] == 'clang-cl':
# This is intended as a temporary workaround to enable warning free building
# with VS2015.
# reinterpret_cast': conversion from 'DWORD' to 'HANDLE' of greater size
CXXFLAGS += ['-wd4312']
GeckoProgram('webrtc-gtest', linkage=None)

View File

@ -46,9 +46,6 @@ if CONFIG['OS_TARGET'] == 'Android' and CONFIG['CC_TYPE'] == 'clang':
if CONFIG['MOZ_BUILD_APP'] != 'memory':
FINAL_LIBRARY = 'mozglue'
if CONFIG['CC_TYPE'] == 'clang-cl':
CXXFLAGS += ['-wd4273'] # inconsistent dll linkage (bug 558163)
if CONFIG['MOZ_REPLACE_MALLOC_STATIC']:
DEFINES['MOZ_REPLACE_MALLOC_STATIC'] = True

View File

@ -168,34 +168,9 @@ case "$target" in
MSVC_C_RUNTIME_DLL=vcruntime140.dll
MSVC_CXX_RUNTIME_DLL=msvcp140.dll
# C5038: Enable initializer list order warnings
# The -w1#### flag treats warning C#### as if it was a warning level
# 1 warning, and thus enables it because we enable /W3 warnings. We
# don't use -we#### because it would enable warning C#### but treat
# it as an error, even in third-party code.
# https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level
CXXFLAGS="$CXXFLAGS -w15038"
# C5026: move constructor was implicitly defined as deleted
CXXFLAGS="$CXXFLAGS -wd5026"
# C5027: move assignment operator was implicitly defined as deleted
CXXFLAGS="$CXXFLAGS -wd5027"
# -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
# https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
# for dbghelp.h, imagehlp.h, and shobj.h
# C4091: 'typedef ': ignored on left of '' when no variable is declared
CFLAGS="$CFLAGS -wd4091"
CXXFLAGS="$CXXFLAGS -wd4091"
# This is intended as a temporary hack to support building with VS2015.
# 'noexcept' used with no exception handling mode specified;
# termination on exception is not guaranteed. Specify /EHsc
CXXFLAGS="$CXXFLAGS -wd4577"
if test -n "$WIN_UCRT_REDIST_DIR"; then
if test ! -d "$WIN_UCRT_REDIST_DIR"; then
AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
@ -767,25 +742,6 @@ case "$target" in
# String tail merging doesn't play nice with ASan's ODR checker.
LDFLAGS="$LDFLAGS -opt:nolldtailmerge"
fi
# khuey says we can safely ignore MSVC warning C4251
# MSVC warning C4244 (implicit type conversion may lose data) warns
# and requires workarounds for perfectly valid code. Also, GCC/clang
# don't warn about it by default. So for consistency/sanity, we turn
# it off on MSVC, too.
# MSVC warning C4267 warns for narrowing type conversions from size_t
# to 32-bit integer types on 64-bit platforms. Since this is virtually
# the same thing as C4244, we disable C4267, too.
# MSVC warning C4800 warns when a value is implicitly cast to bool,
# because this also forces narrowing to a single byte, which can be a
# perf hit. But this matters so little in practice (and often we want
# that behavior) that it's better to turn it off.
# MSVC warning C4595 warns non-member operator new or delete functions
# may not be declared inline, as of VS2015 Update 2.
CFLAGS="$CFLAGS -wd4244 -wd4267"
CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4800 -wd4595"
# Silence "warning C4065: switch statement contains 'default' but no
# 'case' labels". See bug 1461304.
CXXFLAGS="$CXXFLAGS -wd4065"
if test -n "$CLANG_CL"; then
# XXX We should combine some of these with our generic GCC-style
# warning checks.
@ -851,9 +807,6 @@ case "$target" in
# is annoying, and rather noisy.
CXXFLAGS="$CXXFLAGS -Wno-used-but-marked-unused"
fi
# make 'foo == bar;' error out
CFLAGS="$CFLAGS -we4553"
CXXFLAGS="$CXXFLAGS -we4553"
# Silence VS2017 15.5+ TR1 deprecation warnings hit by older gtest versions
CXXFLAGS="$CXXFLAGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING"
LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"

View File

@ -172,10 +172,5 @@ elif CONFIG['OS_ARCH'] == 'WINNT':
# Suppress warnings in third-party code.
if CONFIG['CC_TYPE'] == 'clang-cl':
CXXFLAGS += [
'-wd4275', # non dll-interface class exception used as base for dll-interface class
'-wd4717', # recursive on all control paths, function will cause runtime stack overflow
'-Wno-deprecated-declarations', # 'GetVersionExW': was declared deprecated
'-wd4302', # 'reinterpret_cast': truncation from 'LPCSTR' to 'WORD'
'-wd4311', # 'reinterpret_cast': pointer truncation from 'LPOVERLAPPED' to 'DWORD'
'-wd4312', # 'reinterpret_cast': conversion from 'DWORD' to 'LPOVERLAPPED' of greater size
]

View File

@ -140,10 +140,6 @@ elif CONFIG['CC_TYPE'] == 'clang-cl':
CXXFLAGS += [
'-Wno-macro-redefined', # 'WIN32_LEAN_AND_MEAN' : macro redefinition
'-Wno-sign-compare',
'-wd4065', # switch statement contains 'default' but no 'case' labels
'-wd4099', # mismatched class/struct tags
'-wd4305', # double to float truncation
'-wd4506', # no definition for inline function (protobuf issue #240)
]
if CONFIG['OS_TARGET'] == 'WINNT':

View File

@ -13,12 +13,6 @@ LOCAL_INCLUDES += [
if CONFIG['CC_TYPE'] == 'clang-cl':
CXXFLAGS += [
'-Wno-macro-redefined',
'-wd4146', # negative unsigned
'-wd4334', # 32-bit shift to 64 bits
'-wd4804', # unsafe use of type 'bool'
]
CFLAGS += [
'-wd4312', # conversion to greater size
]
elif CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += [

View File

@ -55,7 +55,3 @@ TEST_HARNESS_FILES.xpcshell.toolkit.crashreporter.test.unit_ipc += ['CrashTestUt
include('/toolkit/crashreporter/crashreporter.mozbuild')
NO_PGO = True
# Temporary workaround for an issue in upstream breakpad
if CONFIG['CC_TYPE'] == 'clang-cl':
CXXFLAGS += ['-wd4334']

View File

@ -161,7 +161,3 @@ if CONFIG['CC_TYPE'] == 'clang-cl':
'ToastNotification.cpp',
'ToastNotificationHandler.cpp',
]
# C5038: Suppress initializer list order warnings from wrl.h
SOURCES['ToastNotification.cpp'].flags += ['-wd5038']
SOURCES['ToastNotificationHandler.cpp'].flags += ['-wd5038']
SOURCES['WindowsUIUtils.cpp'].flags += ['-wd5038']

View File

@ -150,9 +150,3 @@ LOCAL_INCLUDES += [
'!..',
'../build',
]
if CONFIG['CC_TYPE'] == 'clang-cl':
# This is intended as a temporary hack to support building with VS2015.
# '_snwprintf' : format string '%s' requires an argument of type 'wchar_t *',
# but variadic argument 3 has type 'char16ptr_t'
CXXFLAGS += ['-wd4477']