Bug 1528074 - Translate MSVC warning flags to clang spelling where supported r=froydnj
authorDavid Major <dmajor@mozilla.com>
Mon, 11 Mar 2019 01:39:42 +0000
changeset 521630 88c9c5b8d99ca97c8afdb0a62d5787849129a7db
parent 521629 e4c0a53fd80d38780834f23ffe4c291557e951d0
child 521631 dcaf8c29a1eef3bf5eb76a77a3ae1a188ba5b0b3
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
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 - Translate MSVC warning flags to clang spelling where supported r=froydnj clang-cl only acts on five MSVC warning flags: https://github.com/llvm/llvm-project/blob/7219c7e9af7718f026ac5e3ea72249d037898e5b/clang/include/clang/Driver/CLCompatOptions.td#L188-L197 With MSVC now unsupported, most -wdNNNN have no effect and can be removed. This patch converts the five supported warnings to their clang spellings, as preparation for a subsequent patch that will remove all remaining `[/-]w[edo][0-9]{4}`. Differential Revision: https://phabricator.services.mozilla.com/D22582
dom/media/platforms/ffmpeg/ffvpx/moz.build
media/libcubeb/src/moz.build
modules/fdlibm/src/moz.build
security/sandbox/moz.build
toolkit/components/jsoncpp/src/lib_json/moz.build
toolkit/components/protobuf/moz.build
toolkit/crashreporter/crashreporter.mozbuild
--- a/dom/media/platforms/ffmpeg/ffvpx/moz.build
+++ b/dom/media/platforms/ffmpeg/ffvpx/moz.build
@@ -23,23 +23,18 @@ LOCAL_INCLUDES += [
     '../ffmpeg58/include',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     LOCAL_INCLUDES += [
         '../ffmpeg57/include',
     ]
 
-if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
-  CXXFLAGS += [ '-Wno-deprecated-declarations' ]
+CXXFLAGS += [ '-Wno-deprecated-declarations' ]
 if CONFIG['CC_TYPE'] == 'clang':
   CXXFLAGS += [
     '-Wno-unknown-attributes',
   ]
-if CONFIG['CC_TYPE'] == 'clang-cl':
-  CXXFLAGS += [
-    '-wd4996', # deprecated declaration
-  ]
 
 DEFINES['FFVPX_VERSION'] = 46465650
 DEFINES['USING_MOZFFVPX'] = True
 
 FINAL_LIBRARY = 'xul'
--- a/media/libcubeb/src/moz.build
+++ b/media/libcubeb/src/moz.build
@@ -68,17 +68,17 @@ if CONFIG['OS_TARGET'] == 'WINNT':
         'cubeb_winmm.c',
     ]
     DEFINES['USE_WINMM'] = True
     DEFINES['USE_WASAPI'] = True
     OS_LIBS += [
       "avrt",
     ]
     if CONFIG['CC_TYPE'] == 'clang-cl':
-        CXXFLAGS += ['-wd4005'] # C4005: '_USE_MATH_DEFINES' : macro redefinition
+        CXXFLAGS += ['-Wno-macro-redefined'] # '_USE_MATH_DEFINES' : macro redefinition
 
 if CONFIG['OS_TARGET'] == 'Android':
     SOURCES += ['cubeb_opensl.c']
     SOURCES += ['cubeb_resampler.cpp']
     SOURCES += ['cubeb-jni.cpp']
     DEFINES['USE_OPENSL'] = True
     SOURCES += [
         'cubeb_audiotrack.c',
--- a/modules/fdlibm/src/moz.build
+++ b/modules/fdlibm/src/moz.build
@@ -18,17 +18,17 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
 
 if CONFIG['CC_TYPE'] == 'clang':
     CXXFLAGS += [
         '-Wno-dangling-else',
     ]
 
 if CONFIG['CC_TYPE'] == 'clang-cl':
     CXXFLAGS += [
-        '-wd4018', # signed/unsigned mismatch
+        '-Wno-sign-compare',
         '-wd4146', # unary minus operator applied to unsigned type
         '-wd4305', # truncation from 'double' to 'const float'
         '-wd4723', # potential divide by 0
         '-wd4756', # overflow in constant arithmetic
     ]
 
 # These sources can't be unified because there are too many conflicting global
 # variables (e.g. almost every source file defines a `one` and a `huge`).
--- a/security/sandbox/moz.build
+++ b/security/sandbox/moz.build
@@ -168,13 +168,13 @@ elif CONFIG['OS_ARCH'] == 'WINNT':
 
     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
-            '-wd4996', # 'GetVersionExW': was declared deprecated
+            '-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/jsoncpp/src/lib_json/moz.build
+++ b/toolkit/components/jsoncpp/src/lib_json/moz.build
@@ -16,30 +16,30 @@ LOCAL_INCLUDES += [
 
 # This code is only used in the stand-alone minidump analyzer executable so
 # enabling exceptions should be fine.
 if CONFIG['CC_TYPE'] == 'clang-cl':
     CXXFLAGS += [
         '-Xclang',
         '-fcxx-exceptions',
     ]
-elif CONFIG['CC_TYPE'] != 'clang-cl':
+else:
     CXXFLAGS += [
         '-fexceptions',
     ]
 
 # Required to build with exceptions enabled
 DisableStlWrapping()
 
 Library('jsoncpp')
 
 # Suppress warnings in third-party code.
 if CONFIG['CC_TYPE'] == 'clang-cl':
     CXXFLAGS += [
-        '-wd4005', # macro redefinition
+        '-Wno-macro-redefined',
     ]
 elif CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += [
         '-Wno-unused-local-typedefs',
         '-Wno-shadow',
     ]
 
 if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
--- a/toolkit/components/protobuf/moz.build
+++ b/toolkit/components/protobuf/moz.build
@@ -133,18 +133,18 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
     if CONFIG['CC_TYPE'] == 'clang':
         CXXFLAGS += [
             '-Wno-comma',
             '-Wno-null-conversion',
             '-Wno-unused-local-typedef',
         ]
 elif CONFIG['CC_TYPE'] == 'clang-cl':
     CXXFLAGS += [
-        '-wd4005',  # 'WIN32_LEAN_AND_MEAN' : macro redefinition
-        '-wd4018',  # '<' : signed/unsigned mismatch
+        '-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
--- a/toolkit/crashreporter/crashreporter.mozbuild
+++ b/toolkit/crashreporter/crashreporter.mozbuild
@@ -7,17 +7,17 @@
 LOCAL_INCLUDES += [
     '/toolkit/crashreporter/breakpad-client',
     '/toolkit/crashreporter/google-breakpad/src',
 ]
 
 # Suppress warnings in third-party code.
 if CONFIG['CC_TYPE'] == 'clang-cl':
     CXXFLAGS += [
-        '-wd4005', # macro redefinition
+        '-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'):