Bug 1528074 - Remove MSVC warning flags that clang-cl doesn't understand r=chmanchester
authorDavid Major <dmajor@mozilla.com>
Wed, 13 Mar 2019 20:19:08 +0000
changeset 463885 04b7ccd07ab895cce5eeea12333a08a5f906889b
parent 463884 2d47c27e5526e407d5360c4e6bc612febe90494f
child 463886 f20b5098f7a266dbfde7cd871548ba3fd81ea9ae
push id35700
push userncsoregi@mozilla.com
push dateThu, 14 Mar 2019 05:04:11 +0000
treeherdermozilla-central@de231288332b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1528074
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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: https://github.com/llvm/llvm-project/blob/7219c7e9af7718f026ac5e3ea72249d037898e5b/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
dom/media/systemservices/moz.build
dom/media/webrtc/moz.build
dom/plugins/ipc/moz.build
dom/plugins/test/testplugin/testplugin.mozbuild
gfx/vr/service/moz.build
ipc/glue/moz.build
js/src/js-cxxflags.mozbuild
js/src/old-configure.in
js/xpconnect/wrappers/moz.build
layout/base/moz.build
layout/painting/moz.build
media/webrtc/signaling/gtest/moz.build
media/webrtc/trunk/gtest/moz.build
memory/build/moz.build
old-configure.in
security/sandbox/moz.build
toolkit/components/protobuf/moz.build
toolkit/crashreporter/crashreporter.mozbuild
toolkit/crashreporter/test/moz.build
widget/windows/moz.build
xpcom/io/moz.build
--- a/dom/media/systemservices/moz.build
+++ b/dom/media/systemservices/moz.build
@@ -43,22 +43,16 @@ if CONFIG['OS_TARGET'] == 'Android':
     UNIFIED_SOURCES += [
         'OpenSLESProvider.cpp',
     ]
 
 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',
                           'DeviceChangeCallback.h',
                           'MediaChild.h',
                           'MediaParent.h',
                           'MediaSystemResourceClient.h',
                           'MediaSystemResourceManager.h',
--- a/dom/media/webrtc/moz.build
+++ b/dom/media/webrtc/moz.build
@@ -83,15 +83,8 @@ include('/ipc/chromium/chromium-config.m
 #    android API types
 CXXFLAGS += [
     '-Wno-error=attributes',
     '-Wno-error=shadow',
 ]
 
 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
-    ]
--- a/dom/plugins/ipc/moz.build
+++ b/dom/plugins/ipc/moz.build
@@ -142,16 +142,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gtk3
 else:
     # Force build against gtk+2 for struct offsets and such.
     CXXFLAGS += CONFIG['MOZ_GTK2_CFLAGS']
 
 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']
