Bug 1198124 - Enable -Wshadow in directories that have no -Wshadow warnings. r=glandium
authorChris Peterson <cpeterson@mozilla.com>
Tue, 25 Aug 2015 09:14:38 -0700
changeset 288042 fc23dad2b3831e68854d2b499514acd3f9d89a9b
parent 288041 d799977fb4099f31f074babd3ee3edb889a9613a
child 288043 b01fa62c7a5216dc2bb47113492efa8f094929cd
push id4792
push useryura.zenevich@gmail.com
push dateWed, 26 Aug 2015 20:00:52 +0000
reviewersglandium
bugs1198124
milestone43.0a1
Bug 1198124 - Enable -Wshadow in directories that have no -Wshadow warnings. r=glandium
accessible/windows/ia2/moz.build
accessible/windows/msaa/moz.build
accessible/windows/sdn/moz.build
b2g/app/moz.build
browser/app/moz.build
docshell/build/moz.build
dom/apps/moz.build
dom/archivereader/moz.build
dom/canvas/compiledtest/moz.build
dom/push/moz.build
dom/xml/moz.build
dom/xslt/xml/moz.build
layout/base/gtest/moz.build
layout/inspector/moz.build
memory/build/moz.build
memory/mozjemalloc/moz.build
memory/replace/dummy/moz.build
memory/replace/jemalloc/moz.build
netwerk/protocol/app/moz.build
netwerk/protocol/device/moz.build
netwerk/protocol/viewsource/moz.build
netwerk/socket/moz.build
parser/xml/moz.build
storage/build/moz.build
toolkit/components/mediasniffer/moz.build
view/moz.build
widget/gtkxtbin/moz.build
widget/x11/moz.build
xpcom/build/moz.build
xpcom/components/moz.build
xpcom/glue/standalone/moz.build
xpcom/glue/standalone/staticruntime/moz.build
xpcom/glue/staticruntime/moz.build
xpcom/io/moz.build
xpfe/components/build/moz.build
xpfe/components/windowds/moz.build
--- a/accessible/windows/ia2/moz.build
+++ b/accessible/windows/ia2/moz.build
@@ -42,11 +42,14 @@ LOCAL_INCLUDES += [
     '/accessible/windows',
     '/accessible/windows/msaa',
     '/accessible/xpcom',
     '/accessible/xul',
 ]
 
 FINAL_LIBRARY = 'xul'
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/accessible/windows/msaa/moz.build
+++ b/accessible/windows/msaa/moz.build
@@ -57,9 +57,12 @@ LOCAL_INCLUDES += [
     '/accessible/xul',
     '/dom/base',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
--- a/accessible/windows/sdn/moz.build
+++ b/accessible/windows/sdn/moz.build
@@ -16,9 +16,12 @@ LOCAL_INCLUDES += [
     '/accessible/html',
     '/accessible/windows/msaa',
     '/accessible/xpcom',
     '/accessible/xul',
 ]
 
 FINAL_LIBRARY = 'xul'
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
--- a/b2g/app/moz.build
+++ b/b2g/app/moz.build
@@ -70,16 +70,19 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
 
 DISABLE_STL_WRAPPING = True
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     OS_LIBS += [
         'version',
     ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 JS_PREFERENCE_FILES += [
     'b2g.js',
 ]
 
 DIST_FILES += [
   'ua-update.json.in',
--- a/browser/app/moz.build
+++ b/browser/app/moz.build
@@ -79,9 +79,12 @@ DISABLE_STL_WRAPPING = True
 if CONFIG['MOZ_LINKER']:
     OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
 
 if CONFIG['HAVE_CLOCK_MONOTONIC']:
     OS_LIBS += CONFIG['REALTIME_LIBS']
 
 JAR_MANIFESTS += ['jar.mn']
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
--- a/docshell/build/moz.build
+++ b/docshell/build/moz.build
@@ -20,9 +20,12 @@ LOCAL_INCLUDES += [
     '/uriloader/prefetch',
 ]
 
 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
     LOCAL_INCLUDES += ['/uriloader/exthandler/mac']
 
 FINAL_LIBRARY = 'xul'
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
--- a/dom/apps/moz.build
+++ b/dom/apps/moz.build
@@ -46,15 +46,18 @@ EXTRA_PP_JS_MODULES += [
     'AppsUtils.jsm',
     'ImportExport.jsm',
     'InterAppCommService.jsm',
     'OperatorApps.jsm',
     'ScriptPreloader.jsm',
     'Webapps.jsm',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/js/xpconnect/wrappers',
 ]
--- a/dom/archivereader/moz.build
+++ b/dom/archivereader/moz.build
@@ -16,16 +16,19 @@ EXPORTS.mozilla.dom.archivereader += [
 UNIFIED_SOURCES += [
     'ArchiveEvent.cpp',
     'ArchiveReader.cpp',
     'ArchiveRequest.cpp',
     'ArchiveZipEvent.cpp',
     'ArchiveZipFile.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     '../base',
 ]
 
 FINAL_LIBRARY = 'xul'
 
--- a/dom/canvas/compiledtest/moz.build
+++ b/dom/canvas/compiledtest/moz.build
@@ -3,13 +3,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 GeckoCppUnitTests([
     'TestWebGLElementArrayCache',
 ])
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     '../',
 ]
--- a/dom/push/moz.build
+++ b/dom/push/moz.build
@@ -33,15 +33,18 @@ XPCSHELL_TESTS_MANIFESTS += [
 EXPORTS.mozilla.dom += [
     'PushManager.h',
 ]
 
 UNIFIED_SOURCES += [
     'PushManager.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     '../workers',
 ]
 
 FINAL_LIBRARY = 'xul'
--- a/dom/xml/moz.build
+++ b/dom/xml/moz.build
@@ -26,16 +26,19 @@ UNIFIED_SOURCES += [
     'nsXMLElement.cpp',
     'nsXMLFragmentContentSink.cpp',
     'nsXMLPrettyPrinter.cpp',
     'ProcessingInstruction.cpp',
     'XMLDocument.cpp',
     'XMLStylesheetProcessingInstruction.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/caps',
     '/dom/base',
     '/dom/html',
--- a/dom/xslt/xml/moz.build
+++ b/dom/xslt/xml/moz.build
@@ -4,16 +4,19 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 UNIFIED_SOURCES += [
     'txXMLParser.cpp',
     'txXMLUtils.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     '../base',
     '../xpath',
     '../xslt',
     '/dom/base',
 ]
--- a/layout/base/gtest/moz.build
+++ b/layout/base/gtest/moz.build
@@ -10,15 +10,18 @@ UNIFIED_SOURCES += [
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 LOCAL_INCLUDES += [
     '/docshell/base',
     '/layout/base'
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 # Workaround bug 1142396. Suppress the warning from gmock library for clang.
 if CONFIG['CLANG_CXX']:
     CXXFLAGS += ['-Wno-null-dereference']
 
 FINAL_LIBRARY = 'xul-gtest'
 
 FAIL_ON_WARNINGS = True
--- a/layout/inspector/moz.build
+++ b/layout/inspector/moz.build
@@ -36,16 +36,19 @@ UNIFIED_SOURCES += [
     'nsFontFaceList.cpp',
 ]
 
 if CONFIG['MOZ_XUL']:
     UNIFIED_SOURCES += [
         'inDOMView.cpp',
     ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '../style',
     '/dom/base',
     '/dom/xbl',
 ]
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -58,9 +58,12 @@ if CONFIG['MOZ_GLUE_IN_PROGRAM']:
 if CONFIG['MOZ_MEMORY'] and (CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android') or
                              CONFIG['MOZ_NATIVE_JEMALLOC']):
     FINAL_LIBRARY = 'mozglue'
 
 if CONFIG['MOZ_REPLACE_MALLOC'] and CONFIG['OS_TARGET'] == 'Darwin':
     # The zone allocator for OSX needs some jemalloc internal functions
     LOCAL_INCLUDES += ['/memory/jemalloc/src/include']
 
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
--- a/memory/mozjemalloc/moz.build
+++ b/memory/mozjemalloc/moz.build
@@ -37,8 +37,10 @@ if CONFIG['OS_TARGET'] == 'Linux':
 
 if CONFIG['MOZ_NUWA_PROCESS']:
     DEFINES['pthread_mutex_lock'] = '__real_pthread_mutex_lock';
 
 LOCAL_INCLUDES += [
     '/memory/build',
 ]
 
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
--- a/memory/replace/dummy/moz.build
+++ b/memory/replace/dummy/moz.build
@@ -7,8 +7,11 @@ DIST_INSTALL = False
 
 SOURCES += [
     'dummy_replace_malloc.c',
 ]
 
 SharedLibrary('dummy_replace_malloc')
 
 DISABLE_STL_WRAPPING = True
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
--- a/memory/replace/jemalloc/moz.build
+++ b/memory/replace/jemalloc/moz.build
@@ -28,8 +28,11 @@ DEFINES['MOZ_REPLACE_JEMALLOC'] = True
 
 GENERATED_INCLUDES += ['../../jemalloc/src/include']
 if CONFIG['_MSC_VER']:
     LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat']
     if not CONFIG['HAVE_INTTYPES_H']:
         LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat/C99']
 
 DISABLE_STL_WRAPPING = True
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
--- a/netwerk/protocol/app/moz.build
+++ b/netwerk/protocol/app/moz.build
@@ -3,16 +3,19 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SOURCES += [
     'AppProtocolHandler.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/caps',
     '/modules/libjar',
     '/netwerk/base',
 ]
--- a/netwerk/protocol/device/moz.build
+++ b/netwerk/protocol/device/moz.build
@@ -13,16 +13,19 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'andr
         'CameraStreamImpl.cpp',
     ]
 
 UNIFIED_SOURCES += [
     'nsDeviceChannel.cpp',
     'nsDeviceProtocolHandler.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/netwerk/base/',
--- a/netwerk/protocol/viewsource/moz.build
+++ b/netwerk/protocol/viewsource/moz.build
@@ -10,15 +10,18 @@ XPIDL_SOURCES += [
 
 XPIDL_MODULE = 'necko_viewsource'
 
 UNIFIED_SOURCES += [
     'nsViewSourceChannel.cpp',
     'nsViewSourceHandler.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/netwerk/base',
 ]
 
--- a/netwerk/socket/moz.build
+++ b/netwerk/socket/moz.build
@@ -16,11 +16,14 @@ XPIDL_MODULE = 'necko_socket'
 
 UNIFIED_SOURCES += [
     'nsSocketProviderService.cpp',
     'nsSOCKSIOLayer.cpp',
     'nsSOCKSSocketProvider.cpp',
     'nsUDPSocketProvider.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
--- a/parser/xml/moz.build
+++ b/parser/xml/moz.build
@@ -30,9 +30,12 @@ EXPORTS += [
 SOURCES += [
     'nsSAXAttributes.cpp',
     'nsSAXLocator.cpp',
     'nsSAXXMLReader.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
--- a/storage/build/moz.build
+++ b/storage/build/moz.build
@@ -7,16 +7,19 @@
 EXPORTS += [
     'mozStorageCID.h',
 ]
 
 SOURCES += [
     'mozStorageModule.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '..',
 ]
 
--- a/toolkit/components/mediasniffer/moz.build
+++ b/toolkit/components/mediasniffer/moz.build
@@ -13,12 +13,16 @@ EXPORTS += [
 UNIFIED_SOURCES += [
     'mp3sniff.c',
     'nsMediaSniffer.cpp',
     'nsMediaSnifferModule.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'Video/Audio')
--- a/view/moz.build
+++ b/view/moz.build
@@ -10,13 +10,16 @@ EXPORTS += [
 ]
 
 # nsViewManager.cpp cannot be built in unified mode because it uses PL_ARENA_CONST_ALIGN_MASK.
 SOURCES += [
     'nsView.cpp',
     'nsViewManager.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
--- a/widget/gtkxtbin/moz.build
+++ b/widget/gtkxtbin/moz.build
@@ -12,8 +12,11 @@ SOURCES += [
     'gtk2xtbin.c',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 DEFINES['_IMPL_GTKXTBIN_API'] = True
 
 CFLAGS += CONFIG['MOZ_GTK2_CFLAGS']
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
--- a/widget/x11/moz.build
+++ b/widget/x11/moz.build
@@ -6,8 +6,11 @@
 
 SOURCES += [
     'keysym2ucs.c',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 CXXFLAGS += CONFIG['TK_CFLAGS']
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
--- a/xpcom/build/moz.build
+++ b/xpcom/build/moz.build
@@ -63,16 +63,19 @@ if CONFIG['OS_ARCH'] != 'WINNT':
 
 # FileLocation.cpp and Omnijar.cpp cannot be built in unified mode because they
 # use plarena.h.
 SOURCES += [
     'FileLocation.cpp',
     'Omnijar.cpp',
 ]
 
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 DEFINES['_IMPL_NS_STRINGAPI'] = True
 DEFINES['OMNIJAR_NAME'] = CONFIG['OMNIJAR_NAME']
--- a/xpcom/components/moz.build
+++ b/xpcom/components/moz.build
@@ -34,16 +34,19 @@ SOURCES += [
     'nsComponentManager.cpp',
 ]
 
 UNIFIED_SOURCES += [
     'ManifestParser.cpp',
     'nsNativeModuleLoader.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 GENERATED_INCLUDES += ['..']
 LOCAL_INCLUDES += [
     '../base',
     '../build',
--- a/xpcom/glue/standalone/moz.build
+++ b/xpcom/glue/standalone/moz.build
@@ -38,16 +38,19 @@ DEFINES['XPCOM_GLUE'] = True
 
 LOCAL_INCLUDES += [
     '../../build',
 ]
 
 # Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
 DISABLE_STL_WRAPPING = True
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 # Include fallible for third party code using the xpcom glue
 USE_LIBS += [
     'fallible',
 ]
 
 # Force to build a static library only
--- a/xpcom/glue/standalone/staticruntime/moz.build
+++ b/xpcom/glue/standalone/staticruntime/moz.build
@@ -33,16 +33,19 @@ LOCAL_INCLUDES += [
 ]
 
 # Statically link to the CRT on Windows
 USE_STATIC_LIBS = True
 
 # Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
 DISABLE_STL_WRAPPING = True
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 # Include fallible for third party code using the xpcom glue
 USE_LIBS += [
     'fallible',
 ]
 
 # Force to build a static library only
--- a/xpcom/glue/staticruntime/moz.build
+++ b/xpcom/glue/staticruntime/moz.build
@@ -31,16 +31,19 @@ LOCAL_INCLUDES += [
 ]
 
 # Statically link to the CRT on Windows
 USE_STATIC_LIBS = True
 
 # Don't use STL wrappers here (i.e. wrapped <new>); they require mozalloc
 DISABLE_STL_WRAPPING = True
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 # Include fallible for third party code using the xpcom glue
 USE_LIBS += [
     'fallible',
 ]
 
 # Force to build a static library only
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
@@ -118,16 +118,19 @@ UNIFIED_SOURCES += [
     'SpecialSystemDirectory.cpp',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     SOURCES += [
         'CocoaFileUtils.mm',
     ]
 
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
     DEFINES['HAVE_USR_LIB64_DIR'] = True
--- a/xpfe/components/build/moz.build
+++ b/xpfe/components/build/moz.build
@@ -9,9 +9,12 @@ SOURCES += [
 ]
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../directory',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FAIL_ON_WARNINGS = True
--- a/xpfe/components/windowds/moz.build
+++ b/xpfe/components/windowds/moz.build
@@ -9,11 +9,14 @@ XPIDL_SOURCES += [
 ]
 
 XPIDL_MODULE = 'windowds'
 
 SOURCES += [
     'nsWindowDataSource.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 FINAL_LIBRARY = 'xul'
 
 FAIL_ON_WARNINGS = True