Bug 1272513 - Part 1: Suppress -Wshadow warnings-as-errors in some directories. r=glandium
authorChris Peterson <cpeterson@mozilla.com>
Wed, 11 May 2016 00:00:01 -0700
changeset 338483 2572c0758dd4377a832c1e8ed16522dc829634ad
parent 338482 98b952dc0a1f6c7677d8f5ac982f7dae3b9fcb3f
child 338484 0ee18d7a875a77016dfe5f9ac651787bab7a48d9
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1272513
milestone49.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 1272513 - Part 1: Suppress -Wshadow warnings-as-errors in some directories. r=glandium
accessible/atk/moz.build
accessible/base/moz.build
accessible/generic/moz.build
accessible/html/moz.build
accessible/ipc/moz.build
accessible/other/moz.build
accessible/xpcom/moz.build
accessible/xul/moz.build
caps/moz.build
devtools/shared/heapsnapshot/moz.build
devtools/shared/heapsnapshot/tests/gtest/moz.build
docshell/base/moz.build
docshell/shistory/moz.build
dom/base/moz.build
dom/bindings/moz.build
dom/bindings/test/moz.build
dom/cache/moz.build
dom/camera/moz.build
dom/canvas/moz.build
dom/events/moz.build
dom/html/moz.build
dom/indexedDB/moz.build
dom/ipc/moz.build
dom/media/bridge/moz.build
dom/media/gmp/moz.build
dom/media/gmp/widevine-adapter/moz.build
dom/media/gtest/moz.build
dom/media/mediasink/moz.build
dom/media/mediasource/moz.build
dom/media/moz.build
dom/media/ogg/moz.build
dom/media/platforms/moz.build
dom/media/platforms/omx/moz.build
dom/media/standalone/moz.build
dom/media/systemservices/moz.build
dom/media/wave/moz.build
dom/media/webaudio/blink/moz.build
dom/media/webaudio/moz.build
dom/media/webm/moz.build
dom/media/webrtc/moz.build
dom/media/webspeech/recognition/moz.build
dom/media/webspeech/synth/moz.build
dom/mobileconnection/moz.build
dom/mobilemessage/moz.build
dom/network/moz.build
dom/notification/moz.build
dom/plugins/base/moz.build
dom/plugins/ipc/moz.build
dom/plugins/test/testplugin/testplugin.mozbuild
dom/promise/moz.build
dom/quota/moz.build
dom/svg/moz.build
dom/workers/moz.build
dom/xbl/moz.build
dom/xslt/base/moz.build
dom/xslt/xpath/moz.build
dom/xslt/xslt/moz.build
dom/xul/moz.build
dom/xul/templates/moz.build
editor/composer/moz.build
editor/libeditor/moz.build
embedding/browser/moz.build
embedding/components/webbrowserpersist/moz.build
embedding/components/windowwatcher/moz.build
extensions/cookie/moz.build
extensions/spellcheck/src/moz.build
gfx/2d/moz.build
gfx/gl/moz.build
gfx/layers/apz/test/gtest/moz.build
gfx/layers/moz.build
gfx/skia/generate_mozbuild.py
gfx/skia/moz.build
gfx/tests/gtest/moz.build
image/decoders/moz.build
image/moz.build
image/test/gtest/moz.build
intl/hyphenation/glue/moz.build
intl/strres/moz.build
intl/uconv/moz.build
intl/unicharutil/moz.build
ipc/chromium/moz.build
ipc/glue/moz.build
ipc/testshell/moz.build
js/ipc/moz.build
js/src/gdb/moz.build
js/src/jsapi-tests/moz.build
js/src/moz.build
js/src/shell/moz.build
js/xpconnect/loader/moz.build
js/xpconnect/src/moz.build
js/xpconnect/wrappers/moz.build
layout/base/moz.build
layout/build/moz.build
layout/forms/moz.build
layout/generic/moz.build
layout/mathml/moz.build
layout/svg/moz.build
layout/tables/moz.build
layout/xul/grid/moz.build
layout/xul/moz.build
layout/xul/tree/moz.build
media/libcubeb/tests/moz.build
media/libyuv/moz.build
media/mtransport/common.build
media/mtransport/test/moz.build
media/omx-plugin/kk/moz.build
media/omx-plugin/lib/ics/libstagefright/moz.build
media/omx-plugin/lib/ics/libutils/moz.build
media/omx-plugin/moz.build
media/webrtc/signaling/test/moz.build
memory/replace/dmd/test/moz.build
mfbt/moz.build
mfbt/tests/moz.build
mozglue/android/moz.build
mozglue/linker/moz.build
mozglue/linker/tests/moz.build
netwerk/base/moz.build
netwerk/cache/moz.build
netwerk/cache2/moz.build
netwerk/cookie/moz.build
netwerk/dns/mdns/libmdns/moz.build
netwerk/dns/moz.build
netwerk/mime/moz.build
netwerk/protocol/about/moz.build
netwerk/protocol/file/moz.build
netwerk/protocol/ftp/moz.build
netwerk/protocol/websocket/moz.build
netwerk/sctp/datachannel/moz.build
netwerk/standalone/moz.build
netwerk/streamconv/test/moz.build
netwerk/system/mac/moz.build
netwerk/test/moz.build
netwerk/wifi/moz.build
parser/html/moz.build
parser/htmlparser/moz.build
rdf/base/moz.build
security/certverifier/moz.build
security/manager/ssl/moz.build
security/manager/ssl/tests/gtest/moz.build
security/pkix/moz.build
security/pkix/test/gtest/moz.build
security/pkix/test/lib/moz.build
security/sandbox/linux/glue/moz.build
security/sandbox/linux/moz.build
storage/moz.build
testing/mochitest/ssltunnel/moz.build
toolkit/components/downloads/moz.build
toolkit/components/places/moz.build
toolkit/components/telemetry/moz.build
toolkit/components/url-classifier/moz.build
toolkit/crashreporter/crashreporter.mozbuild
toolkit/crashreporter/google-breakpad/src/client/mac/crash_generation/moz.build
toolkit/crashreporter/google-breakpad/src/client/moz.build
toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
toolkit/crashreporter/moz.build
toolkit/xre/moz.build
tools/memory-profiler/moz.build
tools/profiler/moz.build
tools/profiler/tests/gtest/moz.build
uriloader/exthandler/moz.build
uriloader/prefetch/moz.build
widget/android/moz.build
widget/gtk/moz.build
widget/moz.build
xpcom/glue/tests/gtest/moz.build
xpcom/reflect/xptinfo/moz.build
xpfe/components/directory/moz.build
--- a/accessible/atk/moz.build
+++ b/accessible/atk/moz.build
@@ -50,9 +50,12 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']
 if CONFIG['MOZ_ENABLE_DBUS']:
     CXXFLAGS += CONFIG['MOZ_DBUS_CFLAGS']
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 if CONFIG['CLANG_CXX'] or CONFIG['GNU_CXX']:
     # Used in G_DEFINE_TYPE_EXTENDED macro, probably fixed in newer glib /
     # gobject headers. See bug 1243331 comment 3.
-    CXXFLAGS += ['-Wno-unused-local-typedefs']
+    CXXFLAGS += [
+        '-Wno-error=shadow',
+        '-Wno-unused-local-typedefs',
+    ]
--- a/accessible/base/moz.build
+++ b/accessible/base/moz.build
@@ -92,8 +92,11 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
 else:
     LOCAL_INCLUDES += [
         '/accessible/other',
     ]
 
 FINAL_LIBRARY = 'xul'
 
 include('/ipc/chromium/chromium-config.mozbuild')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/accessible/generic/moz.build
+++ b/accessible/generic/moz.build
@@ -52,8 +52,11 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
 else:
     LOCAL_INCLUDES += [
         '/accessible/other',
     ]
 
 FINAL_LIBRARY = 'xul'
 
 include('/ipc/chromium/chromium-config.mozbuild')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/accessible/html/moz.build
