Bug 1491849 - Disable C5045 only if optimization is disabled. r=dmajor

I also changed security/certverifier/moz.build a bit while I am here:
* Using '-Xclang' to pass through '-Wall' on clang-cl.
* Now clang-cl will take clang/gcc path because most '-wd****' options have no
  effect on clang-cl. '-wd4010' will have an effect, but we already have the
  corresponding clang/gcc option ('-Wno-unused-parameter').

--HG--
extra : source : df566a1bd9087cc0bfc03fe19fd9d21bf58f5d9c
This commit is contained in:
Masatoshi Kimura 2018-09-15 21:20:32 +09:00
parent 78e7d3e5c7
commit cddaaa8ed5
2 changed files with 18 additions and 7 deletions

View File

@ -60,13 +60,11 @@ TEST_DIRS += [
if CONFIG['CC_TYPE'] == 'clang-cl':
# -Wall on clang-cl maps to -Weverything, which turns on way too
# much, so we're using -W4 instead, which is mapped to clang's
# -Wall -Wextra.
CXXFLAGS += ['-W4']
else:
CXXFLAGS += ['-Wall']
# much, so we're passing through -Wall using -Xclang.
CXXFLAGS += ['-Xclang']
CXXFLAGS += ['-Wall']
if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
if CONFIG['CC_TYPE'] == 'msvc':
# -Wall with Visual C++ enables too many problematic warnings
CXXFLAGS += [
'-wd4324', # structure was padded due to __declspec(align())
@ -98,6 +96,13 @@ if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
'-wd4820', # 'bytes' bytes padding added after construct 'member_name'
]
# Disable Spectre diagnostics only if optimization is disabled.
if not CONFIG['MOZ_OPTIMIZE']:
CXXFLAGS += [
'-wd5045', # Compiler will insert Spectre mitigation for memory
# load if /Qspectre switch specified
]
# MSVC 2010's headers trigger these
CXXFLAGS += [
'-wd4548', # expression before comma has no effect; ...
@ -129,7 +134,7 @@ if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
'-wd4946', # reinterpret_cast used between related types
]
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
if CONFIG['CC_TYPE'] in ('clang', 'clang-cl', 'gcc'):
CXXFLAGS += [
'-Wextra',
'-Wunreachable-code',

View File

@ -70,6 +70,12 @@ elif CONFIG['CC_TYPE'] == 'msvc':
# declaration of '*' hides class member
'-wd4458',
]
# Disable Spectre diagnostics only if optimization is disabled.
if not CONFIG['MOZ_OPTIMIZE']:
CXXFLAGS += [
'-wd5045', # Compiler will insert Spectre mitigation for memory load if
# /Qspectre switch specified
]
if CONFIG['CC_TYPE'] == 'clang-cl':
AllowCompilerWarnings() # workaround for bug 1090497