Bug 1415470 - build: Enable VS2017 C5038 initializer list order warnings (like gcc -Wreorder). r=glandium

C5038 is a new warning in VS2017, similar to gcc and clang's -Wreorder, which is enabled by -Wall. We should enable C5038 so Windows developers can see these warnings locally instead of when gcc and clang fail with warnings-as-errors on Try.

https://blogs.msdn.microsoft.com/vcblog/2017/07/21/diagnostic-improvements-in-vs2017-15-3-0/

We need to suppress C5038 warnings from Windows Runtime Library header files (wrl.h) included in ANGLE and widget/windows:

z:\build\build\src\vs2017_15.4.2\SDK\Include\10.0.15063.0\winrt\wrl\wrappers\corewrappers.h(515): error C5038: data member 'Microsoft::WRL::Wrappers::Details::SyncLockWithStatusT<Microsoft::WRL::Wrappers::HandleTraits::SemaphoreTraits>::sync_' will be initialized after data member 'Microsoft::WRL::Wrappers::Details::SyncLockWithStatusT<Microsoft::WRL::Wrappers::HandleTraits::SemaphoreTraits>::status_'
...

And suppress C5038 warnings in upstream webrtc code:

media/webrtc/trunk/webrtc/modules/video_capture/windows/BaseFilter.cpp(176): error C5038: data member 'mozilla::media::BaseFilter::mClsId' will be initialized after data member 'mozilla::media::BaseFilter::mState'
media/webrtc/trunk/webrtc/modules/video_capture/windows/BasePin.cpp(169): error C5038: data member 'mozilla::media::BasePin::mFilter' will be initialized after data member 'mozilla::media::BasePin::mLock'
media/webrtc/trunk/webrtc/modules/video_capture/windows/BasePin.cpp(170): error C5038: data member 'mozilla::media::BasePin::mLock' will be initialized after data member 'mozilla::media::BasePin::mName'
media/webrtc/trunk/webrtc/modules/video_capture/windows/BasePin.cpp(172): error C5038: data member 'mozilla::media::BasePin::mDirection' will be initialized after data member 'mozilla::media::BasePin::mQualitySink'

MozReview-Commit-ID: BMDVkvQXNoq

--HG--
extra : rebase_source : 0d5ede9530d0d0750b8fffdc1cdfdc646ec8f22a
This commit is contained in:
Chris Peterson 2017-11-07 19:52:10 -08:00
parent fecbada13a
commit 768b96f58b
7 changed files with 35 additions and 1 deletions

View File

@ -160,6 +160,9 @@ if CONFIG['GNU_CXX']:
'-Wno-shadow-local',
]
if CONFIG['_MSC_VER']:
CXXFLAGS += ['-wd5038'] # C5038: initializer list order warnings
if CONFIG['MOZ_DIRECTX_SDK_PATH'] and not CONFIG['MOZ_HAS_WINSDK_WITH_D3D']:
LOCAL_INCLUDES += ['%' + '%s/include/' % CONFIG['MOZ_DIRECTX_SDK_PATH']]

View File

@ -363,6 +363,7 @@ if CONFIG['_MSC_VER'] and not CONFIG['CLANG_CL']:
CXXFLAGS += [
'-wd4018', # '>' : signed/unsigned mismatch
'-wd4530', # C++ exception handler used, without /EHsc
'-wd5038', # C5038: initializer list order warnings
]
if CONFIG['MOZ_DIRECTX_SDK_PATH'] and not CONFIG['MOZ_HAS_WINSDK_WITH_D3D']:

View File

@ -39,6 +39,9 @@ if CONFIG['GNU_CXX']:
'-Wno-shadow-local',
]
if CONFIG['_MSC_VER']:
CXXFLAGS += ['-wd5038'] # C5038: initializer list order warnings
if CONFIG['MOZ_DIRECTX_SDK_PATH'] and not CONFIG['MOZ_HAS_WINSDK_WITH_D3D']:
LOCAL_INCLUDES += ['%' + '%s/include/' % CONFIG['MOZ_DIRECTX_SDK_PATH']]

View File

@ -180,6 +180,16 @@ case "$target" in
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
if test "$_MSC_VER" -ge "1910"; then # VS2017+
# 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"
fi
_CC_SUITE=14
MSVC_C_RUNTIME_DLL=vcruntime140.dll
MSVC_CXX_RUNTIME_DLL=msvcp140.dll

View File

@ -94,7 +94,10 @@ if CONFIG['MOZ_WEBRTC_SIGNALING']:
if CONFIG['CLANG_CL']:
CXXFLAGS += ['-Wno-invalid-source-encoding']
else:
CXXFLAGS += ['-validate-charset-']
CXXFLAGS += [
'-validate-charset-',
'-wd5038', # C5038 initializer list order warnings
]
if CONFIG['ENABLE_TESTS']:
TEST_DIRS += [

View File

@ -192,6 +192,16 @@ case "$target" in
AC_DEFINE(MSVC_HAS_DIA_SDK)
fi
if test "$_MSC_VER" -ge "1910"; then # VS2017+
# 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"
fi
# C5026: move constructor was implicitly defined as deleted
CXXFLAGS="$CXXFLAGS -wd5026"

View File

@ -147,3 +147,7 @@ CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
OS_LIBS += [
'rpcrt4',
]
if CONFIG['_MSC_VER']:
# C5038: Suppress initializer list order warnings from wrl.h
SOURCES['WindowsUIUtils.cpp'].flags += ['-wd5038']