+++ b/accessible/html/moz.build
@@ -38,8 +38,11 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
         '/accessible/mac',
     ]
 else:
     LOCAL_INCLUDES += [
         '/accessible/other',
     ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/accessible/ipc/moz.build
+++ b/accessible/ipc/moz.build
@@ -43,8 +43,11 @@ if CONFIG['ACCESSIBILITY']:
     else:
         LOCAL_INCLUDES += [
             '/accessible/other',
         ]
 
     FINAL_LIBRARY = 'xul'
 
 include('/ipc/chromium/chromium-config.mozbuild')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/accessible/other/moz.build
+++ b/accessible/other/moz.build
@@ -17,8 +17,11 @@ SOURCES += [
 LOCAL_INCLUDES += [
     '/accessible/base',
     '/accessible/generic',
     '/accessible/html',
     '/accessible/xul',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/accessible/xpcom/moz.build
+++ b/accessible/xpcom/moz.build
@@ -61,8 +61,11 @@ xpc_acc_events_h.inputs += ['AccEvents.c
 
 xpc_acc_events_cpp = GENERATED_FILES['xpcAccEvents.cpp']
 xpc_acc_events_cpp.script = 'AccEventGen.py:gen_cpp_file'
 xpc_acc_events_cpp.inputs += ['AccEvents.conf']
 
 FINAL_LIBRARY = 'xul'
 
 include('/ipc/chromium/chromium-config.mozbuild')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/accessible/xul/moz.build
+++ b/accessible/xul/moz.build
@@ -43,8 +43,11 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
         '/accessible/mac',
     ]
 else:
     LOCAL_INCLUDES += [
         '/accessible/other',
     ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/caps/moz.build
+++ b/caps/moz.build
@@ -55,8 +55,11 @@ LOCAL_INCLUDES += [
 ]
 
 if CONFIG['ENABLE_TESTS']:
     DIRS += ['tests/gtest']
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/devtools/shared/heapsnapshot/moz.build
+++ b/devtools/shared/heapsnapshot/moz.build
@@ -52,8 +52,11 @@ DevToolsModules(
     'census-tree-node.js',
     'CensusUtils.js',
     'DominatorTreeNode.js',
     'HeapAnalysesClient.js',
     'HeapAnalysesWorker.js',
     'HeapSnapshotFileUtils.js',
     'shortest-paths.js',
 )
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/devtools/shared/heapsnapshot/tests/gtest/moz.build
+++ b/devtools/shared/heapsnapshot/tests/gtest/moz.build
@@ -15,14 +15,17 @@ UNIFIED_SOURCES = [
     'DeserializedStackFrameUbiStackFrames.cpp',
     'DoesCrossCompartmentBoundaries.cpp',
     'DoesntCrossCompartmentBoundaries.cpp',
     'SerializesEdgeNames.cpp',
     'SerializesEverythingInHeapGraphOnce.cpp',
     'SerializesTypeNames.cpp',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+
 # THE MOCK_METHOD2 macro from gtest triggers this clang warning and it's hard
 # to work around, so we just ignore it.
 if CONFIG['CLANG_CXX']:
   CXXFLAGS += ['-Wno-inconsistent-missing-override']
 
 FINAL_LIBRARY = 'xul-gtest'
--- a/docshell/base/moz.build
+++ b/docshell/base/moz.build
@@ -78,8 +78,11 @@ LOCAL_INCLUDES += [
     '/tools/profiler',
 ]
 
 if CONFIG['MOZ_TOOLKIT_SEARCH']:
     DEFINES['MOZ_TOOLKIT_SEARCH'] = True
 
 if CONFIG['MOZ_DEVTOOLS'] == 'all':
     DEFINES['MOZ_DEVTOOLS_ALL'] = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/docshell/shistory/moz.build
+++ b/docshell/shistory/moz.build
@@ -28,10 +28,10 @@ UNIFIED_SOURCES += [
 ]
 
 LOCAL_INCLUDES += [
     '/docshell/base',
 ]
 
 FINAL_LIBRARY = 'xul'
 
-if CONFIG['CLANG_CXX']:
-    CXXFLAGS += ['-Wshadow']
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -490,8 +490,11 @@ GENERATED_FILES += [
 
 countermap = GENERATED_FILES['PropertyUseCounterMap.inc']
 countermap.script = 'gen-usecounters.py:property_map'
 countermap.inputs = ['UseCounters.conf']
 
 counterlist = GENERATED_FILES['UseCounterList.h']
 counterlist.script = 'gen-usecounters.py:use_counter_list'
 counterlist.inputs = ['UseCounters.conf']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/bindings/moz.build
+++ b/dom/bindings/moz.build
@@ -140,8 +140,11 @@ if CONFIG['MOZ_BUILD_APP'] in ['browser'
 
 
 if CONFIG['MOZ_SIMPLEPUSH']:
     DEFINES['MOZ_SIMPLEPUSH'] = True
 
 PYTHON_UNIT_TESTS += [
     'mozwebidlcodegen/test/test_mozwebidlcodegen.py',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/bindings/test/moz.build
+++ b/dom/bindings/test/moz.build
@@ -47,8 +47,11 @@ LOCAL_INCLUDES += [
 ]
 
 LOCAL_INCLUDES += [
     '!..',
     '/dom/bindings',
     '/js/xpconnect/src',
     '/js/xpconnect/wrappers',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/cache/moz.build
+++ b/dom/cache/moz.build
@@ -95,8 +95,11 @@ MOCHITEST_MANIFESTS += [
 
 BROWSER_CHROME_MANIFESTS += [
     'test/mochitest/browser.ini',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += [
     'test/xpcshell/xpcshell.ini',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/camera/moz.build
+++ b/dom/camera/moz.build
@@ -67,11 +67,14 @@ LOCAL_INCLUDES += [
 ]
 
 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']
+    CXXFLAGS += [
+        '-Wno-error=attributes',
+        '-Wno-error=shadow',
+    ]
 
 FINAL_LIBRARY = 'xul'
--- a/dom/canvas/moz.build
+++ b/dom/canvas/moz.build
@@ -182,12 +182,15 @@ LOCAL_INCLUDES += [
     '/media/libyuv/include',
 ]
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 CXXFLAGS += CONFIG['TK_CFLAGS']
 
 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+
 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/events/moz.build
+++ b/dom/events/moz.build
@@ -146,8 +146,11 @@ LOCAL_INCLUDES += [
     '/layout/xul',
     '/layout/xul/tree/',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     LOCAL_INCLUDES += [
         '/dom/wifi',
     ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/html/moz.build
+++ b/dom/html/moz.build
@@ -241,8 +241,11 @@ LOCAL_INCLUDES += [
     '/layout/generic',
     '/layout/style',
     '/layout/tables',
     '/layout/xul',
     '/netwerk/base',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/indexedDB/moz.build
+++ b/dom/indexedDB/moz.build
@@ -93,16 +93,17 @@ IPDL_SOURCES += [
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['GNU_CC']:
     # Suppress gcc warning about a comparison being always false due to the
     # range of the data type
     SOURCES['Key.cpp'].flags += ['-Wno-error=type-limits']
+    CXXFLAGS += ['-Wno-error=shadow']
 
 if CONFIG['_MSC_VER']:
     # This is intended as a temporary hack to support building with VS2015.
     CXXFLAGS += ['-wd4577']
 
 LOCAL_INCLUDES += [
     '/db/sqlite3/src',
     '/dom/base',
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -175,8 +175,11 @@ if CONFIG['MOZ_TOOLKIT_SEARCH']:
 
 JAR_MANIFESTS += ['jar.mn']
 
 BROWSER_CHROME_MANIFESTS += ['tests/browser.ini']
 MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
 MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
 
 CXXFLAGS += CONFIG['TK_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/bridge/moz.build
+++ b/dom/media/bridge/moz.build
@@ -21,8 +21,11 @@ LOCAL_INCLUDES += [
     '/media/webrtc/',
     '/media/webrtc/signaling/src/common/time_profiling',
     '/media/webrtc/signaling/src/media-conduit',
     '/media/webrtc/signaling/src/mediapipeline',
     '/media/webrtc/signaling/src/peerconnection',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/gmp/moz.build
+++ b/dom/media/gmp/moz.build
@@ -146,8 +146,11 @@ include('/ipc/chromium/chromium-config.m
 FINAL_LIBRARY = 'xul'
 # media/mtransport so we work with --disable-webrtc
 LOCAL_INCLUDES += [
     '/media/mtransport',
     '/xpcom/base',
     '/xpcom/build',
     '/xpcom/threads',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/gmp/widevine-adapter/moz.build
+++ b/dom/media/gmp/widevine-adapter/moz.build
@@ -12,8 +12,11 @@ SOURCES += [
     'WidevineVideoFrame.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/dom/media/gmp',
 ]
+
+if CONFIG['CLANG_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/gtest/moz.build
+++ b/dom/media/gtest/moz.build
@@ -67,8 +67,11 @@ LOCAL_INCLUDES += [
     '/dom/media/encoder',
     '/dom/media/fmp4',
     '/dom/media/gmp',
     '/security/certverifier',
     '/security/pkix/include',
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/mediasink/moz.build
+++ b/dom/media/mediasink/moz.build
@@ -8,8 +8,11 @@ UNIFIED_SOURCES += [
     'AudioSinkWrapper.cpp',
     'DecodedAudioDataSink.cpp',
     'DecodedStream.cpp',
     'OutputStreamManager.cpp',
     'VideoSink.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/mediasource/moz.build
+++ b/dom/media/mediasource/moz.build
@@ -37,8 +37,11 @@ UNIFIED_SOURCES += [
 TEST_DIRS += [
     'gtest',
 ]
 
 if CONFIG['MOZ_GONK_MEDIACODEC']:
     DEFINES['MOZ_GONK_MEDIACODEC'] = True
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -332,16 +332,19 @@ if CONFIG['MOZ_GONK_MEDIACODEC']:
     DEFINES['MOZ_GONK_MEDIACODEC'] = True
 
 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']
+    CXXFLAGS += [
+        '-Wno-error=attributes',
+        '-Wno-error=shadow',
+    ]
 
 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/ogg/moz.build
+++ b/dom/media/ogg/moz.build
@@ -16,8 +16,11 @@ UNIFIED_SOURCES += [
     'OggCodecState.cpp',
     'OggDecoder.cpp',
     'OggReader.cpp',
     'OggWriter.cpp',
     'OpusParser.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/platforms/moz.build
+++ b/dom/media/platforms/moz.build
@@ -83,8 +83,11 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'andr
     EXPORTS += [
         'android/AndroidDecoderModule.h',
     ]
     UNIFIED_SOURCES += [
         'android/AndroidDecoderModule.cpp',
     ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/platforms/omx/moz.build
+++ b/dom/media/platforms/omx/moz.build
@@ -40,8 +40,11 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
     UNIFIED_SOURCES += [
         'GonkOmxPlatformLayer.cpp',
     ]
     EXTRA_DSO_LDOPTS += [
         '-libbinder',
     ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/standalone/moz.build
+++ b/dom/media/standalone/moz.build
@@ -36,9 +36,12 @@ DEFINES['MOZILLA_INTERNAL_API'] = True
 DEFINES['MOZILLA_EXTERNAL_LINKAGE'] = True
 
 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']
+    CXXFLAGS += [
+        '-Wno-error=attributes',
+        '-Wno-error=shadow',
+    ]
--- a/dom/media/systemservices/moz.build
+++ b/dom/media/systemservices/moz.build
@@ -93,8 +93,11 @@ IPDL_SOURCES += [
 # /dom/base needed for nsGlobalWindow.h in MediaChild.cpp
 LOCAL_INCLUDES += [
     '/dom/base',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/wave/moz.build
+++ b/dom/media/wave/moz.build
@@ -12,8 +12,11 @@ EXPORTS += [
 
 UNIFIED_SOURCES += [
     'WaveDecoder.cpp',
     'WaveDemuxer.cpp',
     'WaveReader.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/webaudio/blink/moz.build
+++ b/dom/media/webaudio/blink/moz.build
@@ -28,8 +28,11 @@ if CONFIG['INTEL_ARCHITECTURE']:
     DEFINES['USE_SSE2'] = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/dom/media/webaudio',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/dom/media/webaudio/moz.build
+++ b/dom/media/webaudio/moz.build
@@ -123,8 +123,10 @@ if CONFIG['INTEL_ARCHITECTURE']:
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '..'
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/webm/moz.build
+++ b/dom/media/webm/moz.build
@@ -21,8 +21,11 @@ if CONFIG['MOZ_WEBM_ENCODER']:
     EXPORTS += ['WebMWriter.h']
     UNIFIED_SOURCES += ['EbmlComposer.cpp',
                         'WebMWriter.cpp',
     ]
 
 CXXFLAGS += CONFIG['MOZ_LIBVPX_CFLAGS']
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/webrtc/moz.build
+++ b/dom/media/webrtc/moz.build
@@ -79,17 +79,18 @@ EXPORTS.mozilla.dom += [
 include('/ipc/chromium/chromium-config.mozbuild')
 
 # Suppress some GCC/clang warnings being treated as errors:
 #  - about attributes on forward declarations for types that are already
 #    defined, which complains about important MOZ_EXPORT attributes for
 #    android API types
 if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
     CXXFLAGS += [
-        '-Wno-error=attributes'
+        '-Wno-error=attributes',
+        '-Wno-error=shadow',
     ]
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['_MSC_VER']:
     CXXFLAGS += [
         '-wd4275', # non dll-interface class used as base for dll-interface class
         '-wd4312', # This is intended as a temporary hack to support building with VS2015
--- a/dom/media/webspeech/recognition/moz.build
+++ b/dom/media/webspeech/recognition/moz.build
@@ -78,8 +78,11 @@ if CONFIG['MOZ_WEBSPEECH_MODELS']:
 		'models/en-US/sendump',
 		'models/en-US/transition_matrices',
 		'models/en-US/variances',
     ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/media/webspeech/synth/moz.build
+++ b/dom/media/webspeech/synth/moz.build
@@ -60,8 +60,11 @@ IPDL_SOURCES += [
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     'ipc',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/mobileconnection/moz.build
+++ b/dom/mobileconnection/moz.build
@@ -73,8 +73,11 @@ LOCAL_INCLUDES += [
     '/dom/system/gonk',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 XPIDL_MODULE = 'dom_mobileconnection'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/mobilemessage/moz.build
+++ b/dom/mobilemessage/moz.build
@@ -81,8 +81,11 @@ IPDL_SOURCES += [
 LOCAL_INCLUDES += [
     '/dom/base',
     '/widget/android',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/network/moz.build
+++ b/dom/network/moz.build
@@ -69,8 +69,11 @@ IPDL_SOURCES += [
     'PTCPServerSocket.ipdl',
     'PTCPSocket.ipdl',
     'PUDPSocket.ipdl',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/notification/moz.build
+++ b/dom/notification/moz.build
@@ -33,8 +33,11 @@ FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/ipc',
     '/dom/workers',
 ]
 
 BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
 XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/plugins/base/moz.build
+++ b/dom/plugins/base/moz.build
@@ -111,8 +111,11 @@ if CONFIG['OS_ARCH'] == 'WINNT':
 include('/ipc/chromium/chromium-config.mozbuild')
 
 DEFINES['SK_BUILD_FOR_ANDROID_NDK'] = True
 
 FINAL_LIBRARY = 'xul'
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 CXXFLAGS += CONFIG['TK_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/plugins/ipc/moz.build
+++ b/dom/plugins/ipc/moz.build
@@ -143,15 +143,18 @@ DEFINES['FORCE_PR_LOG'] = True
 if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gtk3':
     CXXFLAGS += CONFIG['TK_CFLAGS']
 else:
     # Force build against gtk+2 for struct offsets and such.
     CXXFLAGS += CONFIG['MOZ_GTK2_CFLAGS']
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+
 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/dom/plugins/test/testplugin/testplugin.mozbuild
+++ b/dom/plugins/test/testplugin/testplugin.mozbuild
@@ -73,8 +73,11 @@ if CONFIG['_MSC_VER']:
     # conversion from 'X' to 'Y' requires a narrowing conversion
     CXXFLAGS += ['-wd4838']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     FINAL_TARGET = 'dist/plugins/%s.plugin/Contents/MacOS' % cocoa_name
     OBJDIR_FILES.dist.plugins['%s.plugin' % cocoa_name].Contents += ['%s/Info.plist' % relative_path]
 else:
     FINAL_TARGET = 'dist/plugins'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/promise/moz.build
+++ b/dom/promise/moz.build
@@ -28,8 +28,11 @@ include('/ipc/chromium/chromium-config.m
 
 FINAL_LIBRARY = 'xul'
 
 MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
 
 MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/quota/moz.build
+++ b/dom/quota/moz.build
@@ -42,8 +42,10 @@ IPDL_SOURCES += [
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/caps',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/svg/moz.build
+++ b/dom/svg/moz.build
@@ -260,8 +260,11 @@ LOCAL_INCLUDES += [
     '/dom/xbl',
     '/dom/xml',
     '/layout/base',
     '/layout/generic',
     '/layout/style',
     '/layout/svg',
     '/layout/xul',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/workers/moz.build
+++ b/dom/workers/moz.build
@@ -130,8 +130,11 @@ BROWSER_CHROME_MANIFESTS += [
     'test/serviceworkers/browser.ini',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
 
 BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
 
 TEST_DIRS += ['test/gtest']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/xbl/moz.build
+++ b/dom/xbl/moz.build
@@ -43,8 +43,11 @@ LOCAL_INCLUDES += [
     '/dom/xul',
     '/layout/style',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 MOCHITEST_MANIFESTS += ['test/mochitest.ini']
 MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/xslt/base/moz.build
+++ b/dom/xslt/base/moz.build
@@ -16,8 +16,11 @@ UNIFIED_SOURCES += [
 LOCAL_INCLUDES += [
     '..',
     '../xml',
     '../xpath',
     '../xslt',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/xslt/xpath/moz.build
+++ b/dom/xslt/xpath/moz.build
@@ -52,8 +52,11 @@ UNIFIED_SOURCES += [
 
 LOCAL_INCLUDES += [
     '../base',
     '../xml',
     '../xslt',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/xslt/xslt/moz.build
+++ b/dom/xslt/xslt/moz.build
@@ -52,8 +52,11 @@ LOCAL_INCLUDES += ["/dom/base"]
 LOCAL_INCLUDES += [
     '../base',
     '../xml',
     '../xpath',
     '/dom/base',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/xul/moz.build
+++ b/dom/xul/moz.build
@@ -49,8 +49,11 @@ LOCAL_INCLUDES += [
     '/dom/xul/templates',
     '/layout/base',
     '/layout/generic',
     '/layout/style',
     '/layout/xul',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/xul/templates/moz.build
+++ b/dom/xul/templates/moz.build
@@ -48,8 +48,11 @@ UNIFIED_SOURCES += [
 
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/xul',
     '/layout/xul/tree/',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/editor/composer/moz.build
+++ b/editor/composer/moz.build
@@ -43,8 +43,11 @@ RESOURCE_FILES += [
     'res/table-add-row-before.gif',
     'res/table-remove-column-active.gif',
     'res/table-remove-column-hover.gif',
     'res/table-remove-column.gif',
     'res/table-remove-row-active.gif',
     'res/table-remove-row-hover.gif',
     'res/table-remove-row.gif',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/editor/libeditor/moz.build
+++ b/editor/libeditor/moz.build
@@ -68,8 +68,11 @@ LOCAL_INCLUDES += [
     '/layout/style',
     '/layout/tables',
     '/layout/xul',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/embedding/browser/moz.build
+++ b/embedding/browser/moz.build
@@ -47,8 +47,11 @@ UNIFIED_SOURCES += [
 ]
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/svg',
     '/layout/style',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/embedding/components/webbrowserpersist/moz.build
+++ b/embedding/components/webbrowserpersist/moz.build
@@ -39,8 +39,11 @@ EXPORTS.mozilla += [
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/html',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/embedding/components/windowwatcher/moz.build
+++ b/embedding/components/windowwatcher/moz.build
@@ -35,8 +35,11 @@ if CONFIG['MOZ_XUL']:
     ]
 
 FINAL_LIBRARY = 'xul'
 # For nsJSUtils
 LOCAL_INCLUDES += [
     '/docshell/base',
     '/dom/base',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/extensions/cookie/moz.build
+++ b/extensions/cookie/moz.build
@@ -20,8 +20,11 @@ UNIFIED_SOURCES += [
     'nsPermission.cpp',
     'nsPermissionManager.cpp',
     'nsPopupWindowManager.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/extensions/spellcheck/src/moz.build
+++ b/extensions/spellcheck/src/moz.build
@@ -21,8 +21,11 @@ LOCAL_INCLUDES += [
     '../hunspell/glue',
     '../hunspell/src',
     '/dom/base',
     '/editor/libeditor',
 ]
 EXPORTS.mozilla += [
      'mozSpellChecker.h',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/gfx/2d/moz.build
+++ b/gfx/2d/moz.build
@@ -169,16 +169,19 @@ UNIFIED_SOURCES += [
 
 SOURCES += [
     'Factory.cpp', # Need to suppress warnings in Skia header files.
 ]
 
 if CONFIG['CLANG_CXX']:
     SOURCES['Factory.cpp'].flags += ['-Wno-implicit-fallthrough']
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     EXPORTS.mozilla.gfx += [
         'QuartzSupport.h',
     ]
     SOURCES += [
         'MacIOSurface.cpp',
         'QuartzSupport.mm',
     ]
--- a/gfx/gl/moz.build
+++ b/gfx/gl/moz.build
@@ -168,10 +168,10 @@ if CONFIG['MOZ_D3DCOMPILER_XP_DLL']:
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 CXXFLAGS += CONFIG['TK_CFLAGS']
 CFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 CFLAGS += CONFIG['TK_CFLAGS']
 
 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
 
-if CONFIG['CLANG_CXX']:
-    CXXFLAGS += ['-Wshadow']
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/gfx/layers/apz/test/gtest/moz.build
+++ b/gfx/layers/apz/test/gtest/moz.build
@@ -22,8 +22,11 @@ LOCAL_INCLUDES += [
     '/gfx/2d',
     '/gfx/layers',
     '/gfx/tests/gtest'  # for TestLayers.h, which is shared with the gfx gtests
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -455,8 +455,11 @@ if CONFIG['ENABLE_TESTS']:
 
 MOCHITEST_MANIFESTS += ['apz/test/mochitest/mochitest.ini']
 MOCHITEST_CHROME_MANIFESTS += ['apz/test/mochitest/chrome.ini']
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 CXXFLAGS += CONFIG['TK_CFLAGS']
 
 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/gfx/skia/generate_mozbuild.py
+++ b/gfx/skia/generate_mozbuild.py
@@ -113,16 +113,17 @@ DEFINES['SKIA_IMPLEMENTATION'] = 1
 if not CONFIG['MOZ_ENABLE_SKIA_GPU']:
     DEFINES['SK_SUPPORT_GPU'] = 0
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CXX'] or CONFIG['CLANG_CL']:
     CXXFLAGS += [
         '-Wno-deprecated-declarations',
         '-Wno-overloaded-virtual',
+        '-Wno-shadow',
         '-Wno-sign-compare',
         '-Wno-unused-function',
     ]
 if CONFIG['GNU_CXX'] and not CONFIG['CLANG_CXX'] and not CONFIG['CLANG_CL']:
     CXXFLAGS += [
         '-Wno-logical-op',
         '-Wno-maybe-uninitialized',
     ]
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -649,16 +649,17 @@ DEFINES['SKIA_IMPLEMENTATION'] = 1
 if not CONFIG['MOZ_ENABLE_SKIA_GPU']:
     DEFINES['SK_SUPPORT_GPU'] = 0
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CXX'] or CONFIG['CLANG_CL']:
     CXXFLAGS += [
         '-Wno-deprecated-declarations',
         '-Wno-overloaded-virtual',
+        '-Wno-shadow',
         '-Wno-sign-compare',
         '-Wno-unused-function',
     ]
 if CONFIG['GNU_CXX'] and not CONFIG['CLANG_CXX'] and not CONFIG['CLANG_CL']:
     CXXFLAGS += [
         '-Wno-logical-op',
         '-Wno-maybe-uninitialized',
     ]
--- a/gfx/tests/gtest/moz.build
+++ b/gfx/tests/gtest/moz.build
@@ -46,8 +46,11 @@ LOCAL_INCLUDES += [
     '/gfx/2d/unittest',
     '/gfx/layers',
     '/gfx/qcms',
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/image/decoders/moz.build
+++ b/image/decoders/moz.build
@@ -39,8 +39,11 @@ LOCAL_INCLUDES += [
     '/gfx/2d',
     # Decoders need ImageLib headers.
     '/image',
 ]
 
 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/image/moz.build
+++ b/image/moz.build
@@ -107,8 +107,10 @@ LOCAL_INCLUDES += [
     '/xpcom/threads',
 ]
 
 # Because imgFrame.cpp includes "cairo.h"
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 
 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/image/test/gtest/moz.build
+++ b/image/test/gtest/moz.build
@@ -54,8 +54,11 @@ LOCAL_INCLUDES += [
     '/dom/base',
     '/gfx/2d',
     '/image',
 ]
 
 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
 
 FINAL_LIBRARY = 'xul-gtest'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/intl/hyphenation/glue/moz.build
+++ b/intl/hyphenation/glue/moz.build
@@ -19,8 +19,11 @@ SOURCES += [
     'hnjstdio.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '../hyphen',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/intl/strres/moz.build
+++ b/intl/strres/moz.build
@@ -14,8 +14,11 @@ XPIDL_SOURCES += [
 XPIDL_MODULE = 'intl'
 
 UNIFIED_SOURCES += [
     'nsStringBundle.cpp',
     'nsStringBundleTextOverride.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/intl/uconv/moz.build
+++ b/intl/uconv/moz.build
@@ -161,8 +161,11 @@ LOCAL_INCLUDES += [
     'ucvja',
     'ucvko',
     'ucvlatin',
     'ucvtw',
     'util',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/intl/unicharutil/moz.build
+++ b/intl/unicharutil/moz.build
@@ -26,8 +26,11 @@ UNIFIED_SOURCES += [
     'nsCaseConversionImp2.cpp',
     'nsCategoryImp.cpp',
     'nsEntityConverter.cpp',
     'nsSaveAsCharset.cpp',
     'nsUnicodeNormalizer.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/ipc/chromium/moz.build
+++ b/ipc/chromium/moz.build
@@ -158,8 +158,11 @@ CXXFLAGS += CONFIG['TK_CFLAGS']
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 DIRS += [
     'atomics',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/ipc/glue/moz.build
+++ b/ipc/glue/moz.build
@@ -182,8 +182,11 @@ LOCAL_INCLUDES += [
 ]
 
 if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
     LOCAL_INCLUDES += [
         '/security/sandbox/chromium',
         '/security/sandbox/chromium-shim',
         '/security/sandbox/win/src/sandboxbroker',
     ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/ipc/testshell/moz.build
+++ b/ipc/testshell/moz.build
@@ -28,8 +28,10 @@ include('/ipc/chromium/chromium-config.m
 FINAL_LIBRARY = 'xul'
 
 # For xpcshell error messages and nsAutoJSString
 LOCAL_INCLUDES += [
     '/dom/base',
     '/js/xpconnect/src',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/js/ipc/moz.build
+++ b/js/ipc/moz.build
@@ -32,8 +32,10 @@ EXPORTS.mozilla.jsipc = [
 LOCAL_INCLUDES += [
     '/dom/base',
     '/js/ipc',
     '/js/src',
     '/js/xpconnect/src',
     '/js/xpconnect/wrappers',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/js/src/gdb/moz.build
+++ b/js/src/gdb/moz.build
@@ -36,15 +36,18 @@ USE_LIBS += [
 
 if CONFIG['ENABLE_INTL_API'] and CONFIG['MOZ_ICU_DATA_ARCHIVE']:
     # The ICU libraries linked into libmozjs will not include the ICU data,
     # so link it directly.
     USE_LIBS += ['icudata']
 
 OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
+
 # This is intended as a temporary workaround to enable VS2015.
 if CONFIG['_MSC_VER']:
     CXXFLAGS += ['-wd4312']
 
 DEFINES['topsrcdir'] = '%s/js/src' % TOPSRCDIR
 FINAL_TARGET_PP_FILES += ['gdb-tests-gdb.py.in']
 OBJDIR_FILES.js.src.gdb += ['!/dist/bin/gdb-tests-gdb.py']
--- a/js/src/jsapi-tests/moz.build
+++ b/js/src/jsapi-tests/moz.build
@@ -137,14 +137,17 @@ if CONFIG['ENABLE_INTL_API'] and CONFIG[
     USE_LIBS += ['icudata']
 
 USE_LIBS += [
     'static:js',
 ]
 
 OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
+
 # This is intended as a temporary workaround to enable VS2015.
 if CONFIG['_MSC_VER']:
     CXXFLAGS += ['-wd4312']
 
 DEFINES['topsrcdir'] = '%s/js/src' % TOPSRCDIR
 OBJDIR_PP_FILES.js.src['jsapi-tests'] += ['jsapi-tests-gdb.py.in']
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -760,11 +760,14 @@ if CONFIG['SPIDERMONKEY_PROMISE']:
 
 if CONFIG['JS_HAS_CTYPES']:
     if CONFIG['MOZ_SYSTEM_FFI']:
         CXXFLAGS += CONFIG['MOZ_FFI_CFLAGS']
     else:
         # Windows needs this to be linked with a static library.
         DEFINES['FFI_BUILDING'] = True
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
+
 # Suppress warnings in third-party code.
 if CONFIG['CLANG_CXX']:
     SOURCES['jsdtoa.cpp'].flags += ['-Wno-implicit-fallthrough']
--- a/js/src/shell/moz.build
+++ b/js/src/shell/moz.build
@@ -45,16 +45,19 @@ if CONFIG['ENABLE_INTL_API'] and CONFIG[
 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['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
+
 # This is intended as a temporary workaround to enable VS2015.
 if CONFIG['_MSC_VER']:
     CXXFLAGS += ['-wd4312']
 
 # Place a GDB Python auto-load file next to the shell executable, both in
 # the build directory and in the dist/bin directory.
 DEFINES['topsrcdir'] = '%s/js/src' % TOPSRCDIR
 FINAL_TARGET_PP_FILES += ['js-gdb.py.in']
--- a/js/xpconnect/loader/moz.build
+++ b/js/xpconnect/loader/moz.build
@@ -19,8 +19,10 @@ EXTRA_JS_MODULES += [
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../src',
     '../wrappers',
     '/dom/base',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/js/xpconnect/src/moz.build
+++ b/js/xpconnect/src/moz.build
@@ -67,8 +67,11 @@ LOCAL_INCLUDES += [
     '/layout/style',
     '/xpcom/reflect/xptinfo',
 ]
 
 if CONFIG['MOZ_B2G_BT']:
     LOCAL_INCLUDES += [
         '/dom/bluetooth/common',
     ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/js/xpconnect/wrappers/moz.build
+++ b/js/xpconnect/wrappers/moz.build
@@ -32,8 +32,10 @@ include('/ipc/chromium/chromium-config.m
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../../../dom/base',
     '../src',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/layout/base/moz.build
+++ b/layout/base/moz.build
@@ -204,8 +204,11 @@ MOCHITEST_MANIFESTS += ['tests/mochitest
 MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini']
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 
 if CONFIG['_MSC_VER']:
     # This is intended as a temporary hack to support building with VS2015.
     # 'type cast': conversion from 'unsigned int' to 'void *' of greater size
     CXXFLAGS += ['-wd4312']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/build/moz.build
+++ b/layout/build/moz.build
@@ -121,8 +121,11 @@ if CONFIG['MOZ_WEBSPEECH_POCKETSPHINX']:
     ]
 
 if CONFIG['MOZ_SECUREELEMENT']:
     LOCAL_INCLUDES += [
         '/dom/secureelement',
     ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/forms/moz.build
+++ b/layout/forms/moz.build
@@ -54,13 +54,16 @@ LOCAL_INCLUDES += [
 ]
 
 if CONFIG['ENABLE_INTL_API']:
     # nsNumberControlFrame.cpp requires ICUUtils.h which in turn requires
     # i18n/unum.h
     CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
     LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+
 if CONFIG['_MSC_VER']:
     # 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']
--- a/layout/generic/moz.build
+++ b/layout/generic/moz.build
@@ -210,8 +210,11 @@ MOCHITEST_CHROME_MANIFESTS += ['test/chr
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 
 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
     CXXFLAGS += CONFIG['TK_CFLAGS']
 
 if CONFIG['MOZ_ENABLE_QT']:
     CXXFLAGS += CONFIG['MOZ_QT_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/mathml/moz.build
+++ b/layout/mathml/moz.build
@@ -59,8 +59,11 @@ RESOURCE_FILES.fonts += [
     'mathfontSTIXGeneral.properties',
     'mathfontUnicode.properties',
 ]
 
 if CONFIG['OS_TARGET'] == 'WINNT':
     RESOURCE_FILES.fonts += [
         'mathfontSymbol.properties',
     ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/svg/moz.build
+++ b/layout/svg/moz.build
@@ -65,8 +65,10 @@ LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/svg',
 ]
 
 RESOURCE_FILES += [
     'svg.css',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/tables/moz.build
+++ b/layout/tables/moz.build
@@ -36,8 +36,11 @@ LOCAL_INCLUDES += [
     '../generic',
     '../style',
     '../xul',
     '/dom/base',
     '/dom/html',
 ]
 
 DEFINES['DEBUG_TABLE_STRATEGY_off'] = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/xul/grid/moz.build
+++ b/layout/xul/grid/moz.build
@@ -34,8 +34,10 @@ UNIFIED_SOURCES += [
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '..',
     '../../forms',
     '../../generic',
     '../../style',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/xul/moz.build
+++ b/layout/xul/moz.build
@@ -97,8 +97,11 @@ if CONFIG['MOZ_XUL']:
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '../base',
     '../generic',
     '../style',
     '/dom/base',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/xul/tree/moz.build
+++ b/layout/xul/tree/moz.build
@@ -43,8 +43,11 @@ FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '..',
     '../../base',
     '../../forms',
     '../../generic',
     '../../style',
     '/dom/base',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/media/libcubeb/tests/moz.build
+++ b/media/libcubeb/tests/moz.build
@@ -70,8 +70,11 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'ui
     ]
 elif CONFIG['OS_TARGET'] == 'OpenBSD':
     OS_LIBS += [
         'sndio',
     ]
 else:
     OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
     OS_LIBS += CONFIG['MOZ_PULSEAUDIO_LIBS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/media/libyuv/moz.build
+++ b/media/libyuv/moz.build
@@ -14,8 +14,11 @@ libyuv_non_unified_sources = [
     'source/row_common.cc',
     'source/scale.cc',
     'source/scale_common.cc',
 ]
 GYP_DIRS['.'].input = 'libyuv.gyp'
 GYP_DIRS['.'].variables = gyp_vars
 GYP_DIRS['.'].sandbox_vars['FINAL_LIBRARY'] = 'xul'
 GYP_DIRS['.'].non_unified_sources += libyuv_non_unified_sources
+
+# We allow warnings for third-party code that can be updated from upstream.
+GYP_DIRS['.'].sandbox_vars['ALLOW_COMPILER_WARNINGS'] = True
--- a/media/mtransport/common.build
+++ b/media/mtransport/common.build
@@ -85,8 +85,11 @@ for var in ('HAVE_STRDUP', 'NR_SOCKET_IS
     DEFINES[var] = True
 
 DEFINES['R_DEFINED_INT2'] = 'int16_t'
 DEFINES['R_DEFINED_UINT2'] = 'uint16_t'
 DEFINES['R_DEFINED_INT4'] = 'int32_t'
 DEFINES['R_DEFINED_UINT4'] = 'uint32_t'
 DEFINES['R_DEFINED_INT8'] = 'int64_t'
 DEFINES['R_DEFINED_UINT8'] = 'uint64_t'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/media/mtransport/test/moz.build
+++ b/media/mtransport/test/moz.build
@@ -90,8 +90,11 @@ LOCAL_INCLUDES += [
     '/media/mtransport/third_party/nrappkit/src/stats',
     '/media/mtransport/third_party/nrappkit/src/util/',
     '/media/mtransport/third_party/nrappkit/src/util/libekr',
     '/netwerk/sctp/src/',
     '/xpcom/tests/'
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/media/omx-plugin/kk/moz.build
+++ b/media/omx-plugin/kk/moz.build
@@ -21,9 +21,12 @@ USE_LIBS += [
     'videoeditorplayer',
 ]
 
 # Don't use STL wrappers; this isn't Gecko code
 DISABLE_STL_WRAPPING = True
 NO_VISIBILITY_FLAGS = True
 
 # Suppress warnings in third-party code.
-CXXFLAGS += ['-Wno-multichar']
+CXXFLAGS += [
+    '-Wno-multichar',
+    '-Wno-shadow',
+]
--- a/media/omx-plugin/lib/ics/libstagefright/moz.build
+++ b/media/omx-plugin/lib/ics/libstagefright/moz.build
@@ -23,8 +23,11 @@ LOCAL_INCLUDES += [
 
 USE_LIBS += [
     '/media/omx-plugin/lib/ics/libutils/utils',
 ]
 
 # Don't use STL wrappers; this isn't Gecko code
 DISABLE_STL_WRAPPING = True
 NO_VISIBILITY_FLAGS = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/media/omx-plugin/lib/ics/libutils/moz.build
+++ b/media/omx-plugin/lib/ics/libutils/moz.build
@@ -15,8 +15,11 @@ SharedLibrary('utils')
 LOCAL_INCLUDES += [
     '/media/omx-plugin/include/ics',
     '/media/omx-plugin/include/ics/media/stagefright/openmax',
 ]
 
 # Don't use STL wrappers; this isn't Gecko code
 DISABLE_STL_WRAPPING = True
 NO_VISIBILITY_FLAGS = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/media/omx-plugin/moz.build
+++ b/media/omx-plugin/moz.build
@@ -25,17 +25,20 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
 else:
     LOCAL_INCLUDES += [
         'include/ics',
         'include/ics/media/stagefright/openmax',
     ]
 
 if CONFIG['GNU_CXX']:
     # Stagefright header files define many multichar constants.
-    CXXFLAGS += ['-Wno-multichar']
+    CXXFLAGS += [
+        '-Wno-multichar',
+        '-Wno-shadow',
+    ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     if CONFIG['ANDROID_VERSION'] == '15':
         LOCAL_INCLUDES += [
              '%' + '%s/%s' % (CONFIG['ANDROID_SOURCE'], d) for d in [
                  'dalvik/libnativehelper/include/nativehelper',
                  'frameworks/base/include/',
                  'frameworks/base/include/binder/',
--- a/media/webrtc/signaling/test/moz.build
+++ b/media/webrtc/signaling/test/moz.build
@@ -19,14 +19,16 @@ 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['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+
 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/memory/replace/dmd/test/moz.build
+++ b/memory/replace/dmd/test/moz.build
@@ -17,8 +17,10 @@ else:
 DEFINES['MOZ_NO_MOZALLOC'] = True
 
 DISABLE_STL_WRAPPING = True
 
 XPCSHELL_TESTS_MANIFESTS += [
     'xpcshell.ini',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -118,16 +118,17 @@ SOURCES += mfbt_nonunified_src_cppsrcs
 
 DISABLE_STL_WRAPPING = True
 
 # Suppress warnings in third-party LZ4 code.
 # TODO: Remove these suppressions after bug 993267 is fixed.
 
 if CONFIG['GNU_CXX']:
     SOURCES['/mfbt/Compression.cpp'].flags += ['-Wno-unused-function']
+    CXXFLAGS += ['-Wno-error=shadow']
 
 if CONFIG['CLANG_CXX']:
     # Suppress warnings from third-party V8 Decimal code.
     SOURCES['/mfbt/decimal/Decimal.cpp'].flags += ['-Wno-implicit-fallthrough']
 
 if CONFIG['_MSC_VER']:
     # Error 4804 is "'>' : unsafe use of type 'bool' in operation"
     SOURCES['/mfbt/Compression.cpp'].flags += ['-wd4804']
--- a/mfbt/tests/moz.build
+++ b/mfbt/tests/moz.build
@@ -61,8 +61,11 @@ if CONFIG['_MSC_VER']:
   CXXFLAGS += [
     '-wd4275', # non dll-interface class used as base for dll-interface class
     '-wd4530', # C++ exception handler used, but unwind semantics are not enabled
   ]
 
 USE_LIBS += [
     'mfbt',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/mozglue/android/moz.build
+++ b/mozglue/android/moz.build
@@ -47,8 +47,11 @@ LOCAL_INCLUDES += [
     '/security/nss/lib/softoken',
     '/security/nss/lib/ssl',
     '/security/nss/lib/util',
     '/toolkit/components/startup',
     '/xpcom/build',
 ]
 
 DISABLE_STL_WRAPPING = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/mozglue/linker/moz.build
+++ b/mozglue/linker/moz.build
@@ -37,8 +37,11 @@ HOST_OS_LIBS += [
 if CONFIG['TARGET_CPU'] == 'arm':
     if CONFIG['MOZ_THUMB2']:
         HOST_DEFINES['TARGET_THUMB'] = True
     else:
         HOST_DEFINES['TARGET_ARM'] = True
 
 if CONFIG['CPU_ARCH'] == 'x86':
     HOST_DEFINES['TARGET_X86'] = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/mozglue/linker/tests/moz.build
+++ b/mozglue/linker/tests/moz.build
@@ -12,8 +12,11 @@ SimplePrograms([
 LOCAL_INCLUDES += ['..']
 USE_LIBS += [
     'linker',
 ]
 OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
 DISABLE_STL_WRAPPING = True
 
 PYTHON_UNIT_TESTS += ['run_test_zip.py']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -306,8 +306,11 @@ if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
 
 if CONFIG['MOZ_ENABLE_QTNETWORK']:
     LOCAL_INCLUDES += [
         '/netwerk/system/qt',
     ]
 
 if CONFIG['MOZ_ENABLE_QTNETWORK']:
     CXXFLAGS += CONFIG['MOZ_QT_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/cache/moz.build
+++ b/netwerk/cache/moz.build
@@ -41,8 +41,11 @@ UNIFIED_SOURCES += [
     'nsMemoryCacheDevice.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/netwerk/base',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/cache2/moz.build
+++ b/netwerk/cache2/moz.build
@@ -49,8 +49,11 @@ SOURCES += [
 ]
 
 LOCAL_INCLUDES += [
     '/netwerk/base',
     '/netwerk/cache',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/cookie/moz.build
+++ b/netwerk/cookie/moz.build
@@ -45,8 +45,11 @@ if CONFIG['NECKO_COOKIES']:
 
 IPDL_SOURCES = [
     'PCookieService.ipdl',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/dns/mdns/libmdns/moz.build
+++ b/netwerk/dns/mdns/libmdns/moz.build
@@ -36,8 +36,11 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
 
 UNIFIED_SOURCES += [
     'nsDNSServiceInfo.cpp',
     'nsMulticastDNSModule.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/dns/moz.build
+++ b/netwerk/dns/moz.build
@@ -75,14 +75,17 @@ if CONFIG['ENABLE_INTL_API']:
     CFLAGS += CONFIG['MOZ_ICU_CFLAGS']
     LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES']
     USE_LIBS += ['icu']
 else:
     UNIFIED_SOURCES += [
         'nameprep.c',
     ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+
 if CONFIG['_MSC_VER']:
     # This is intended as a temporary hack to support building with VS2015.
     # icu\source\common\unicode/ucasemap.h(93): warning C4577:
     # 'noexcept' used with no exception handling mode specified;
     # termination on exception is not guaranteed. Specify /EHsc from unified dns
     CXXFLAGS += ['-wd4577']
--- a/netwerk/mime/moz.build
+++ b/netwerk/mime/moz.build
@@ -16,8 +16,11 @@ EXPORTS += [
     'nsMimeTypes.h',
 ]
 
 SOURCES += [
     'nsMIMEHeaderParamImpl.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/protocol/about/moz.build
+++ b/netwerk/protocol/about/moz.build
@@ -25,8 +25,11 @@ UNIFIED_SOURCES += [
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/netwerk/base',
     '/netwerk/cache2',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/protocol/file/moz.build
+++ b/netwerk/protocol/file/moz.build
@@ -20,8 +20,11 @@ UNIFIED_SOURCES += [
     'nsFileProtocolHandler.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/netwerk/base',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/protocol/ftp/moz.build
+++ b/netwerk/protocol/ftp/moz.build
@@ -35,8 +35,11 @@ IPDL_SOURCES += [
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/netwerk/base',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/protocol/websocket/moz.build
+++ b/netwerk/protocol/websocket/moz.build
@@ -42,8 +42,11 @@ IPDL_SOURCES += [
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/dom/base',
     '/netwerk/base',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/sctp/datachannel/moz.build
+++ b/netwerk/sctp/datachannel/moz.build
@@ -30,8 +30,11 @@ if CONFIG['OS_TARGET'] != 'Android':
     DEFINES['INET6'] = 1
 
 if CONFIG['OS_TARGET'] == 'WINNT':
     DEFINES['__Userspace_os_Windows'] = 1
 else:
     DEFINES['__Userspace_os_%s' % CONFIG['OS_TARGET']] = 1
 
 NO_PGO = True # Don't PGO
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/standalone/moz.build
+++ b/netwerk/standalone/moz.build
@@ -44,8 +44,11 @@ LOCAL_INCLUDES = [
     '../dns',
 ]
 
 DEFINES['IDNA2008'] = False
 DEFINES['MOZILLA_INTERNAL_API'] = True
 DEFINES['MOZILLA_EXTERNAL_LINKAGE'] = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/streamconv/test/moz.build
+++ b/netwerk/streamconv/test/moz.build
@@ -12,8 +12,11 @@ UNIFIED_SOURCES += [
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     DEFINES['NGPREFS'] = True
     if CONFIG['GNU_CXX']:
         LDFLAGS += ['-mconsole']
     else:
         LDFLAGS += ['-SUBSYSTEM:CONSOLE']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/system/mac/moz.build
+++ b/netwerk/system/mac/moz.build
@@ -4,8 +4,11 @@
 # 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 += [
     'nsNetworkLinkService.mm',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['CLANG_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/netwerk/test/moz.build
+++ b/netwerk/test/moz.build
@@ -57,8 +57,11 @@ USE_LIBS += ['static:js']
 if CONFIG['ENABLE_INTL_API'] and CONFIG['MOZ_ICU_DATA_ARCHIVE']:
     # The ICU libraries linked into libmozjs will not include the ICU data,
     # so link it directly.
     USE_LIBS += ['icudata']
 
 CXXFLAGS += CONFIG['TK_CFLAGS']
 
 include('/ipc/chromium/chromium-config.mozbuild')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/netwerk/wifi/moz.build
+++ b/netwerk/wifi/moz.build
@@ -52,13 +52,14 @@ elif CONFIG['OS_ARCH'] == 'SunOS':
     UNIFIED_SOURCES += [
         'nsWifiScannerSolaris.cpp',
     ]
 
 if CONFIG['NECKO_WIFI_DBUS']:
     UNIFIED_SOURCES += [
         'nsWifiScannerDBus.cpp',
     ]
+    CXXFLAGS += ['-Wno-error=shadow']
 
 if CONFIG['NECKO_WIFI_DBUS']:
     CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
 
 FINAL_LIBRARY = 'xul'
--- a/parser/html/moz.build
+++ b/parser/html/moz.build
@@ -93,10 +93,12 @@ UNIFIED_SOURCES += [
 FINAL_LIBRARY = 'xul'
 
 # DEFINES['ENABLE_VOID_MENUITEM'] = True
 
 LOCAL_INCLUDES += [
     '/dom/base',
 ]
 
-if CONFIG['CLANG_CXX']:
-    CXXFLAGS += ['-Wno-implicit-fallthrough']
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+    if CONFIG['CLANG_CXX']:
+        CXXFLAGS += ['-Wno-implicit-fallthrough']
--- a/parser/htmlparser/moz.build
+++ b/parser/htmlparser/moz.build
@@ -43,8 +43,11 @@ UNIFIED_SOURCES += [
     'nsParserModule.cpp',
     'nsParserMsgUtils.cpp',
     'nsParserService.cpp',
     'nsScanner.cpp',
     'nsScannerString.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/rdf/base/moz.build
+++ b/rdf/base/moz.build
@@ -49,8 +49,11 @@ UNIFIED_SOURCES += [
     'nsRDFXMLDataSource.cpp',
     'nsRDFXMLParser.cpp',
     'nsRDFXMLSerializer.cpp',
     'rdfTriplesSerializer.cpp',
     'rdfutil.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/security/certverifier/moz.build
+++ b/security/certverifier/moz.build
@@ -75,9 +75,12 @@ if CONFIG['_MSC_VER']:
 
   # Gecko headers aren't warning-free enough for us to enable these warnings
   CXXFLAGS += [
     '-wd4100', # 'symbol' : unreferenced formal parameter
     '-wd4127', # conditional expression is constant
     '-wd4946', # reinterpret_cast used between related types
   ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+
 FINAL_LIBRARY = 'xul'
--- a/security/manager/ssl/moz.build
+++ b/security/manager/ssl/moz.build
@@ -183,8 +183,11 @@ for var in ('DLL_PREFIX', 'DLL_SUFFIX'):
 
 DEFINES['CERT_AddTempCertToPerm'] = '__CERT_AddTempCertToPerm'
 
 USE_LIBS += [
     'crmf',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/security/manager/ssl/tests/gtest/moz.build
+++ b/security/manager/ssl/tests/gtest/moz.build
@@ -16,8 +16,11 @@ LOCAL_INCLUDES += [
     '/security/manager/ssl',
     '/security/pkix/include',
     '/security/pkix/test/lib',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul-gtest'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/security/pkix/moz.build
+++ b/security/pkix/moz.build
@@ -27,12 +27,15 @@ TEST_DIRS += [
 ]
 
 include('warnings.mozbuild')
 
 Library('mozillapkix')
 
 FINAL_LIBRARY = 'xul'
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
+
 if CONFIG['_MSC_VER']:
     # This is intended as a temporary hack to support building with VS2015.
     # declaration of '*' hides class member
-    CXXFLAGS += ['-wd4458']
\ No newline at end of file
+    CXXFLAGS += ['-wd4458']
--- a/security/pkix/test/gtest/moz.build
+++ b/security/pkix/test/gtest/moz.build
@@ -34,23 +34,27 @@ LOCAL_INCLUDES += [
 
 FINAL_LIBRARY = 'xul-gtest'
 
 include('../../warnings.mozbuild')
 
 # These warnings are disabled in order to minimize the amount of boilerplate
 # required to implement tests, and/or because they originate in the GTest
 # framework in a way we cannot otherwise work around.
-if CONFIG['CLANG_CXX']:
+if CONFIG['GNU_CXX']:
   CXXFLAGS += [
-    '-Wno-exit-time-destructors',
-    '-Wno-global-constructors',
+    '-Wno-error=shadow',
     '-Wno-old-style-cast',
-    '-Wno-used-but-marked-unused',
   ]
+  if CONFIG['CLANG_CXX']:
+    CXXFLAGS += [
+      '-Wno-exit-time-destructors',
+      '-Wno-global-constructors',
+      '-Wno-used-but-marked-unused',
+    ]
 elif CONFIG['_MSC_VER']:
   CXXFLAGS += [
     '-wd4350', # behavior change: 'std::_Wrap_alloc<std::allocator<_Ty>>::...
     '-wd4275', # non dll-interface class used as base for dll-interface class
     '-wd4548', # Expression before comma has no effect
     '-wd4625', # copy constructor could not be generated.
     '-wd4626', # assugment operator could not be generated.
     '-wd4640', # construction of local static object is not thread safe.
--- a/security/pkix/test/lib/moz.build
+++ b/security/pkix/test/lib/moz.build
@@ -29,8 +29,11 @@ SOURCES += [
 Library('pkixtestutil')
 
 LOCAL_INCLUDES += [
     '../../include',
     '../../lib',
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/security/sandbox/linux/glue/moz.build
+++ b/security/sandbox/linux/glue/moz.build
@@ -20,8 +20,11 @@ LOCAL_INCLUDES += [
 ]
 
 if CONFIG['OS_TARGET'] == 'Android':
     USE_LIBS += [
         'mozsandbox',
     ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/security/sandbox/linux/moz.build
+++ b/security/sandbox/linux/moz.build
@@ -77,16 +77,19 @@ SOURCES += [
 # dependency like the one in libxul does, but this way the behavior is
 # consistent.  See also the comment in SandboxLogging.h.
 SOURCES['../chromium/base/strings/safe_sprintf.cc'].flags += ['-DNDEBUG']
 
 # Keep clang from warning about intentional 'switch' fallthrough in icu_utf.cc:
 if CONFIG['CLANG_CXX']:
     SOURCES['../chromium/base/third_party/icu/icu_utf.cc'].flags += ['-Wno-implicit-fallthrough']
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
+
 # gcc lto likes to put the top level asm in syscall.cc in a different partition
 # from the function using it which breaks the build.  Work around that by
 # forcing there to be only one partition.
 if '-flto' in CONFIG['OS_CXXFLAGS'] and not CONFIG['CLANG_CXX']:
     LDFLAGS += ['--param lto-partitions=1']
 
 DEFINES['NS_NO_XPCOM'] = True
 DISABLE_STL_WRAPPING = True
--- a/storage/moz.build
+++ b/storage/moz.build
@@ -108,8 +108,11 @@ if CONFIG['MOZ_MEMORY'] and (not CONFIG[
 DEFINES['SQLITE_MAX_LIKE_PATTERN_LENGTH'] = 50000
 
 LOCAL_INCLUDES += [
     '/db/sqlite3/src',
     '/dom/base',
 ]
 
 CXXFLAGS += CONFIG['SQLITE_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/testing/mochitest/ssltunnel/moz.build
+++ b/testing/mochitest/ssltunnel/moz.build
@@ -13,8 +13,11 @@ SOURCES += [
 USE_LIBS += [
     'nspr',
     'nss',
 ]
 
 # This isn't XPCOM code, but it wants to use STL, so disable the STL
 # wrappers
 DISABLE_STL_WRAPPING = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/toolkit/components/downloads/moz.build
+++ b/toolkit/components/downloads/moz.build
@@ -67,8 +67,11 @@ LOCAL_INCLUDES += [
     '../protobuf',
     '/ipc/chromium/src'
 ]
 
 DEFINES['GOOGLE_PROTOBUF_NO_RTTI'] = True
 DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True
 
 CXXFLAGS += CONFIG['TK_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/toolkit/components/places/moz.build
+++ b/toolkit/components/places/moz.build
@@ -90,8 +90,11 @@ if CONFIG['MOZ_PLACES']:
         ]
 
     FINAL_LIBRARY = 'xul'
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'Places')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/toolkit/components/telemetry/moz.build
+++ b/toolkit/components/telemetry/moz.build
@@ -78,8 +78,11 @@ DEFINES['MOZ_APP_VERSION'] = '"%s"' % CO
 
 LOCAL_INCLUDES += [
     '/xpcom/build',
     '/xpcom/threads',
 ]
 
 SPHINX_TREES['telemetry'] = 'docs'
 SPHINX_TREES['healthreport'] = 'docs/fhr'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/toolkit/components/url-classifier/moz.build
+++ b/toolkit/components/url-classifier/moz.build
@@ -63,8 +63,11 @@ EXPORTS += [
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../build',
     '/ipc/chromium/src',
 ]
 
 CXXFLAGS += CONFIG['SQLITE_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/toolkit/crashreporter/crashreporter.mozbuild
+++ b/toolkit/crashreporter/crashreporter.mozbuild
@@ -11,16 +11,17 @@ LOCAL_INCLUDES += [
 # Suppress warnings in third-party code.
 if CONFIG['_MSC_VER']:
     CXXFLAGS += [
         '-wd4005', # macro redefinition
     ]
 elif CONFIG['GNU_CXX']:
     CXXFLAGS += [
         '-Wno-unused-local-typedefs',
+        '-Wno-shadow',
     ]
     if CONFIG['CLANG_CXX']:
         CXXFLAGS += ['-Wno-implicit-fallthrough']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     DEFINES['ELFSIZE'] = 32
 
 DEFINES['NO_STABS_SUPPORT'] = True
--- a/toolkit/crashreporter/google-breakpad/src/client/mac/crash_generation/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/client/mac/crash_generation/moz.build
@@ -10,8 +10,10 @@ UNIFIED_SOURCES += [
 ]
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../../..',
 ]
 
+if CONFIG['CLANG_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/toolkit/crashreporter/google-breakpad/src/client/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/client/moz.build
@@ -9,8 +9,10 @@ SOURCES += [
 ]
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '..',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
@@ -51,8 +51,11 @@ if CONFIG['OS_TARGET'] == 'Android':
 
 Library('breakpad_linux_common_s')
 
 FINAL_LIBRARY = 'xul'
 
 HOST_DEFINES['NO_STABS_SUPPORT'] = True
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/toolkit/crashreporter/moz.build
+++ b/toolkit/crashreporter/moz.build
@@ -112,8 +112,11 @@ LOCAL_INCLUDES += [
 PYTHON_UNIT_TESTS += [
     'tools/unit-symbolstore.py',
 ]
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'Breakpad Integration')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-shadow']
--- a/toolkit/xre/moz.build
+++ b/toolkit/xre/moz.build
@@ -179,8 +179,11 @@ CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS
 
 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
     CXXFLAGS += CONFIG['MOZ_PANGO_CFLAGS']
 
 DEFINES['TOPOBJDIR'] = TOPOBJDIR
 FINAL_TARGET_PP_FILES += [
     'platform.ini'
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/tools/memory-profiler/moz.build
+++ b/tools/memory-profiler/moz.build
@@ -20,8 +20,10 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']:
 
     LOCAL_INCLUDES += [
         '/js/xpconnect/src',
         '/xpcom/base',
     ]
 
     FINAL_LIBRARY = 'xul'
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/tools/profiler/moz.build
+++ b/tools/profiler/moz.build
@@ -137,9 +137,12 @@ if CONFIG['MOZ_TASK_TRACER']:
     UNIFIED_SOURCES += [
         'tasktracer/GeckoTaskTracer.cpp',
         'tasktracer/TracedTaskCommon.cpp',
     ]
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell.ini']
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-ignored-qualifiers']  # due to use of breakpad headers
+    CXXFLAGS += [
+        '-Wno-error=shadow',
+        '-Wno-ignored-qualifiers', # due to use of breakpad headers
+    ]
--- a/tools/profiler/tests/gtest/moz.build
+++ b/tools/profiler/tests/gtest/moz.build
@@ -17,8 +17,11 @@ LOCAL_INCLUDES += [
     '/tools/profiler/lul',
 ]
 
 UNIFIED_SOURCES += [
     'ThreadProfileTest.cpp',
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/uriloader/exthandler/moz.build
+++ b/uriloader/exthandler/moz.build
@@ -72,16 +72,18 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'ui
         'uikit/nsMIMEInfoUIKit.mm',
         'uikit/nsOSHelperAppService.mm',
     ]
 else:
     # These files can't be built in unified mode because they redefine LOG.
     SOURCES += [
         osdir + '/nsOSHelperAppService.cpp',
     ]
+    if CONFIG['GNU_CXX']:
+        CXXFLAGS += ['-Wno-error=shadow']
 
 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
     UNIFIED_SOURCES += [
         'unix/nsGNOMERegistry.cpp',
         'unix/nsMIMEInfoUnix.cpp',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     UNIFIED_SOURCES += [
--- a/uriloader/prefetch/moz.build
+++ b/uriloader/prefetch/moz.build
@@ -36,8 +36,10 @@ IPDL_SOURCES += [
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/dom/base',
 ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/widget/android/moz.build
+++ b/widget/android/moz.build
@@ -56,9 +56,11 @@ LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/system/android',
     '/netwerk/base',
     '/netwerk/cache',
     '/widget',
     '/widget/android/android',
 ]
 
+CXXFLAGS += ['-Wno-error=shadow']
+
 #DEFINES['DEBUG_WIDGETS'] = True
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -121,8 +121,10 @@ if not (CONFIG['MOZ_WIDGET_TOOLKIT'] == 
 
 CXXFLAGS += CONFIG['MOZ_STARTUP_NOTIFICATION_CFLAGS']
 
 CFLAGS += CONFIG['TK_CFLAGS']
 CXXFLAGS += CONFIG['TK_CFLAGS']
 
 if CONFIG['MOZ_ENABLE_DBUS']:
     CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
+
+CXXFLAGS += ['-Wno-error=shadow']
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -248,8 +248,11 @@ LOCAL_INCLUDES += [
     '/widget/%s' % widget_dir,
 ]
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['MOZ_ENABLE_D3D10_LAYER']:
     DEFINES['MOZ_ENABLE_D3D10_LAYER'] = True
 
 CXXFLAGS += CONFIG['TK_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/xpcom/glue/tests/gtest/moz.build
+++ b/xpcom/glue/tests/gtest/moz.build
@@ -13,10 +13,10 @@ UNIFIED_SOURCES += [
 ]
 
 LOCAL_INCLUDES = [
     '../..',
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
 
-if CONFIG['CLANG_CXX']:
-    CXXFLAGS += ['-Wshadow']
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/xpcom/reflect/xptinfo/moz.build
+++ b/xpcom/reflect/xptinfo/moz.build
@@ -28,10 +28,10 @@ EXPORTS.mozilla += [
 ]
 
 LOCAL_INCLUDES += [
     '/dom/base',
 ]
 
 FINAL_LIBRARY = 'xul'
 
-if CONFIG['CLANG_CXX']:
-    CXXFLAGS += ['-Wshadow']
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']
--- a/xpfe/components/directory/moz.build
+++ b/xpfe/components/directory/moz.build
@@ -10,8 +10,11 @@ XPIDL_SOURCES += [
 
 XPIDL_MODULE = 'directory'
 
 SOURCES += [
     'nsDirectoryViewer.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=shadow']