--- a/dom/plugins/test/testplugin/testplugin.mozbuild
+++ b/dom/plugins/test/testplugin/testplugin.mozbuild
@@ -50,21 +50,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
     CXXFLAGS += CONFIG['MOZ_GTK2_CFLAGS']
     CFLAGS += CONFIG['MOZ_GTK2_CFLAGS']
     OS_LIBS += CONFIG['MOZ_GTK2_LIBS']
     OS_LIBS += CONFIG['XLDFLAGS']
     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]
 else:
     FINAL_TARGET = 'dist/plugins'
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
--- a/gfx/vr/service/moz.build
+++ b/gfx/vr/service/moz.build
@@ -33,14 +33,8 @@ if CONFIG['OS_TARGET'] in ('WINNT', 'Lin
     # OpenVRSession includes MacIOSurface.h which includes Mac headers
     # which define Size and Points types in the root namespace that
     # often conflict with our own types.
     SOURCES += [
         'OpenVRSession.cpp'
     ]
 
 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']
--- a/ipc/glue/moz.build
+++ b/ipc/glue/moz.build
@@ -184,22 +184,16 @@ if CONFIG['OS_ARCH'] == 'Darwin':
     SOURCES += [
         'GeckoChildProcessHost.cpp',
     ]
 else:
     UNIFIED_SOURCES += [
         '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',
     '/dom/indexedDB',
     '/dom/storage',
     '/media/webrtc/trunk',
     '/media/webrtc/trunk/webrtc',
     '/xpcom/build',
--- a/js/src/js-cxxflags.mozbuild
+++ b/js/src/js-cxxflags.mozbuild
@@ -2,32 +2,16 @@
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # 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
     CXXFLAGS += ['-fno-strict-aliasing']
     # Error on bad printf-like format strings
     CXXFLAGS += ['-Werror=format']
     # Ignore shadowed variable warnings as there are too many.
     CXXFLAGS += ['-Wno-shadow']
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -129,25 +129,19 @@ case "$target" in
         _WIN32_MSVC=1
 
         # Make sure compilers are valid
         CFLAGS="$CFLAGS -nologo"
         CXXFLAGS="$CXXFLAGS -TP -nologo"
         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>],
             [ printf("Hello World\n"); ],,
             AC_MSG_ERROR([\$(CC) test failed.  You must have MS VC++ in your path to build.]) )
 
         AC_LANG_CPLUSPLUS
         AC_TRY_COMPILE([#include <new.h>],
@@ -158,34 +152,20 @@ case "$target" in
         changequote(,)
         _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
         changequote([,])
 
         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
         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-"
 
         AC_SUBST(MSVC_C_RUNTIME_DLL)
         AC_SUBST(MSVC_CXX_RUNTIME_DLL)
 
         # Check linker version, except in lld builds
         case "$LINKER" in
@@ -619,29 +599,16 @@ case "$target" in
         dnl Disabled on ASan because it causes false-positive ODR violations.
         if test -z "$MOZ_ASAN"; then
             CFLAGS="$CFLAGS -Gw"
             CXXFLAGS="$CXXFLAGS -Gw"
         else
             # 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.
             #
             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
             # We use offsetof on non-POD objects all the time.
             # We also suppress this warning on other platforms.
@@ -697,19 +664,16 @@ case "$target" in
             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
             # __attribute__((unused)) really means "might be unused" and
             # we use it to avoid warnings about things that are unused
             # in some compilation units, but used in many others.  This
             # warning insists on complaining about the latter case, which
             # 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'
         MOZ_OPTIMIZE_FLAGS="-O2"
         MOZ_FIX_LINK_PATHS=
         LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE"
         if test -z "$DEVELOPER_OPTIONS"; then
             LDFLAGS="$LDFLAGS -RELEASE"
--- a/js/xpconnect/wrappers/moz.build
+++ b/js/xpconnect/wrappers/moz.build
@@ -16,22 +16,16 @@ UNIFIED_SOURCES += [
     'WrapperFactory.cpp',
 ]
 
 # XrayWrapper needs to be built separately becaue of template instantiations.
 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'
 
 LOCAL_INCLUDES += [
     '../../../dom/base',
     '../src',
     '/caps',
--- a/layout/base/moz.build
+++ b/layout/base/moz.build
@@ -160,15 +160,10 @@ IPDL_SOURCES += [
 
 FINAL_LIBRARY = 'xul'
 
 BROWSER_CHROME_MANIFESTS += ['tests/browser.ini']
 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']
--- a/layout/painting/moz.build
+++ b/layout/painting/moz.build
@@ -63,15 +63,10 @@ LOCAL_INCLUDES += [
     '/layout/tables',
     '/layout/xul',
 ]
 
 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']
--- a/media/webrtc/signaling/gtest/moz.build
+++ b/media/webrtc/signaling/gtest/moz.build
@@ -36,17 +36,8 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'uiki
 
     # See Bug 1372950, mediapipeline tests seem to cause crashes on Windows
     if CONFIG['OS_TARGET'] != 'WINNT':
         SOURCES += [
             'mediapipeline_unittest.cpp',
         ]
 
     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']
--- a/media/webrtc/trunk/gtest/moz.build
+++ b/media/webrtc/trunk/gtest/moz.build
@@ -476,15 +476,9 @@ if CONFIG['OS_TARGET'] in ['Darwin', 'Li
     if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
         CXXFLAGS += [
             '-Wno-inconsistent-missing-override',
             '-Wno-overloaded-virtual',
         ]
         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)
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -41,18 +41,15 @@ Library('memory')
 if CONFIG['OS_TARGET'] == 'Android' and CONFIG['CC_TYPE'] == 'clang':
     CXXFLAGS += [
         '-Wno-tautological-pointer-compare',
     ]
 
 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
 
 DisableStlWrapping()
 
 if CONFIG['CC_TYPE'] == 'clang-cl':
     AllowCompilerWarnings()  # workaround for bug 1090497
--- a/old-configure.in
+++ b/old-configure.in
@@ -163,44 +163,19 @@ case "$target" in
         AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
         AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
         AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
 
         _CC_SUITE=14
         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}])
           fi
           WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
         fi
 
         AC_SUBST(MSVC_C_RUNTIME_DLL)
@@ -762,35 +737,16 @@ case "$target" in
         dnl Disabled on ASan because it causes false-positive ODR violations.
         if test -z "$MOZ_ASAN"; then
             CFLAGS="$CFLAGS -Gw"
             CXXFLAGS="$CXXFLAGS -Gw"
         else
             # 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.
             #
             # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
             CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
             # We use offsetof on non-POD objects all the time.
             # We also suppress this warning on other platforms.
@@ -846,19 +802,16 @@ case "$target" in
             CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
             # __attribute__((unused)) really means "might be unused" and
             # we use it to avoid warnings about things that are unused
             # in some compilation units, but used in many others.  This
             # warning insists on complaining about the latter case, which
             # 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"
         MOZ_DEBUG_LDFLAGS='-DEBUG'
         WARNINGS_AS_ERRORS='-WX'
         # Use a higher optimization level for clang-cl, so we can come closer
         # to MSVC's performance numbers (see bug 1443590).
         if test -n "$CLANG_CL"; then
--- a/security/sandbox/moz.build
+++ b/security/sandbox/moz.build
@@ -167,15 +167,10 @@ elif CONFIG['OS_ARCH'] == 'WINNT':
     LOCAL_INCLUDES += ['/security/sandbox/chromium']
     LOCAL_INCLUDES += ['/nsprpub']
 
     DisableStlWrapping()
 
     # 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
         ]
