Bug 1124033 - Disable C4311 and C4312 in directories exhibiting warnings; r?ehsan
There are a long tail of C4311 and C4312 warnings in VS2015. Rather than
wait until all of them are fixed to land VS2015, we're taking the easy
way out and disabling these warnings in every directory currently
exhibiting a warning. This is evil. But it is a lesser evil than
globally disabling C4311 and C4312. At least with this approach new
C4311 and C4312 warnings in directories that aren't suppressing them
shouldn't be introduced.
MozReview-Commit-ID: 2cwWrjMD6B9
--- a/accessible/windows/msaa/moz.build
+++ b/accessible/windows/msaa/moz.build
@@ -68,8 +68,14 @@ if CONFIG['CLANG_CL']:
CXXFLAGS += ['-Wno-extra-tokens']
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wshadow']
+
+if CONFIG['_MSC_VER']:
+ # Intended as a temporary workaround to enable compilation on VS2015
+ # AccessibleWrap.cpp(1528): warning C4312: 'reinterpret_cast': conversion
+ # from 'const LONG' to 'void *' of greater size
+ CXXFLAGS += ['-wd4312']
--- a/accessible/xul/moz.build
+++ b/accessible/xul/moz.build
@@ -42,9 +42,14 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
LOCAL_INCLUDES += [
'/accessible/mac',
]
else:
LOCAL_INCLUDES += [
'/accessible/other',
]
+if CONFIG['_MSC_VER']:
+ # This is intended as a temporary hack to support building with VS2015.
+ # 'reinterpret_cast': conversion from 'int32_t' to 'void *' of greater size
+ CXXFLAGS += ['-wd4312']
+
FINAL_LIBRARY = 'xul'
--- a/dom/canvas/moz.build
+++ b/dom/canvas/moz.build
@@ -178,8 +178,13 @@ LOCAL_INCLUDES += [
'/layout/xul',
'/media/libyuv/include',
]
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
CXXFLAGS += CONFIG['TK_CFLAGS']
LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
+
+if CONFIG['_MSC_VER']:
+ # This is intended as a temporary workaround to unblock compilation
+ # on VS2015 in warnings as errors mode.
+ CXXFLAGS += ['-wd4312']
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -319,9 +319,14 @@ if CONFIG['MOZ_GONK_MEDIACODEC']:
include('/ipc/chromium/chromium-config.mozbuild')
# Suppress some GCC warnings being treated as errors:
# - about attributes on forward declarations for types that are already
# defined, which complains about an important MOZ_EXPORT for android::AString
if CONFIG['GNU_CC']:
CXXFLAGS += ['-Wno-error=attributes']
+if CONFIG['_MSC_VER']:
+ # This is intended as a temporary workaround to unblock compilation
+ # on VS2015 in warnings as errors mode.
+ CXXFLAGS += ['-wd4312']
+
FINAL_LIBRARY = 'xul'
--- a/dom/media/systemservices/moz.build
+++ b/dom/media/systemservices/moz.build
@@ -52,16 +52,21 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
else:
LOCAL_INCLUDES += [
'%' + '%s/system/media/wilhelm/include' % CONFIG['ANDROID_SOURCE'],
]
if CONFIG['_MSC_VER']:
DEFINES['__PRETTY_FUNCTION__'] = '__FUNCSIG__'
+ # 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 += ['MediaChild.h',
'MediaParent.h',
'MediaSystemResourceClient.h',
'MediaSystemResourceManager.h',
'MediaSystemResourceManagerChild.h',
'MediaSystemResourceManagerParent.h',
--- a/dom/plugins/ipc/moz.build
+++ b/dom/plugins/ipc/moz.build
@@ -147,8 +147,12 @@ else:
CXXFLAGS += CONFIG['MOZ_GTK2_CFLAGS']
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
if CONFIG['_MSC_VER']:
# 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/ipc/chromium/moz.build
+++ b/ipc/chromium/moz.build
@@ -167,8 +167,14 @@ if '86' not in ost and 'arm' not in ost
'src/base/atomicops_internals_mutex.cc',
]
CXXFLAGS += CONFIG['TK_CFLAGS']
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
+
+if CONFIG['_MSC_VER']:
+ # This is intended as a temporary workaround to enable building with VS2015.
+ # src/base/thread_local.h(110): warning C4312: 'reinterpret_cast':
+ # conversion from 'int' to 'void *' of greater size
+ CXXFLAGS += ['-wd4312']
--- a/ipc/glue/moz.build
+++ b/ipc/glue/moz.build
@@ -131,16 +131,22 @@ SOURCES += [
'BackgroundChildImpl.cpp',
'BackgroundParentImpl.cpp',
'FileDescriptorSetChild.cpp',
'FileDescriptorSetParent.cpp',
'GeckoChildProcessHost.cpp',
'URIUtils.cpp',
]
+if CONFIG['_MSC_VER']:
+ # 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/workers',
'/media/webrtc/trunk',
'/xpcom/build',
]
--- a/js/src/gdb/moz.build
+++ b/js/src/gdb/moz.build
@@ -29,8 +29,11 @@ LOCAL_INCLUDES += [
'..',
]
USE_LIBS += [
'static:js',
]
OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
+
+if CONFIG['_MSC_VER']:
+ CXXFLAGS += ['-wd4312']
\ No newline at end of file
--- a/js/src/jsapi-tests/moz.build
+++ b/js/src/jsapi-tests/moz.build
@@ -119,8 +119,11 @@ LOCAL_INCLUDES += [
'..',
]
USE_LIBS += [
'static:js',
]
OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
+
+if CONFIG['_MSC_VER']:
+ CXXFLAGS += ['-wd4312']
\ No newline at end of file
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -665,16 +665,18 @@ if CONFIG['_MSC_VER']:
CXXFLAGS += ['-wd4146'] # FIXME: unary minus operator applied to unsigned type (bug 1229189)
CXXFLAGS += ['-wd4273'] # FIXME: inconsistent dll linkage (bug 1229666)
# 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 += ['-wd4577']
+ CXXFLAGS += ['-wd4312']
+
if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'):
OS_LIBS += [
'm',
]
if CONFIG['OS_ARCH'] == 'FreeBSD':
OS_LIBS += [
'-pthread',
--- a/js/src/shell/moz.build
+++ b/js/src/shell/moz.build
@@ -39,8 +39,11 @@ OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
# Prepare module loader JS code for embedding
GENERATED_FILES += ['shellmoduleloader.out.h']
shellmoduleloader = GENERATED_FILES['shellmoduleloader.out.h']
shellmoduleloader.script = '../builtin/embedjs.py:generate_shellmoduleloader'
shellmoduleloader.inputs = [
'../js.msg',
'ModuleLoader.js',
]
+
+if CONFIG['_MSC_VER']:
+ CXXFLAGS += ['-wd4312']
\ No newline at end of file
--- a/media/webrtc/moz.build
+++ b/media/webrtc/moz.build
@@ -88,16 +88,17 @@ if CONFIG['MOZ_WEBRTC_SIGNALING']:
'signaling/src/sdp/sipcc/sdp_base64.c',
'signaling/src/sdp/sipcc/sdp_config.c',
'signaling/src/sdp/sipcc/sdp_main.c',
'signaling/src/sdp/sipcc/sdp_services_unix.c',
'signaling/src/sdp/sipcc/sdp_token.c',
'signaling/src/sdp/sipcc/sdp_utils.c',
]
+ GYP_DIRS['signaling'].sandbox_vars['ALLOW_COMPILER_WARNINGS'] = True
GYP_DIRS['signaling'].non_unified_sources += signaling_non_unified_sources
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
GYP_DIRS += ['trunk/testing']
GYP_DIRS['trunk/testing'].input = 'trunk/testing/gtest.gyp'
GYP_DIRS['trunk/testing'].variables = gyp_vars
# We allow warnings for third-party code that can be updated from upstream.
GYP_DIRS['trunk/testing'].sandbox_vars['ALLOW_COMPILER_WARNINGS'] = True
@@ -107,9 +108,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk
GYP_DIRS += ['signalingtest']
GYP_DIRS['signalingtest'].input = 'signaling/signaling.gyp'
GYP_DIRS['signalingtest'].variables = gyp_vars.copy()
GYP_DIRS['signalingtest'].variables.update(
build_for_test=1,
moz_webrtc_mediacodec=0,
build_for_standalone=0
)
+ GYP_DIRS['signalingtest'].sandbox_vars['ALLOW_COMPILER_WARNINGS'] = True
GYP_DIRS['signalingtest'].non_unified_sources += signaling_non_unified_sources
--- a/media/webrtc/signaling/test/moz.build
+++ b/media/webrtc/signaling/test/moz.build
@@ -19,8 +19,14 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CO
include('/ipc/chromium/chromium-config.mozbuild')
include('common.build')
USE_LIBS += [
'/media/webrtc/signalingtest/signaling_ecc/ecc',
'mtransport_s',
]
+if CONFIG['_MSC_VER']:
+ # 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']
+
--- a/parser/html/moz.build
+++ b/parser/html/moz.build
@@ -95,8 +95,13 @@ FINAL_LIBRARY = 'xul'
# DEFINES['ENABLE_VOID_MENUITEM'] = True
LOCAL_INCLUDES += [
'/dom/base',
]
if CONFIG['CLANG_CXX']:
CXXFLAGS += ['-Wno-implicit-fallthrough']
+
+if CONFIG['_MSC_VER']:
+ # This is intended as a temporary hack to support building with VS2015.
+ # 'type cast': conversion from 'unsigned int' to 'nsIContent *' of greater size
+ CXXFLAGS += ['-wd4312']
--- a/security/sandbox/staticruntime/moz.build
+++ b/security/sandbox/staticruntime/moz.build
@@ -28,10 +28,11 @@ if CONFIG['OS_ARCH'] == 'WINNT':
# Suppress warnings in third-party code.
if CONFIG['_MSC_VER']:
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
'-wd4302', # 'reinterpret_cast': truncation from 'LPCSTR' to 'WORD'
+ '-wd4311',
'-wd4312', # 'reinterpret_cast': conversion from 'DWORD' to 'LPOVERLAPPED' of greater size
]
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -105,8 +105,13 @@ for var in ('MOZ_ENABLE_D3D10_LAYER'):
RESFILE = 'widget.res'
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
OS_LIBS += [
'rpcrt4',
]
+
+if CONFIG['_MSC_VER']:
+ # This is intended as a temporary hack to support building with VS2015.
+ # 'reinterpret_cast': conversion from 'int' to 'HANDLE' of greater size
+ CXXFLAGS += ['-wd4312']