Bug 1124033 - Disable C4311 and C4312 in directories exhibiting warnings; r=ehsan
authorGregory Szorc <gps@mozilla.com>
Wed, 23 Mar 2016 17:19:20 -0700
changeset 290167 24210e21e08a8ddc13550ad4aaf49714eb9e8cd4
parent 290166 c6eaa736782322cd3bd63ed99728164f7e4948e0
child 290168 a06363bdde17138159d8803083e01f8680dca182
push id30114
push usercbook@mozilla.com
push dateThu, 24 Mar 2016 15:15:54 +0000
treeherdermozilla-central@24c5fbde4488 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1124033
milestone48.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 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
dom/canvas/moz.build
dom/media/moz.build
dom/media/systemservices/moz.build
ipc/glue/moz.build
js/src/gdb/moz.build
js/src/jsapi-tests/moz.build
js/src/moz.build
js/src/shell/moz.build
media/webrtc/moz.build
media/webrtc/signaling/test/moz.build
security/sandbox/staticruntime/moz.build
--- 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/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,12 @@ LOCAL_INCLUDES += [
     '..',
 ]
 
 USE_LIBS += [
     'static:js',
 ]
 
 OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
+
+# This is intended as a temporary workaround to enable VS2015.
+if CONFIG['_MSC_VER']:
+    CXXFLAGS += ['-wd4312']
--- a/js/src/jsapi-tests/moz.build
+++ b/js/src/jsapi-tests/moz.build
@@ -124,8 +124,12 @@ LOCAL_INCLUDES += [
     '..',
 ]
 
 USE_LIBS += [
     'static:js',
 ]
 
 OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
+
+# This is intended as a temporary workaround to enable VS2015.
+if CONFIG['_MSC_VER']:
+    CXXFLAGS += ['-wd4312']
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -665,16 +665,17 @@ if CONFIG['_MSC_VER']:
     CXXFLAGS += ['-we4067', '-we4258', '-we4275']
     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 += [
--- a/js/src/shell/moz.build
+++ b/js/src/shell/moz.build
@@ -39,8 +39,12 @@ 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',
 ]
+
+# This is intended as a temporary workaround to enable VS2015.
+if CONFIG['_MSC_VER']:
+    CXXFLAGS += ['-wd4312']
--- 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/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', # 'reinterpret_cast': pointer truncation from 'X' to 'Y'
             '-wd4312', # 'reinterpret_cast': conversion from 'DWORD' to 'LPOVERLAPPED' of greater size
         ]