Bug 1476486 - Apply clang warning suppression in pkix to clang-cl as well. r?Build draft
authorXidorn Quan <me@upsuper.org>
Wed, 18 Jul 2018 11:43:53 +1000
changeset 819514 0bf82dca52d51ec8911d9a928e67a29528e96762
parent 819513 4ec423203fe859c02e984714b6c535a6401f7915
push id116573
push userxquan@mozilla.com
push dateWed, 18 Jul 2018 01:44:54 +0000
reviewersBuild
bugs1476486
milestone63.0a1
Bug 1476486 - Apply clang warning suppression in pkix to clang-cl as well. r?Build MozReview-Commit-ID: CHSmYqnPwWL
security/pkix/test/gtest/moz.build
security/pkix/warnings.mozbuild
--- a/security/pkix/test/gtest/moz.build
+++ b/security/pkix/test/gtest/moz.build
@@ -40,29 +40,29 @@ include('../../warnings.mozbuild')
 # GTest uses a variadic macro in a questionable way and it doesn't seem to be
 # possible to selectively disable just that error when -pedantic-errors is set.
 if CONFIG['CC_TYPE'] == 'gcc':
   CXXFLAGS.remove('-pedantic-errors')
 
 # These warnings are disabled in order to minimize the amount of boilerplate
 # required to implement tests, and/or because they originate in the GTest
 # framework in a way we cannot otherwise work around.
-if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
+if CONFIG['CC_TYPE'] in ('clang', 'clang-cl', 'gcc'):
   CXXFLAGS += [
     '-Wno-old-style-cast',
   ]
-  if CONFIG['CC_TYPE'] == 'clang':
+  if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
     CXXFLAGS += [
       '-Wno-exit-time-destructors',
       '-Wno-global-constructors',
       '-Wno-thread-safety',
       '-Wno-used-but-marked-unused',
       '-Wno-zero-as-null-pointer-constant',
     ]
-elif CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
+if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
   CXXFLAGS += [
     '-wd4350', # behavior change: 'std::_Wrap_alloc<std::allocator<_Ty>>::...
     '-wd4275', # non dll-interface class used as base for dll-interface class
     '-wd4548', # Expression before comma has no effect
     '-wd4625', # copy constructor could not be generated.
     '-wd4626', # assugment operator could not be generated.
     '-wd4640', # construction of local static object is not thread safe.
 
--- a/security/pkix/warnings.mozbuild
+++ b/security/pkix/warnings.mozbuild
@@ -1,21 +1,23 @@
-if CONFIG['CC_TYPE'] == 'clang':
+if CONFIG['CC_TYPE'] in ('clang', 'clang-cl'):
+  if CONFIG['CC_TYPE'] == 'clang':
+    CXXFLAGS += ['-Weverything']
+
   CXXFLAGS += [
-    '-Weverything',
-
     '-Wno-c++98-compat',
     '-Wno-c++98-compat-pedantic',
     '-Wno-missing-prototypes',
     '-Wno-missing-variable-declarations',
     '-Wno-padded',
     '-Wno-reserved-id-macro', # NSPR and NSS use reserved IDs in their include guards.
     '-Wno-weak-vtables', # We rely on the linker to merge the duplicate vtables.
   ]
-elif CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
+
+if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
   CXXFLAGS += [
     '-sdl', # Enable additional security checks based on Microsoft's SDL.
 
     '-Wall',
 
     '-wd4464', # relative include path contains '..'
     '-wd4514', # 'function': unreferenced inline function has been removed
     '-wd4668', # warning C4668: 'X' is not defined as a preprocessor macro,
@@ -39,14 +41,15 @@ elif CONFIG['CC_TYPE'] in ('msvc', 'clan
 
     # XXX: We cannot use /Za (Disable Microsoft Extensions) because windows.h
     # won't copmile with it.
     '-Zc:forScope', # Standard C++ rules for variable scope in for loops.
     '-Zc:inline', # Standard C++ rules requiring definition inline functions.
     '-Zc:rvalueCast', # Standard C++ rules for result of cast being an rvalue.
     '-Zc:strictStrings', # Standard C++ rule that string literals are const.
   ]
-else:
+
+if CONFIG['CC_TYPE'] not in ('msvc', 'clang', 'clang-cl'):
   CXXFLAGS += [
     '-Wall',
     '-Wextra',
     '-pedantic-errors',
   ]