--- a/toolkit/components/protobuf/moz.build
+++ b/toolkit/components/protobuf/moz.build
@@ -135,20 +135,16 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
             '-Wno-comma',
             '-Wno-null-conversion',
             '-Wno-unused-local-typedef',
         ]
 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':
     DEFINES['NOGDI'] = True  # wingdi.h defines ERROR as 0 and conflicts with logging.h
 
 if CONFIG['MOZ_USE_PTHREADS']:
     DEFINES['HAVE_PTHREAD'] = True
 
--- a/toolkit/crashreporter/crashreporter.mozbuild
+++ b/toolkit/crashreporter/crashreporter.mozbuild
@@ -8,22 +8,16 @@ LOCAL_INCLUDES += [
     '/toolkit/crashreporter/breakpad-client',
     '/toolkit/crashreporter/google-breakpad/src',
 ]
 
 # Suppress warnings in third-party code.
 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 += [
         '-Wno-unused-local-typedefs',
         '-Wno-shadow',
         '-Wno-deprecated-declarations',
         '-Wno-bool-compare',
         '-Wno-unused-but-set-variable',
--- a/toolkit/crashreporter/test/moz.build
+++ b/toolkit/crashreporter/test/moz.build
@@ -50,12 +50,8 @@ DEFINES['SHARED_LIBRARY'] = '%s%s%s' % (
 )
 
 TEST_HARNESS_FILES.xpcshell.toolkit.crashreporter.test.unit += ['CrashTestUtils.jsm']
 TEST_HARNESS_FILES.xpcshell.toolkit.crashreporter.test.unit_ipc += ['CrashTestUtils.jsm']
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
 
 NO_PGO = True
-
-# Temporary workaround for an issue in upstream breakpad
-if CONFIG['CC_TYPE'] == 'clang-cl':
-    CXXFLAGS += ['-wd4334']
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -156,12 +156,8 @@ OS_LIBS += [
     'rpcrt4',
 ]
 
 if CONFIG['CC_TYPE'] == 'clang-cl':
     SOURCES += [
         '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']
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
@@ -145,14 +145,8 @@ FINAL_LIBRARY = 'xul'
 
 if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
     DEFINES['HAVE_USR_LIB64_DIR'] = True
 
 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']