Bug 1324793 - Enable more -Werror warnings: missing-prototypes & redundant-decls draft
authorSylvestre Ledru <sledru@mozilla.com>
Tue, 20 Dec 2016 16:18:02 +0100
changeset 457665 1c84683540bec3988d5714a9995ed8c004a44e72
parent 449801 7652a58efa46f1c57c94bba26efc5d53b6184e83
child 541556 e40da529a881293a96f6b6bd0c398eeaf11ab4c8
child 552064 2b4cb99909cdf6eb2c39353217cd7e76b7c42b40
push id40857
push userbmo:sledru@mozilla.com
push dateMon, 09 Jan 2017 15:21:13 +0000
bugs1324793
milestone53.0a1
Bug 1324793 - Enable more -Werror warnings: missing-prototypes & redundant-decls MozReview-Commit-ID: B80Gty7bTHF
build/moz.configure/warnings.configure
build/unix/elfhack/moz.build
build/unix/moz.build
config/external/ffi/moz.build
config/external/nspr/ds/moz.build
config/external/nspr/libc/moz.build
config/external/nspr/moz.build
config/external/nspr/pr/moz.build
dom/animation/moz.build
dom/base/Element.h
dom/base/moz.build
dom/base/nsContentUtils.h
dom/canvas/gtest/moz.build
dom/canvas/moz.build
dom/events/Event.cpp
dom/html/moz.build
dom/media/encoder/moz.build
dom/media/gmp/GMPAudioDecoderParent.cpp
dom/media/gmp/GMPChild.cpp
dom/media/gmp/GMPContentParent.cpp
dom/media/gmp/GMPDecryptorParent.cpp
dom/media/gmp/GMPDiskStorage.cpp
dom/media/gmp/GMPParent.cpp
dom/media/gmp/GMPService.h
dom/media/gmp/GMPStorageParent.cpp
dom/media/gmp/GMPTimerParent.cpp
dom/media/gmp/GMPVideoDecoderParent.cpp
dom/media/gmp/GMPVideoEncoderParent.cpp
dom/media/mediasource/MediaSource.cpp
dom/media/mediasource/MediaSourceDecoder.cpp
dom/media/mediasource/MediaSourceResource.h
dom/media/mediasource/SourceBuffer.cpp
dom/media/mediasource/SourceBufferList.cpp
dom/media/mediasource/TrackBuffersManager.cpp
dom/media/platforms/agnostic/gmp/GMPAudioDecoder.h
dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
dom/media/webrtc/MediaEngineCameraVideoSource.cpp
dom/media/webrtc/MediaEngineWebRTCAudio.cpp
dom/media/webrtc/moz.build
dom/media/webspeech/synth/SpeechSynthesis.cpp
dom/media/webspeech/synth/SpeechSynthesis.h
dom/media/webspeech/synth/nsSpeechTask.cpp
dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
dom/network/TCPSocketParent.cpp
dom/plugins/base/android/ANPBase.h
dom/plugins/test/testplugin/testplugin.mozbuild
dom/presentation/PresentationService.cpp
dom/storage/DOMStorage.cpp
dom/storage/DOMStorageCache.cpp
dom/storage/DOMStorageDBThread.cpp
dom/storage/DOMStorageDBUpdater.cpp
dom/storage/DOMStorageManager.h
dom/storage/DOMStorageObserver.cpp
dom/svg/moz.build
dom/xml/moz.build
dom/xslt/base/moz.build
dom/xslt/moz.build
dom/xslt/xpath/XPathEvaluator.cpp
dom/xslt/xpath/txXPCOMExtensionFunction.cpp
dom/xslt/xpath/txXPCOMExtensionFunction.h
dom/xul/moz.build
editor/libeditor/moz.build
editor/moz.build
extensions/pref/autoconfig/src/nsAutoConfig.cpp
extensions/pref/autoconfig/src/nsAutoConfig.h
extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
extensions/pref/autoconfig/src/nsJSConfigTriggers.h
extensions/pref/autoconfig/src/nsReadConfig.cpp
gfx/2d/ssse3-scaler.c
gfx/cairo/cairo/src/moz.build
gfx/cairo/libpixman/src/moz.build
gfx/harfbuzz/src/moz.build
gfx/layers/moz.build
gfx/qcms/chain.c
gfx/qcms/iccread.c
gfx/qcms/qcms.h
gfx/qcms/transform.c
gfx/qcms/transform_util.c
gfx/qcms/transform_util.h
gfx/skia/generate_mozbuild.py
gfx/skia/moz.build
gfx/thebes/moz.build
gfx/ycbcr/moz.build
intl/hyphenation/hyphen/hyphen.c
intl/lwbrk/rulebrk.c
intl/lwbrk/rulebrk.h
intl/uconv/moz.build
js/src/editline/moz.build
js/src/gdb/moz.build
js/src/jsapi-tests/moz.build
js/src/jsfriendapi.h
js/src/jsmath.h
js/src/jsobj.h
js/src/moz.build
js/src/shell/moz.build
js/src/vm/Runtime.h
js/xpconnect/src/moz.build
layout/base/moz.build
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsDocumentViewer.h
layout/build/moz.build
layout/build/nsContentDLF.cpp
layout/build/nsLayoutModule.cpp
layout/generic/moz.build
layout/mathml/moz.build
layout/mathml/nsMathMLmactionFrame.cpp
layout/style/moz.build
layout/svg/moz.build
media/gmp-clearkey/0.1/moz.build
media/libcubeb/src/moz.build
media/libogg/moz.build
media/libopus/moz.build
media/libstagefright/moz.build
media/libtheora/moz.build
media/libvorbis/moz.build
media/libvpx/moz.build
media/libyuv/libyuv.gyp
media/libyuv/moz.build
media/mtransport/build/moz.build
media/mtransport/third_party/nICEr/nicer.gyp
media/mtransport/third_party/nrappkit/nrappkit.gyp
media/webrtc/moz.build
media/webrtc/signaling/fuzztest/moz.build
media/webrtc/signaling/signaling.gyp
media/webrtc/signaling/src/common/time_profiling/timecard.h
media/webrtc/signaling/src/sdp/sipcc/sdp_attr.c
media/webrtc/signaling/src/sdp/sipcc/sdp_attr_access.c
media/webrtc/signaling/src/sdp/sipcc/sdp_main.c
media/webrtc/signaling/src/sdp/sipcc/sdp_private.h
media/webrtc/trunk/webrtc/common_audio/common_audio.gyp
media/webrtc/trunk/webrtc/common_video/common_video.gyp
media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac/isac.gypi
media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac/isacfix.gypi
media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing.gypi
memory/build/moz.build
memory/build/replace_malloc.c
memory/mozalloc/moz.build
memory/mozjemalloc/moz.build
memory/replace/dummy/moz.build
memory/replace/jemalloc/moz.build
memory/replace/logalloc/replay/moz.build
memory/volatile/VolatileBufferFallback.cpp
mfbt/decimal/moz-decimal-utils.h
mfbt/lz4.h
modules/brotli/moz.build
modules/libjar/zipwriter/moz.build
modules/libmar/sign/mar_sign.c
modules/libmar/sign/nss_secutil.c
modules/libmar/sign/nss_secutil.h
modules/libmar/src/mar_read.c
modules/libmar/verify/mar_verify.c
modules/woff2/moz.build
modules/zlib/src/moz.build
mozglue/misc/moz.build
netwerk/base/LoadInfo.h
netwerk/base/moz.build
netwerk/dns/moz.build
netwerk/dns/nameprep.c
netwerk/sctp/src/moz.build
netwerk/srtp/src/moz.build
netwerk/standalone/moz.build
nsprpub/pr/include/md/_unixos.h
parser/expat/lib/moz.build
security/certverifier/NSSCertDBTrustDomain.h
security/manager/ssl/PublicSSL.h
security/manager/ssl/SSLServerCertVerification.cpp
security/nss/coreconf/config.gypi
security/nss/lib/base/base.gyp
security/nss/lib/certdb/certdb.gyp
security/nss/lib/certhigh/certhigh.gyp
security/nss/lib/crmf/crmf.gyp
security/nss/lib/crmf/crmf.h
security/nss/lib/cryptohi/cryptohi.gyp
security/nss/lib/dbm/src/src.gyp
security/nss/lib/dev/dev.gyp
security/nss/lib/freebl/freebl.gyp
security/nss/lib/nss/nss.gyp
security/nss/lib/pk11wrap/pk11wrap.gyp
security/nss/lib/pkcs12/p12d.c
security/nss/lib/pkcs12/p12e.c
security/nss/lib/pkcs12/p12local.c
security/nss/lib/pkcs7/pkcs7.gyp
security/nss/lib/pki/pki.gyp
security/nss/lib/smime/cmsrecinfo.c
security/nss/lib/smime/cmsudf.c
security/nss/lib/smime/smime.gyp
security/nss/lib/softoken/legacydb/keydb.c
security/nss/lib/ssl/ssl.gyp
security/nss/lib/ssl/sslimpl.h
security/nss/lib/util/oidstring.c
security/nss/lib/util/secasn1d.c
security/nss/lib/util/utilmod.c
security/nss/lib/util/utilpars.c
storage/TelemetryVFS.cpp
storage/TelemetryVFS.h
storage/mozStorageConnection.cpp
toolkit/components/places/nsNavHistory.cpp
toolkit/components/url-classifier/tests/gtest/Common.h
toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
toolkit/crashreporter/google-breakpad/src/common/moz.build
toolkit/xre/moz.build
toolkit/xre/nsX11ErrorHandler.h
tools/profiler/gecko/nsProfiler.cpp
tools/profiler/moz.build
tools/profiler/public/GeckoProfilerImpl.h
widget/GfxInfoBase.cpp
widget/gtk/moz.build
widget/gtk/mozgtk/gtk2/moz.build
widget/gtk/mozgtk/gtk3/moz.build
widget/gtk/mozgtk/stub/moz.build
widget/nsTransferable.cpp
xpcom/base/NSPRLogModulesParser.h
xpcom/ds/nsStringEnumerator.h
xpcom/glue/BlockingResourceBase.cpp
xpcom/glue/MainThreadUtils.h
xpcom/string/nsReadableUtils.h
xpcom/string/nsStringObsolete.cpp
xpcom/string/nsTStringObsolete.cpp
--- a/build/moz.configure/warnings.configure
+++ b/build/moz.configure/warnings.configure
@@ -83,16 +83,22 @@ check_and_add_gcc_warning('-Wthread-safe
 
 # we inline 'new' and 'delete' in mozalloc
 check_and_add_gcc_warning('-Wno-inline-new-delete', cxx_compiler)
 
 # Prevent the following GCC warnings from being treated as errors:
 # too many false positives
 check_and_add_gcc_warning('-Wno-error=maybe-uninitialized')
 
+# Avoid missing declarations. This can lead to some 32/64 bits issues
+check_and_add_gcc_warning('-Wmissing-prototypes')
+
+# Avoid code duplications
+check_and_add_gcc_warning('-Wredundant-decls')
+
 # we don't want our builds held hostage when a platform-specific API
 # becomes deprecated.
 check_and_add_gcc_warning('-Wno-error=deprecated-declarations')
 
 # false positives depending on optimization
 check_and_add_gcc_warning('-Wno-error=array-bounds')
 
 # can't get rid of those PGO warnings
--- a/build/unix/elfhack/moz.build
+++ b/build/unix/elfhack/moz.build
@@ -21,8 +21,11 @@ if not CONFIG['CROSS_COMPILE']:
 HOST_SOURCES += [
     'elf.cpp',
     'elfhack.cpp',
 ]
 
 HostProgram('elfhack')
 
 NO_PGO = True
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wno-error=missing-prototypes']
--- a/build/unix/moz.build
+++ b/build/unix/moz.build
@@ -15,8 +15,11 @@ if CONFIG['LLVM_SYMBOLIZER']:
 
 SDK_FILES.bin += [
     'run-mozilla.sh',
 ]
 
 FINAL_TARGET_FILES += [
     'run-mozilla.sh',
 ]
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wno-error=missing-prototypes']
--- a/config/external/ffi/moz.build
+++ b/config/external/ffi/moz.build
@@ -97,8 +97,14 @@ else:
             DEFINES['SYMBOL_UNDERSCORE'] = True
         else:
             ffi_srcs = ('ffi.c', 'darwin.S', 'ffi64.c', 'darwin64.S')
 
     SOURCES += [
         '/js/src/ctypes/libffi/src/%s/%s' % (CONFIG['FFI_TARGET_DIR'], s)
         for s in sorted(ffi_srcs)
     ]
+    if CONFIG['GNU_CC']:
+        CFLAGS += [
+            '-Wno-error=missing-prototypes',
+            '-Wno-error=redundant-decls',
+        ]
+
--- a/config/external/nspr/ds/moz.build
+++ b/config/external/nspr/ds/moz.build
@@ -27,8 +27,14 @@ EXPORTS.nspr += [
     '/nsprpub/lib/ds/plarenas.h',
     '/nsprpub/lib/ds/plhash.h',
 ]
 
 SOURCES += [
     '/nsprpub/lib/ds/plarena.c',
     '/nsprpub/lib/ds/plhash.c',
 ]
+
+if CONFIG['GNU_CC']:
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+    ]
+
--- a/config/external/nspr/libc/moz.build
+++ b/config/external/nspr/libc/moz.build
@@ -38,8 +38,11 @@ SOURCES += [
     '/nsprpub/lib/libc/src/strcmp.c',
     '/nsprpub/lib/libc/src/strcpy.c',
     '/nsprpub/lib/libc/src/strdup.c',
     '/nsprpub/lib/libc/src/strlen.c',
     '/nsprpub/lib/libc/src/strpbrk.c',
     '/nsprpub/lib/libc/src/strstr.c',
     '/nsprpub/lib/libc/src/strtok.c',
 ]
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wno-error=missing-prototypes']
--- a/config/external/nspr/moz.build
+++ b/config/external/nspr/moz.build
@@ -21,8 +21,15 @@ if CONFIG['MOZ_BUILD_NSPR']:
         USE_LIBS += [
             'nspr4',
             'plc4',
             'plds4',
         ]
     EXPORTS.nspr += ['prcpucfg.h']
 else:
     OS_LIBS += CONFIG['NSPR_LIBS']
+
+if CONFIG['GNU_CC']:
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+    ]
+
+
--- a/config/external/nspr/pr/moz.build
+++ b/config/external/nspr/pr/moz.build
@@ -225,8 +225,15 @@ EXPORTS.nspr.md += [
     '/nsprpub/pr/include/md/_win95.cfg',
 ]
 
 EXPORTS.nspr.private += [
     '/nsprpub/pr/include/private/pprio.h',
     '/nsprpub/pr/include/private/pprthred.h',
     '/nsprpub/pr/include/private/prpriv.h',
 ]
+
+if CONFIG['GNU_CC']:
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
+    ]
+
--- a/dom/animation/moz.build
+++ b/dom/animation/moz.build
@@ -60,8 +60,12 @@ UNIFIED_SOURCES += [
 
 LOCAL_INCLUDES += [
     '/dom/base',
     '/layout/base',
     '/layout/style',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -65,22 +65,16 @@ namespace dom {
   struct ScrollToOptions;
   class DOMIntersectionObserver;
   class ElementOrCSSPseudoElement;
   class UnrestrictedDoubleOrKeyframeAnimationOptions;
   enum class CallerType : uint32_t;
 } // namespace dom
 } // namespace mozilla
 
-
-already_AddRefed<nsContentList>
-NS_GetContentList(nsINode* aRootNode,
-                  int32_t  aMatchNameSpaceId,
-                  const nsAString& aTagname);
-
 #define ELEMENT_FLAG_BIT(n_) NODE_FLAG_BIT(NODE_TYPE_SPECIFIC_BITS_OFFSET + (n_))
 
 // Element-specific flags
 enum {
   // Set if the element has a pending style change.
   ELEMENT_HAS_PENDING_RESTYLE =                 NODE_SHARED_RESTYLE_BIT_1,
 
   // Set if the element is a potential restyle root (that is, has a style
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -471,9 +471,12 @@ countermap = GENERATED_FILES['PropertyUs
 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']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=shadow',
+    ]
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -147,21 +147,16 @@ class LayerManager;
 } // namespace layers
 
 } // namespace mozilla
 
 class nsIBidiKeyboard;
 
 extern const char kLoadAsData[];
 
-// Stolen from nsReadableUtils, but that's OK, since we can declare the same
-// name multiple times.
-const nsAFlatString& EmptyString();
-const nsAFlatCString& EmptyCString();
-
 enum EventNameType {
   EventNameType_None = 0x0000,
   EventNameType_HTML = 0x0001,
   EventNameType_XUL = 0x0002,
   EventNameType_SVGGraphic = 0x0004, // svg graphic elements
   EventNameType_SVGSVG = 0x0008, // the svg element
   EventNameType_SMIL = 0x0010, // smil elements
   EventNameType_HTMLBodyOrFramesetOnly = 0x0020,
--- a/dom/canvas/gtest/moz.build
+++ b/dom/canvas/gtest/moz.build
@@ -10,8 +10,11 @@ UNIFIED_SOURCES += [
 ]
 
 LOCAL_INCLUDES += [
     '/dom/canvas',
     '/media/libyuv/include'
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
--- a/dom/canvas/moz.build
+++ b/dom/canvas/moz.build
@@ -191,14 +191,17 @@ LOCAL_INCLUDES += [
 ]
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 CXXFLAGS += CONFIG['TK_CFLAGS']
 
 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-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/Event.cpp
+++ b/dom/events/Event.cpp
@@ -32,20 +32,16 @@
 #include "nsJSEnvironment.h"
 #include "nsLayoutUtils.h"
 #include "nsPIWindowRoot.h"
 #include "WorkerPrivate.h"
 
 namespace mozilla {
 namespace dom {
 
-namespace workers {
-extern bool IsCurrentThreadRunningChromeWorker();
-} // namespace workers
-
 static char *sPopupAllowedEvents;
 
 static bool sReturnHighResTimeStamp = false;
 static bool sReturnHighResTimeStampIsSet = false;
 
 Event::Event(EventTarget* aOwner,
              nsPresContext* aPresContext,
              WidgetEvent* aEvent)
--- a/dom/html/moz.build
+++ b/dom/html/moz.build
@@ -238,9 +238,12 @@ LOCAL_INCLUDES += [
     '/layout/tables',
     '/layout/xul',
     '/netwerk/base',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',	
+        '-Wno-error=shadow',
+    ]
--- a/dom/media/encoder/moz.build
+++ b/dom/media/encoder/moz.build
@@ -48,9 +48,14 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
     ]
 
 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=redundant-decls',
+  ]
+
+
--- a/dom/media/gmp/GMPAudioDecoderParent.cpp
+++ b/dom/media/gmp/GMPAudioDecoderParent.cpp
@@ -12,18 +12,16 @@
 #include "mozilla/Logging.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-extern LogModule* GetGMPLog();
-
 #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg)
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 namespace gmp {
 
 GMPAudioDecoderParent::GMPAudioDecoderParent(GMPContentParent* aPlugin)
   : mIsOpen(false)
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -42,17 +42,16 @@ static const int MAX_VOUCHER_LENGTH = 50
 #endif
 #endif
 
 namespace mozilla {
 
 #undef LOG
 #undef LOGD
 
-extern LogModule* GetGMPLog();
 #define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__))
 #define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPChild[pid=%d] " x, (int)base::GetCurrentProcId(), ##__VA_ARGS__)
 
 namespace gmp {
 
 GMPChild::GMPChild()
   : mAsyncShutdown(nullptr)
   , mGMPMessageLoop(MessageLoop::current())
--- a/dom/media/gmp/GMPContentParent.cpp
+++ b/dom/media/gmp/GMPContentParent.cpp
@@ -16,18 +16,16 @@
 #include "base/task.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-extern LogModule* GetGMPLog();
-
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 #ifdef __CLASS__
 #undef __CLASS__
 #endif
 #define __CLASS__ "GMPContentParent"
 
--- a/dom/media/gmp/GMPDecryptorParent.cpp
+++ b/dom/media/gmp/GMPDecryptorParent.cpp
@@ -9,18 +9,16 @@
 #include "mozilla/Unused.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-extern LogModule* GetGMPLog();
-
 #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg)
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 namespace gmp {
 
 GMPDecryptorParent::GMPDecryptorParent(GMPContentParent* aPlugin)
   : mIsOpen(false)
--- a/dom/media/gmp/GMPDiskStorage.cpp
+++ b/dom/media/gmp/GMPDiskStorage.cpp
@@ -19,18 +19,16 @@
 #include "nsISimpleEnumerator.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-extern LogModule* GetGMPLog();
-
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 namespace gmp {
 
 // We store the records for a given GMP as files in the profile dir.
 // $profileDir/gmp/$platform/$gmpName/storage/$nodeId/
 static nsresult
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -44,17 +44,16 @@ using CrashReporter::GetIDFromMinidump;
 #include "mozilla/dom/WidevineCDMManifestBinding.h"
 #include "widevine-adapter/WidevineAdapter.h"
 
 namespace mozilla {
 
 #undef LOG
 #undef LOGD
 
-extern LogModule* GetGMPLog();
 #define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__))
 #define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPParent[%p|childPid=%d] " x, this, mChildPid, ##__VA_ARGS__)
 
 #ifdef __CLASS__
 #undef __CLASS__
 #endif
 #define __CLASS__ "GMPParent"
 
--- a/dom/media/gmp/GMPService.h
+++ b/dom/media/gmp/GMPService.h
@@ -25,17 +25,17 @@
 #include "GMPContentParent.h"
 
 template <class> struct already_AddRefed;
 
 namespace mozilla {
 
 class GMPCrashHelper;
 
-extern LogModule* GetGMPLog();
+LogModule* GetGMPLog();
 
 namespace gmp {
 
 typedef MozPromise<RefPtr<GMPContentParent::CloseBlocker>, nsresult, /* IsExclusive = */ true> GetGMPContentParentPromise;
 
 class GeckoMediaPluginService : public mozIGeckoMediaPluginService
                               , public nsIObserver
 {
--- a/dom/media/gmp/GMPStorageParent.cpp
+++ b/dom/media/gmp/GMPStorageParent.cpp
@@ -10,18 +10,16 @@
 #include "mozIGeckoMediaPluginService.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-extern LogModule* GetGMPLog();
-
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 namespace gmp {
 
 GMPStorageParent::GMPStorageParent(const nsCString& aNodeId,
                                    GMPParent* aPlugin)
   : mNodeId(aNodeId)
--- a/dom/media/gmp/GMPTimerParent.cpp
+++ b/dom/media/gmp/GMPTimerParent.cpp
@@ -9,18 +9,16 @@
 #include "nsAutoPtr.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-extern LogModule* GetGMPLog();
-
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 #ifdef __CLASS__
 #undef __CLASS__
 #endif
 #define __CLASS__ "GMPParent"
 
--- a/dom/media/gmp/GMPVideoDecoderParent.cpp
+++ b/dom/media/gmp/GMPVideoDecoderParent.cpp
@@ -16,18 +16,16 @@
 #include "mozilla/gmp/GMPTypes.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-extern LogModule* GetGMPLog();
-
 #define LOGV(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Verbose, msg)
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
 #define LOGE(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Error, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 namespace gmp {
 
 // States:
--- a/dom/media/gmp/GMPVideoEncoderParent.cpp
+++ b/dom/media/gmp/GMPVideoEncoderParent.cpp
@@ -18,18 +18,16 @@
 #include "GMPUtils.h"
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-extern LogModule* GetGMPLog();
-
 #define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg)
 #define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg)
 
 #ifdef __CLASS__
 #undef __CLASS__
 #endif
 #define __CLASS__ "GMPVideoEncoderParent"
 
--- a/dom/media/mediasource/MediaSource.cpp
+++ b/dom/media/mediasource/MediaSource.cpp
@@ -7,16 +7,17 @@
 #include "MediaSource.h"
 
 #include "AsyncEventRunner.h"
 #include "DecoderTraits.h"
 #include "Benchmark.h"
 #include "DecoderDoctorDiagnostics.h"
 #include "MediaContentType.h"
 #include "MediaResult.h"
+#include "MediaSourceResource.h"
 #include "MediaSourceUtils.h"
 #include "SourceBuffer.h"
 #include "SourceBufferList.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "mozilla/dom/HTMLMediaElement.h"
--- a/dom/media/mediasource/MediaSourceDecoder.cpp
+++ b/dom/media/mediasource/MediaSourceDecoder.cpp
@@ -11,18 +11,16 @@
 #include "MediaSource.h"
 #include "MediaSourceResource.h"
 #include "MediaSourceUtils.h"
 #include "VideoUtils.h"
 #include "MediaSourceDemuxer.h"
 #include "SourceBufferList.h"
 #include <algorithm>
 
-extern mozilla::LogModule* GetMediaSourceLog();
-
 #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
 #define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
 
 using namespace mozilla::media;
 
 namespace mozilla {
 
 MediaSourceDecoder::MediaSourceDecoder(dom::HTMLMediaElement* aElement)
--- a/dom/media/mediasource/MediaSourceResource.h
+++ b/dom/media/mediasource/MediaSourceResource.h
@@ -6,17 +6,19 @@
 
 #ifndef MOZILLA_MEDIASOURCERESOURCE_H_
 #define MOZILLA_MEDIASOURCERESOURCE_H_
 
 #include "MediaResource.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/Logging.h"
 
-extern mozilla::LogModule* GetMediaSourceLog();
+mozilla::LogModule* GetMediaSourceLog();
+mozilla::LogModule* GetMediaSourceAPILog();
+
 
 #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
 
 #define UNIMPLEMENTED() MSE_DEBUG("UNIMPLEMENTED FUNCTION at %s:%d", __FILE__, __LINE__)
 
 namespace mozilla {
 
 class MediaSourceResource final : public MediaResource
--- a/dom/media/mediasource/SourceBuffer.cpp
+++ b/dom/media/mediasource/SourceBuffer.cpp
@@ -27,19 +27,16 @@
 // GetTickCount() and conflicts with MediaDecoder::GetCurrentTime implementation.
 #ifdef GetCurrentTime
 #undef GetCurrentTime
 #endif
 
 struct JSContext;
 class JSObject;
 
-extern mozilla::LogModule* GetMediaSourceLog();
-extern mozilla::LogModule* GetMediaSourceAPILog();
-
 #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
 #define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
 #define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
 
 namespace mozilla {
 
 using media::TimeUnit;
 typedef SourceBufferAttributes::AppendState AppendState;
--- a/dom/media/mediasource/SourceBufferList.cpp
+++ b/dom/media/mediasource/SourceBufferList.cpp
@@ -1,29 +1,27 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #include "SourceBufferList.h"
+#include "MediaSourceResource.h"
 
 #include "AsyncEventRunner.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/dom/SourceBufferListBinding.h"
 #include "mozilla/mozalloc.h"
 #include "nsCOMPtr.h"
 #include "nsIRunnable.h"
 #include "nsString.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Logging.h"
 
-extern mozilla::LogModule* GetMediaSourceLog();
-extern mozilla::LogModule* GetMediaSourceAPILog();
-
 #define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
 #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
 
 struct JSContext;
 class JSObject;
 
 namespace mozilla {
 
--- a/dom/media/mediasource/TrackBuffersManager.cpp
+++ b/dom/media/mediasource/TrackBuffersManager.cpp
@@ -9,25 +9,24 @@
 #include "MediaSourceDemuxer.h"
 #include "MediaSourceUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/StateMirroring.h"
 #include "SourceBufferResource.h"
 #include "SourceBuffer.h"
 #include "WebMDemuxer.h"
 #include "SourceBufferTask.h"
+#include "MediaSourceResource.h"
 
 #ifdef MOZ_FMP4
 #include "MP4Demuxer.h"
 #endif
 
 #include <limits>
 
-extern mozilla::LogModule* GetMediaSourceLog();
-
 #define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
 #define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__))
 
 mozilla::LogModule* GetMediaSourceSamplesLog()
 {
   static mozilla::LazyLogModule sLogModule("MediaSourceSamples");
   return sLogModule;
 }
--- a/dom/media/platforms/agnostic/gmp/GMPAudioDecoder.h
+++ b/dom/media/platforms/agnostic/gmp/GMPAudioDecoder.h
@@ -10,16 +10,20 @@
 #include "GMPAudioDecoderProxy.h"
 #include "MediaDataDecoderProxy.h"
 #include "PlatformDecoderModule.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "nsAutoPtr.h"
 
 namespace mozilla {
 
+#if defined(DEBUG)
+bool IsOnGMPThread();
+#endif
+
 class AudioCallbackAdapter : public GMPAudioDecoderCallbackProxy {
 public:
   explicit AudioCallbackAdapter(MediaDataDecoderCallbackProxy* aCallback)
    : mCallback(aCallback)
    , mLastStreamOffset(0)
    , mAudioFrameSum(0)
    , mAudioFrameOffset(0)
    , mMustRecaptureAudioPosition(true)
--- a/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
+++ b/dom/media/platforms/agnostic/gmp/GMPVideoDecoder.cpp
@@ -1,28 +1,25 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
+#include "GMPAudioDecoder.h" // IsOnGMPThread
 #include "GMPVideoDecoder.h"
 #include "GMPVideoHost.h"
 #include "mozilla/EndianUtils.h"
 #include "prsystem.h"
 #include "MediaData.h"
 #include "GMPDecoderModule.h"
 #include "VPXDecoder.h"
 
 namespace mozilla {
 
-#if defined(DEBUG)
-extern bool IsOnGMPThread();
-#endif
-
 void
 VideoCallbackAdapter::Decoded(GMPVideoi420Frame* aDecodedFrame)
 {
   GMPUniquePtr<GMPVideoi420Frame> decodedFrame(aDecodedFrame);
 
   MOZ_ASSERT(IsOnGMPThread());
 
   VideoData::YCbCrBuffer b;
--- a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp
+++ b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp
@@ -1,22 +1,22 @@
 /* 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/. */
 
 #include "MediaEngineCameraVideoSource.h"
+#include "MediaManager.h"
 
 #include <limits>
 
 namespace mozilla {
 
 using namespace mozilla::gfx;
 using namespace mozilla::dom;
 
-extern LogModule* GetMediaManagerLog();
 #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg)
 #define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg)
 
 // guts for appending data to the MSG track
 bool MediaEngineCameraVideoSource::AppendToTrack(SourceMediaStream* aSource,
                                                  layers::Image* aImage,
                                                  TrackID aID,
                                                  StreamTime delta,
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -4,16 +4,17 @@
 
 #include "MediaEngineWebRTC.h"
 #include <stdio.h>
 #include <algorithm>
 #include "mozilla/Assertions.h"
 #include "MediaTrackConstraints.h"
 #include "mtransport/runnable_utils.h"
 #include "nsAutoPtr.h"
+#include "MediaManager.h"
 
 // scoped_ptr.h uses FF
 #ifdef FF
 #undef FF
 #endif
 #include "webrtc/modules/audio_device/opensl/single_rw_fifo.h"
 
 #define CHANNELS 1
@@ -31,17 +32,16 @@
 static_assert(!(MAX_AEC_FIFO_DEPTH % 10), "Invalid MAX_AEC_FIFO_DEPTH");
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
-extern LogModule* GetMediaManagerLog();
 #define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg)
 #define LOG_FRAMES(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg)
 
 /**
  * Webrtc microphone source source.
  */
 NS_IMPL_ISUPPORTS0(MediaEngineWebRTCMicrophoneSource)
 NS_IMPL_ISUPPORTS0(MediaEngineWebRTCAudioCaptureSource)
--- a/dom/media/webrtc/moz.build
+++ b/dom/media/webrtc/moz.build
@@ -37,16 +37,17 @@ if CONFIG['MOZ_WEBRTC']:
         'RTCIdentityProviderRegistrar.cpp',
     ]
     # MediaEngineWebRTC.cpp needs to be built separately.
     SOURCES += [
         'MediaEngineWebRTC.cpp',
     ]
     LOCAL_INCLUDES += [
         '/dom/base',
+        '/dom/media',
         '/media/libyuv/include',
         '/media/webrtc/signaling/src/common',
         '/media/webrtc/signaling/src/common/browser_logging',
         '/media/webrtc/trunk',
     ]
 
 XPIDL_SOURCES += [
     'nsITabSource.idl'
--- a/dom/media/webspeech/synth/SpeechSynthesis.cpp
+++ b/dom/media/webspeech/synth/SpeechSynthesis.cpp
@@ -11,25 +11,23 @@
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/Element.h"
 
 #include "mozilla/dom/SpeechSynthesisBinding.h"
 #include "SpeechSynthesis.h"
 #include "nsSynthVoiceRegistry.h"
 #include "nsIDocument.h"
 
-#undef LOG
 mozilla::LogModule*
 GetSpeechSynthLog()
 {
   static mozilla::LazyLogModule sLog("SpeechSynthesis");
 
   return sLog;
 }
-#define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg)
 
 namespace mozilla {
 namespace dom {
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(SpeechSynthesis)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SpeechSynthesis, DOMEventTargetHelper)
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mCurrentTask)
--- a/dom/media/webspeech/synth/SpeechSynthesis.h
+++ b/dom/media/webspeech/synth/SpeechSynthesis.h
@@ -15,16 +15,20 @@
 #include "nsWrapperCache.h"
 #include "js/TypeDecls.h"
 
 #include "SpeechSynthesisUtterance.h"
 #include "SpeechSynthesisVoice.h"
 
 class nsIDOMWindow;
 
+#undef LOG
+mozilla::LogModule* GetSpeechSynthLog(void);
+#define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg)
+
 namespace mozilla {
 namespace dom {
 
 class nsSpeechTask;
 
 class SpeechSynthesis final : public DOMEventTargetHelper
                             , public nsIObserver
                             , public nsSupportsWeakReference
--- a/dom/media/webspeech/synth/nsSpeechTask.cpp
+++ b/dom/media/webspeech/synth/nsSpeechTask.cpp
@@ -14,20 +14,16 @@
 #include "SpeechSynthesis.h"
 
 // GetCurrentTime is defined in winbase.h as zero argument macro forwarding to
 // GetTickCount() and conflicts with nsSpeechTask::GetCurrentTime().
 #ifdef GetCurrentTime
 #undef GetCurrentTime
 #endif
 
-#undef LOG
-extern mozilla::LogModule* GetSpeechSynthLog();
-#define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg)
-
 #define AUDIO_TRACK 1
 
 namespace mozilla {
 namespace dom {
 
 class SynthStreamListener : public MediaStreamListener
 {
 public:
--- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
+++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp
@@ -20,20 +20,16 @@
 #include "mozilla/StaticPtr.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/Unused.h"
 
 #include "SpeechSynthesisChild.h"
 #include "SpeechSynthesisParent.h"
 
-#undef LOG
-extern mozilla::LogModule* GetSpeechSynthLog();
-#define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg)
-
 namespace {
 
 void
 GetAllSpeechSynthActors(InfallibleTArray<mozilla::dom::SpeechSynthesisParent*>& aActors)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aActors.IsEmpty());
 
--- a/dom/network/TCPSocketParent.cpp
+++ b/dom/network/TCPSocketParent.cpp
@@ -1,40 +1,31 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #include "TCPSocketParent.h"
+#include "TCPSocketChild.h" // for DeserializeArrayBuffer
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "nsJSUtils.h"
 #include "mozilla/Unused.h"
 #include "mozilla/net/NeckoCommon.h"
 #include "mozilla/net/PNeckoParent.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/TabParent.h"
 #include "mozilla/HoldDropJSObjects.h"
 #include "nsISocketTransportService.h"
 #include "nsISocketTransport.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsNetUtil.h"
 
-namespace IPC {
-
-//Defined in TCPSocketChild.cpp
-extern bool
-DeserializeArrayBuffer(JSContext* aCx,
-                       const InfallibleTArray<uint8_t>& aBuffer,
-                       JS::MutableHandle<JS::Value> aVal);
-
-} // namespace IPC
-
 namespace mozilla {
 
 namespace net {
 //
 // set MOZ_LOG=TCPSocket:5
 //
 extern LazyLogModule gTCPSocketLog;
 #define TCPSOCKET_LOG(args)     MOZ_LOG(gTCPSocketLog, LogLevel::Debug, args)
--- a/dom/plugins/base/android/ANPBase.h
+++ b/dom/plugins/base/android/ANPBase.h
@@ -1,12 +1,14 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
+#ifndef ANPBase_h__
+#define ANPBase_h__
 
 #include <stdlib.h>
 #include "android_npapi.h"
 #include "nsISupportsImpl.h"
 
 #define NOT_IMPLEMENTED_FATAL() do {                                    \
     __android_log_print(ANDROID_LOG_ERROR, "GeckoPlugins",              \
                         "%s not implemented %s, %d",                    \
@@ -29,8 +31,11 @@ void InitSurfaceInterface(ANPSurfaceInte
 void InitSystemInterfaceV1(ANPSystemInterfaceV1 *i);
 void InitSystemInterfaceV2(ANPSystemInterfaceV2 *i);
 void InitTypeFaceInterface(ANPTypefaceInterfaceV0 *i);
 void InitWindowInterface(ANPWindowInterfaceV0 *i);
 void InitWindowInterfaceV2(ANPWindowInterfaceV2 *i);
 void InitVideoInterfaceV1(ANPVideoInterfaceV1 *i);
 void InitOpenGLInterface(ANPOpenGLInterfaceV0 *i);
 void InitNativeWindowInterface(ANPNativeWindowInterfaceV0 *i);
+
+#endif // ANPBase_h__
+
--- a/dom/plugins/test/testplugin/testplugin.mozbuild
+++ b/dom/plugins/test/testplugin/testplugin.mozbuild
@@ -64,9 +64,12 @@ if CONFIG['_MSC_VER']:
 
 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']
+    CXXFLAGS += [
+        '-Wno-error=missing-prototypes',
+	'-Wno-error=shadow',
+	]
--- a/dom/presentation/PresentationService.cpp
+++ b/dom/presentation/PresentationService.cpp
@@ -1164,16 +1164,18 @@ PresentationService::IsSessionAccessible
     return false;
   }
   return info->IsAccessible(aProcessId);
 }
 
 } // namespace dom
 } // namespace mozilla
 
+extern already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
+
 already_AddRefed<nsIPresentationService>
 NS_CreatePresentationService()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIPresentationService> service;
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     service = new mozilla::dom::PresentationIPCService();
--- a/dom/storage/DOMStorage.cpp
+++ b/dom/storage/DOMStorage.cpp
@@ -266,20 +266,16 @@ DOMStorage::GetType() const
 }
 
 nsIPrincipal*
 DOMStorage::GetPrincipal()
 {
   return mPrincipal;
 }
 
-// Defined in DOMStorageManager.cpp
-extern bool
-PrincipalsEqual(nsIPrincipal* aObjectPrincipal, nsIPrincipal* aSubjectPrincipal);
-
 bool
 DOMStorage::PrincipalEquals(nsIPrincipal* aPrincipal)
 {
   return PrincipalsEqual(mPrincipal, aPrincipal);
 }
 
 bool
 DOMStorage::IsPrivate() const
--- a/dom/storage/DOMStorageCache.cpp
+++ b/dom/storage/DOMStorageCache.cpp
@@ -577,20 +577,16 @@ DOMStorageCache::CloneFrom(const DOMStor
   for (uint32_t i = 0; i < kDataSetCount; ++i) {
     for (auto it = aThat->mData[i].mKeys.ConstIter(); !it.Done(); it.Next()) {
       mData[i].mKeys.Put(it.Key(), it.UserData());
     }
     ProcessUsageDelta(i, aThat->mData[i].mOriginQuotaUsage);
   }
 }
 
-// Defined in DOMStorageManager.cpp
-extern bool
-PrincipalsEqual(nsIPrincipal* aObjectPrincipal, nsIPrincipal* aSubjectPrincipal);
-
 bool
 DOMStorageCache::CheckPrincipal(nsIPrincipal* aPrincipal) const
 {
   return PrincipalsEqual(mPrincipal, aPrincipal);
 }
 
 void
 DOMStorageCache::UnloadItems(uint32_t aUnloadFlags)
--- a/dom/storage/DOMStorageDBThread.cpp
+++ b/dom/storage/DOMStorageDBThread.cpp
@@ -438,19 +438,16 @@ DOMStorageDBThread::ThreadObserver::OnPr
 NS_IMETHODIMP
 DOMStorageDBThread::ThreadObserver::AfterProcessNextEvent(nsIThreadInternal *thread,
                                           bool eventWasProcessed)
 {
   return NS_OK;
 }
 
 
-extern void
-ReverseString(const nsCSubstring& aSource, nsCSubstring& aResult);
-
 nsresult
 DOMStorageDBThread::OpenDatabaseConnection()
 {
   nsresult rv;
 
   MOZ_ASSERT(!NS_IsMainThread());
 
   nsCOMPtr<mozIStorageService> service
--- a/dom/storage/DOMStorageDBUpdater.cpp
+++ b/dom/storage/DOMStorageDBUpdater.cpp
@@ -16,19 +16,16 @@
 #include "mozilla/Tokenizer.h"
 
 // Current version of the database schema
 #define CURRENT_SCHEMA_VERSION 1
 
 namespace mozilla {
 namespace dom {
 
-extern void
-ReverseString(const nsCSubstring& aSource, nsCSubstring& aResult);
-
 namespace {
 
 class nsReverseStringSQLFunction final : public mozIStorageFunction
 {
   ~nsReverseStringSQLFunction() {}
 
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
--- a/dom/storage/DOMStorageManager.h
+++ b/dom/storage/DOMStorageManager.h
@@ -19,16 +19,24 @@
 #include "nsHashKeys.h"
 
 namespace mozilla {
 
 class OriginAttributesPattern;
 
 namespace dom {
 
+bool
+PrincipalsEqual(nsIPrincipal* aObjectPrincipal, nsIPrincipal* aSubjectPrincipal);
+
+void ReverseString(const nsCSubstring& aSource, nsCSubstring& aResult);
+
+nsresult CreateReversedDomain(const nsACString& aAsciiDomain, nsACString& aKey);
+
+
 const DOMStorage::StorageType SessionStorage = DOMStorage::SessionStorage;
 const DOMStorage::StorageType LocalStorage = DOMStorage::LocalStorage;
 
 class DOMStorageManager : public nsIDOMStorageManager
                         , public DOMStorageObserverSink
 {
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMSTORAGEMANAGER
--- a/dom/storage/DOMStorageObserver.cpp
+++ b/dom/storage/DOMStorageObserver.cpp
@@ -32,19 +32,16 @@ static const char kStartupTopic[] = "ses
 static const uint32_t kStartupDelay = 0;
 
 NS_IMPL_ISUPPORTS(DOMStorageObserver,
                   nsIObserver,
                   nsISupportsWeakReference)
 
 DOMStorageObserver* DOMStorageObserver::sSelf = nullptr;
 
-extern nsresult
-CreateReversedDomain(const nsACString& aAsciiDomain, nsACString& aKey);
-
 // static
 nsresult
 DOMStorageObserver::Init()
 {
   if (sSelf) {
     return NS_OK;
   }
 
--- a/dom/svg/moz.build
+++ b/dom/svg/moz.build
@@ -262,9 +262,12 @@ LOCAL_INCLUDES += [
     '/layout/base',
     '/layout/generic',
     '/layout/style',
     '/layout/svg',
     '/layout/xul',
 ]
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=shadow',
+    ]
--- a/dom/xml/moz.build
+++ b/dom/xml/moz.build
@@ -39,8 +39,12 @@ LOCAL_INCLUDES += [
     '/dom/html',
     '/dom/xul',
     '/layout/style',
 ]
 
 RESOURCE_FILES.dtd += [
     'htmlmathml-f.ent',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
--- a/dom/xslt/base/moz.build
+++ b/dom/xslt/base/moz.build
@@ -13,14 +13,15 @@ UNIFIED_SOURCES += [
     'txURIUtils.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '..',
     '../xml',
     '../xpath',
     '../xslt',
+    '/ipc/chromium/src',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['GNU_CXX']:
     CXXFLAGS += ['-Wno-error=shadow']
--- a/dom/xslt/moz.build
+++ b/dom/xslt/moz.build
@@ -21,11 +21,13 @@ EXPORTS += [
 
 DIRS += [
     'base',
     'xml',
     'xpath',
     'xslt',
 ]
 
+LOCAL_INCLUDES += ['/ipc/chromium/src']
+
 if CONFIG['ENABLE_TESTS']:
     JAR_MANIFESTS += ['tests/buster/jar.mn']
     MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
--- a/dom/xslt/xpath/XPathEvaluator.cpp
+++ b/dom/xslt/xpath/XPathEvaluator.cpp
@@ -15,24 +15,21 @@
 #include "nsError.h"
 #include "txURIUtils.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsDOMString.h"
 #include "nsNameSpaceManager.h"
 #include "nsContentUtils.h"
 #include "txIXPathContext.h"
+#include "txXPCOMExtensionFunction.h"
 #include "mozilla/dom/XPathEvaluatorBinding.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/XPathNSResolverBinding.h"
 
-extern nsresult
-TX_ResolveFunctionCallXPCOM(const nsCString &aContractID, int32_t aNamespaceID,
-                            nsIAtom *aName, nsISupports *aState,
-                            FunctionCall **aFunction);
 
 namespace mozilla {
 namespace dom {
 
 // txIParseContext implementation
 class XPathEvaluatorParseContext : public txIParseContext
 {
 public:
--- a/dom/xslt/xpath/txXPCOMExtensionFunction.cpp
+++ b/dom/xslt/xpath/txXPCOMExtensionFunction.cpp
@@ -11,16 +11,17 @@
 #include "nsServiceManagerUtils.h"
 #include "txExpr.h"
 #include "txIFunctionEvaluationContext.h"
 #include "txIXPathContext.h"
 #include "txNodeSetAdaptor.h"
 #include "txXPathTreeWalker.h"
 #include "xptcall.h"
 #include "txXPathObjectAdaptor.h"
+#include "txXPCOMExtensionFunction.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "nsIClassInfo.h"
 #include "nsIInterfaceInfo.h"
 #include "js/RootingAPI.h"
 
 NS_IMPL_ISUPPORTS(txXPathObjectAdaptor, txIXPathObject)
new file mode 100644
--- /dev/null
+++ b/dom/xslt/xpath/txXPCOMExtensionFunction.h
@@ -0,0 +1,14 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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/. */
+
+#ifndef txXPCOMExtensionFunction_h__
+#define txXPCOMExtensionFunction_h__
+
+nsresult
+TX_ResolveFunctionCallXPCOM(const nsCString &aContractID, int32_t aNamespaceID,
+                            nsIAtom *aName, nsISupports *aState,
+                            FunctionCall **aFunction);
+
+#endif // txXPCOMExtensionFunction_h__
--- a/dom/xul/moz.build
+++ b/dom/xul/moz.build
@@ -42,18 +42,22 @@ UNIFIED_SOURCES += [
 
 LOCAL_INCLUDES += [
     '/docshell/base',
     '/dom/base',
     '/dom/html',
     '/dom/xbl',
     '/dom/xml',
     '/dom/xul/templates',
+    '/ipc/chromium/src',
     '/layout/base',
     '/layout/generic',
     '/layout/style',
     '/layout/xul',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=shadow',
+    ]
--- a/editor/libeditor/moz.build
+++ b/editor/libeditor/moz.build
@@ -92,9 +92,12 @@ EXTRA_COMPONENTS += [
     'EditorUtils.manifest',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=shadow',
+        '-Wno-error=redundant-decls',
+    ]
--- a/editor/moz.build
+++ b/editor/moz.build
@@ -37,8 +37,9 @@ XPIDL_MODULE = 'editor'
 
 EXPORTS += [
     'nsEditorCID.h',
 ]
 
 EXTRA_JS_MODULES += [
     'AsyncSpellCheckTestHelper.jsm',
 ]
+
--- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp
@@ -23,22 +23,16 @@
 #include <algorithm>
 
 #include "mozilla/Logging.h"
 
 using mozilla::LogLevel;
 
 mozilla::LazyLogModule MCD("MCD");
 
-extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
-                                          const char *filename, 
-                                          bool bGlobalContext, 
-                                          bool bCallbacks, 
-                                          bool skipFirstLine);
-
 // nsISupports Implementation
 
 NS_IMPL_ISUPPORTS(nsAutoConfig, nsIAutoConfig, nsITimerCallback, nsIStreamListener, nsIObserver, nsIRequestObserver, nsISupportsWeakReference)
 
 nsAutoConfig::nsAutoConfig()
 {
 }
 
--- a/extensions/pref/autoconfig/src/nsAutoConfig.h
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.h
@@ -11,16 +11,22 @@
 #include "nsIFile.h"
 #include "nsIObserver.h"
 #include "nsIStreamListener.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsWeakReference.h"
 #include "nsString.h"
 
+nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
+                                   const char *filename,
+                                   bool bGlobalContext,
+                                   bool bCallbacks,
+                                   bool skipFirstLine);
+
 class nsAutoConfig : public nsIAutoConfig,
                      public nsITimerCallback,
                      public nsIStreamListener,
                      public nsIObserver,
                      public nsSupportsWeakReference
 
 {
     public:
--- a/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
+++ b/extensions/pref/autoconfig/src/nsJSConfigTriggers.cpp
@@ -13,16 +13,17 @@
 #include "nspr.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Maybe.h"
 #include "nsContentUtils.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsJSPrincipals.h"
 #include "nsIScriptError.h"
 #include "jswrapper.h"
+#include "nsJSConfigTriggers.h"
 
 extern mozilla::LazyLogModule MCD;
 using mozilla::AutoSafeJSContext;
 using mozilla::dom::AutoJSAPI;
 
 //*****************************************************************************
 
 static JS::PersistentRooted<JSObject *> autoconfigSb;
new file mode 100644
--- /dev/null
+++ b/extensions/pref/autoconfig/src/nsJSConfigTriggers.h
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* 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/. */
+
+#ifndef nsJSConfigTriggers_h
+#define nsJSConfigTriggers_h
+
+nsresult CentralizedAdminPrefManagerInit(void);
+nsresult CentralizedAdminPrefManagerFinish(void);
+
+#endif // nsJSConfigTriggers
--- a/extensions/pref/autoconfig/src/nsReadConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp
@@ -23,25 +23,16 @@
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nspr.h"
 #include "nsXULAppAPI.h"
 #include "nsContentUtils.h"
 
 extern mozilla::LazyLogModule MCD;
 
-extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length,
-                                          const char *filename, 
-                                          bool bGlobalContext, 
-                                          bool bCallbacks, 
-                                          bool skipFirstLine);
-extern nsresult CentralizedAdminPrefManagerInit();
-extern nsresult CentralizedAdminPrefManagerFinish();
-
-
 static void DisplayError(void)
 {
     nsresult rv;
 
     nsCOMPtr<nsIPromptService> promptService = do_GetService("@mozilla.org/embedcomp/prompt-service;1");
     if (!promptService)
         return;
 
--- a/gfx/2d/ssse3-scaler.c
+++ b/gfx/2d/ssse3-scaler.c
@@ -32,16 +32,17 @@
 
 #include <stdlib.h>
 #include <mmintrin.h>
 #include <xmmintrin.h>
 #include <emmintrin.h>
 #include <tmmintrin.h>
 #include <stdint.h>
 #include <assert.h>
+#include "ssse3-scaler.h"
 
 typedef int32_t                 pixman_fixed_16_16_t;
 typedef pixman_fixed_16_16_t    pixman_fixed_t;
 #define pixman_fixed_1                  (pixman_int_to_fixed(1))
 #define pixman_fixed_to_int(f)          ((int) ((f) >> 16))
 #define pixman_int_to_fixed(i)          ((pixman_fixed_t) ((i) << 16))
 #define pixman_double_to_fixed(d)       ((pixman_fixed_t) ((d) * 65536.0))
 typedef struct pixman_vector pixman_vector_t;
--- a/gfx/cairo/cairo/src/moz.build
+++ b/gfx/cairo/cairo/src/moz.build
@@ -218,16 +218,18 @@ if CONFIG['GNU_CC'] or CONFIG['CLANG_CL'
     CFLAGS += [
         '-Wno-enum-compare',
         '-Wno-int-to-pointer-cast',
         '-Wno-sign-compare',
         '-Wno-type-limits',
         '-Wno-missing-field-initializers',
         '-Wno-conversion',
         '-Wno-unused-but-set-variable',
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
     ]
 if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
     CFLAGS += [
         '-Wno-incompatible-pointer-types',
         '-Wno-tautological-compare',
         '-Wno-tautological-constant-out-of-range-compare',
         '-Wno-error=uninitialized',
     ]
--- a/gfx/cairo/libpixman/src/moz.build
+++ b/gfx/cairo/libpixman/src/moz.build
@@ -141,16 +141,17 @@ if use_arm_neon_gcc:
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
     CFLAGS += [
         '-Wno-address',
         '-Wno-missing-field-initializers',
         '-Wno-sign-compare',
         '-Wno-unused',                      # too many unused warnings; ignore
+        '-Wno-error=missing-prototypes',
     ]
 if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
     CFLAGS += [
         '-Wno-incompatible-pointer-types',
         '-Wno-tautological-compare',
         '-Wno-tautological-constant-out-of-range-compare',
     ]
 if CONFIG['CLANG_CL']:
--- a/gfx/harfbuzz/src/moz.build
+++ b/gfx/harfbuzz/src/moz.build
@@ -77,8 +77,15 @@ FINAL_LIBRARY = 'gkmedias'
 DEFINES['PACKAGE_VERSION'] = '"moz"'
 DEFINES['PACKAGE_BUGREPORT'] = '"http://bugzilla.mozilla.org/"'
 DEFINES['HAVE_OT'] = 1
 DEFINES['HB_NO_MT'] = True
 DEFINES['HB_NO_UNICODE_FUNCS'] = True
 # Cancel the effect of the -DDEBUG macro if present,
 # because harfbuzz uses that name for its own purposes
 DEFINES['DEBUG'] = False
+
+# Suppress warnings in third-party code.
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
+
+
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -443,14 +443,17 @@ MOCHITEST_MANIFESTS += ['apz/test/mochit
 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']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=shadow',
+    ]
 
 if CONFIG['MOZ_ENABLE_SKIA']:
   UNIFIED_SOURCES += [
     'composite/PaintCounter.cpp',
   ]
--- a/gfx/qcms/chain.c
+++ b/gfx/qcms/chain.c
@@ -23,16 +23,17 @@
 
 #include <stdlib.h>
 #include <math.h>
 #include <assert.h>
 #include <string.h> //memcpy
 #include "qcmsint.h"
 #include "transform_util.h"
 #include "matrix.h"
+#include "chain.h"
 
 static struct matrix build_lut_matrix(struct lutType *lut)
 {
 	struct matrix result;
 	if (lut) {
 		result.m[0][0] = s15Fixed16Number_to_float(lut->e00);
 		result.m[0][1] = s15Fixed16Number_to_float(lut->e01);
 		result.m[0][2] = s15Fixed16Number_to_float(lut->e02);
@@ -702,17 +703,17 @@ static struct qcms_modular_transform* qc
 	transform->transform_module_fn = qcms_transform_module_clut;
 
 	return first_transform;
 fail:
 	qcms_modular_transform_release(first_transform);
 	return NULL;
 }
 
-struct qcms_modular_transform* qcms_modular_transform_create_input(qcms_profile *in)
+static struct qcms_modular_transform* qcms_modular_transform_create_input(qcms_profile *in)
 {
 	struct qcms_modular_transform *first_transform = NULL;
 	struct qcms_modular_transform **next_transform = &first_transform;
 
 	if (in->A2B0) {
 		struct qcms_modular_transform *lut_transform;
 		lut_transform = qcms_modular_transform_create_lut(in->A2B0);
 		if (!lut_transform)
--- a/gfx/qcms/iccread.c
+++ b/gfx/qcms/iccread.c
@@ -793,17 +793,17 @@ static void read_rendering_intent(qcms_p
 		case QCMS_INTENT_RELATIVE_COLORIMETRIC:
 		case QCMS_INTENT_ABSOLUTE_COLORIMETRIC:
 			break;
 		default:
 			invalid_source(src, "unknown rendering intent");
 	}
 }
 
-qcms_profile *qcms_profile_create(void)
+static qcms_profile *qcms_profile_create(void)
 {
 	return calloc(sizeof(qcms_profile), 1);
 }
 
 
 
 /* build sRGB gamma table */
 /* based on cmsBuildParametricGamma() */
@@ -915,17 +915,17 @@ qcms_profile* qcms_profile_create_rgb_wi
 		return NO_MEM_PROFILE;
 	}
 	profile->class = DISPLAY_DEVICE_PROFILE;
 	profile->rendering_intent = QCMS_INTENT_PERCEPTUAL;
 	profile->color_space = RGB_SIGNATURE;
 	return profile;
 }
 
-qcms_profile* qcms_profile_create_rgb_with_table(
+static qcms_profile* qcms_profile_create_rgb_with_table(
 		qcms_CIE_xyY white_point,
 		qcms_CIE_xyYTRIPLE primaries,
 		uint16_t *table, int num_entries)
 {
 	qcms_profile* profile = qcms_profile_create();
 	if (!profile)
 		return NO_MEM_PROFILE;
 
--- a/gfx/qcms/qcms.h
+++ b/gfx/qcms/qcms.h
@@ -165,15 +165,15 @@ qcms_transform* qcms_transform_create(
 		qcms_profile *in, qcms_data_type in_type,
 		qcms_profile* out, qcms_data_type out_type,
 		qcms_intent intent);
 
 void qcms_transform_release(qcms_transform *);
 
 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_t length);
 
-void qcms_enable_iccv4();
+void qcms_enable_iccv4(void);
 
 #ifdef  __cplusplus
 }
 #endif
 
 #endif
--- a/gfx/qcms/transform.c
+++ b/gfx/qcms/transform.c
@@ -24,16 +24,17 @@
 #include <stdlib.h>
 #include <math.h>
 #include <assert.h>
 #include <string.h> //memcpy
 #include "qcmsint.h"
 #include "chain.h"
 #include "matrix.h"
 #include "transform_util.h"
+#include "qcms.h"
 
 /* for MSVC, GCC, Intel, and Sun compilers */
 #if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_M_AMD64) || defined(__x86_64__) || defined(__x86_64)
 #define X86
 #endif /* _M_IX86 || __i386__ || __i386 || _M_AMD64 || __x86_64__ || __x86_64 */
 
 /**
  * AltiVec detection for PowerPC CPUs
@@ -1074,38 +1075,16 @@ static int sse_version_available(void)
 
 	return sse_version;
 #else
 	return 0;
 #endif
 }
 #endif
 
-static const struct matrix bradford_matrix = {{	{ 0.8951f, 0.2664f,-0.1614f},
-						{-0.7502f, 1.7135f, 0.0367f},
-						{ 0.0389f,-0.0685f, 1.0296f}}, 
-						false};
-
-static const struct matrix bradford_matrix_inv = {{ { 0.9869929f,-0.1470543f, 0.1599627f},
-						    { 0.4323053f, 0.5183603f, 0.0492912f},
-						    {-0.0085287f, 0.0400428f, 0.9684867f}}, 
-						    false};
-
-// See ICCv4 E.3
-struct matrix compute_whitepoint_adaption(float X, float Y, float Z) {
-	float p = (0.96422f*bradford_matrix.m[0][0] + 1.000f*bradford_matrix.m[1][0] + 0.82521f*bradford_matrix.m[2][0]) /
-		  (X*bradford_matrix.m[0][0]      + Y*bradford_matrix.m[1][0]      + Z*bradford_matrix.m[2][0]     );
-	float y = (0.96422f*bradford_matrix.m[0][1] + 1.000f*bradford_matrix.m[1][1] + 0.82521f*bradford_matrix.m[2][1]) /
-		  (X*bradford_matrix.m[0][1]      + Y*bradford_matrix.m[1][1]      + Z*bradford_matrix.m[2][1]     );
-	float b = (0.96422f*bradford_matrix.m[0][2] + 1.000f*bradford_matrix.m[1][2] + 0.82521f*bradford_matrix.m[2][2]) /
-		  (X*bradford_matrix.m[0][2]      + Y*bradford_matrix.m[1][2]      + Z*bradford_matrix.m[2][2]     );
-	struct matrix white_adaption = {{ {p,0,0}, {0,y,0}, {0,0,b}}, false};
-	return matrix_multiply( bradford_matrix_inv, matrix_multiply(white_adaption, bradford_matrix) );
-}
-
 void qcms_profile_precache_output_transform(qcms_profile *profile)
 {
 	/* we only support precaching on rgb profiles */
 	if (profile->color_space != RGB_SIGNATURE)
 		return;
 
 	if (qcms_supports_iccv4) {
 		/* don't precache since we will use the B2A LUT */
@@ -1143,17 +1122,17 @@ void qcms_profile_precache_output_transf
 				!compute_precache(profile->blueTRC, profile->output_table_b->data)) {
 			precache_release(profile->output_table_b);
 			profile->output_table_b = NULL;
 		}
 	}
 }
 
 /* Replace the current transformation with a LUT transformation using a given number of sample points */
-qcms_transform* qcms_transform_precacheLUT_float(qcms_transform *transform, qcms_profile *in, qcms_profile *out, 
+static qcms_transform* qcms_transform_precacheLUT_float(qcms_transform *transform, qcms_profile *in, qcms_profile *out, 
                                                  int samples, qcms_data_type in_type)
 {
 	/* The range between which 2 consecutive sample points can be used to interpolate */
 	uint16_t x,y,z;
 	uint32_t l;
 	uint32_t lutSize = 3 * samples * samples * samples;
 	float* src = NULL;
 	float* dest = NULL;
@@ -1399,12 +1378,12 @@ qcms_transform* qcms_transform_create(
 __attribute__((__force_align_arg_pointer__))
 #endif
 void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_t length)
 {
 	transform->transform_fn(transform, src, dest, length);
 }
 
 qcms_bool qcms_supports_iccv4;
-void qcms_enable_iccv4()
+void qcms_enable_iccv4(void)
 {
 	qcms_supports_iccv4 = true;
 }
--- a/gfx/qcms/transform_util.c
+++ b/gfx/qcms/transform_util.c
@@ -90,35 +90,35 @@ uint16_t lut_interp_linear16(uint16_t in
 	uint32_t interp = value % 4096;
 
 	value = (table[upper]*(interp) + table[lower]*(4096 - interp))/4096; // 0..4096*4096
 
 	return value;
 }
 #endif
 
-void compute_curve_gamma_table_type1(float gamma_table[256], uint16_t gamma)
+static void compute_curve_gamma_table_type1(float gamma_table[256], uint16_t gamma)
 {
 	unsigned int i;
 	float gamma_float = u8Fixed8Number_to_float(gamma);
 	for (i = 0; i < 256; i++) {
                 // 0..1^(0..255 + 255/256) will always be between 0 and 1
 		gamma_table[i] = pow(i/255., gamma_float);
 	}
 }
 
-void compute_curve_gamma_table_type2(float gamma_table[256], uint16_t *table, int length)
+static void compute_curve_gamma_table_type2(float gamma_table[256], uint16_t *table, int length)
 {
 	unsigned int i;
 	for (i = 0; i < 256; i++) {
 		gamma_table[i] = lut_interp_linear(i/255., table, length);
 	}
 }
 
-void compute_curve_gamma_table_type_parametric(float gamma_table[256], float parameter[7], int count)
+static void compute_curve_gamma_table_type_parametric(float gamma_table[256], float parameter[7], int count)
 {
         size_t X;
         float interval;
         float a, b, c, e, f;
         float y = parameter[0];
         if (count == 0) {
                 a = 1;
                 b = 0;
@@ -170,17 +170,17 @@ void compute_curve_gamma_table_type_para
                         // TODO Should division by 255 be for the whole expression.
                         gamma_table[X] = clamp_float(pow(a * X / 255. + b, y) + c + e);
                 } else {
                         gamma_table[X] = clamp_float(c * X / 255. + f);
                 }
         }
 }
 
-void compute_curve_gamma_table_type0(float gamma_table[256])
+static void compute_curve_gamma_table_type0(float gamma_table[256])
 {
 	unsigned int i;
 	for (i = 0; i < 256; i++) {
 		gamma_table[i] = i/255.;
 	}
 }
 
 float *build_input_gamma_table(struct curveType *TRC)
@@ -367,25 +367,25 @@ static void compute_precache_pow(uint8_t
 {
 	uint32_t v = 0;
 	for (v = 0; v < PRECACHE_OUTPUT_SIZE; v++) {
 		//XXX: don't do integer/float conversion... and round?
 		output[v] = 255. * pow(v/(double)PRECACHE_OUTPUT_MAX, gamma);
 	}
 }
 
-void compute_precache_lut(uint8_t *output, uint16_t *table, int length)
+static void compute_precache_lut(uint8_t *output, uint16_t *table, int length)
 {
 	uint32_t v = 0;
 	for (v = 0; v < PRECACHE_OUTPUT_SIZE; v++) {
 		output[v] = lut_interp_linear_precache_output(v, table, length);
 	}
 }
 
-void compute_precache_linear(uint8_t *output)
+static void compute_precache_linear(uint8_t *output)
 {
 	uint32_t v = 0;
 	for (v = 0; v < PRECACHE_OUTPUT_SIZE; v++) {
 		//XXX: round?
 		output[v] = v / (PRECACHE_OUTPUT_SIZE/256);
 	}
 }
 
--- a/gfx/qcms/transform_util.h
+++ b/gfx/qcms/transform_util.h
@@ -82,17 +82,16 @@ static inline float u8Fixed8Number_to_fl
   return x/256.;
 }
 
 float *build_input_gamma_table(struct curveType *TRC);
 struct matrix build_colorant_matrix(qcms_profile *p);
 void build_output_lut(struct curveType *trc,
                       uint16_t **output_gamma_lut, size_t *output_gamma_lut_length);
 
-struct matrix matrix_invert(struct matrix mat);
 qcms_bool compute_precache(struct curveType *trc, uint8_t *output);
 
 // Tested by GTest
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
 uint16_fract_t lut_inverse_interp16(uint16_t Value, uint16_t LutTable[], int length);
--- a/gfx/skia/generate_mozbuild.py
+++ b/gfx/skia/generate_mozbuild.py
@@ -124,16 +124,17 @@ if CONFIG['MOZ_TREE_FREETYPE']:
 if CONFIG['GNU_CXX'] or CONFIG['CLANG_CL']:
     CXXFLAGS += [
         '-Wno-deprecated-declarations',
         '-Wno-overloaded-virtual',
         '-Wno-shadow',
         '-Wno-sign-compare',
         '-Wno-unreachable-code',
         '-Wno-unused-function',
+        '-Wno-error=redundant-decls',
     ]
 if CONFIG['GNU_CXX'] and not CONFIG['CLANG_CXX'] and not CONFIG['CLANG_CL']:
     CXXFLAGS += [
         '-Wno-logical-op',
         '-Wno-maybe-uninitialized',
     ]
 if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
     CXXFLAGS += [
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -734,16 +734,17 @@ if CONFIG['MOZ_TREE_FREETYPE']:
 if CONFIG['GNU_CXX'] or CONFIG['CLANG_CL']:
     CXXFLAGS += [
         '-Wno-deprecated-declarations',
         '-Wno-overloaded-virtual',
         '-Wno-shadow',
         '-Wno-sign-compare',
         '-Wno-unreachable-code',
         '-Wno-unused-function',
+        '-Wno-error=redundant-decls',
     ]
 if CONFIG['GNU_CXX'] and not CONFIG['CLANG_CXX'] and not CONFIG['CLANG_CL']:
     CXXFLAGS += [
         '-Wno-logical-op',
         '-Wno-maybe-uninitialized',
     ]
 if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
     CXXFLAGS += [
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -275,8 +275,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk
 LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
 LOCAL_INCLUDES += ['/media/libyuv/include']
 
 DEFINES['GRAPHITE2_STATIC'] = True
 
 if CONFIG['CLANG_CXX']:
     # Suppress warnings from Skia header files.
     SOURCES['gfxPlatform.cpp'].flags += ['-Wno-implicit-fallthrough']
+
+CXXFLAGS += [ '-Wno-error=redundant-decls' ]
--- a/gfx/ycbcr/moz.build
+++ b/gfx/ycbcr/moz.build
@@ -58,8 +58,12 @@ if CONFIG['CPU_ARCH'] == 'arm' and CONFI
     ]
     SOURCES += [
         'yuv_convert_arm.cpp',
     ]
 
 LOCAL_INCLUDES += ['/media/libyuv/include']
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
--- a/intl/hyphenation/hyphen/hyphen.c
+++ b/intl/hyphenation/hyphen/hyphen.c
@@ -70,17 +70,17 @@ hnj_strdup (const char *s)
   l = strlen (s);
   newstr = (char *) hnj_malloc (l + 1);
   memcpy (newstr, s, l);
   newstr[l] = 0;
   return newstr;
 }
 
 /* remove cross-platform text line end characters */
-void hnj_strchomp(char * s)
+static void hnj_strchomp(char * s)
 {
   int k = strlen(s);
   if ((k > 0) && ((*(s+k-1)=='\r') || (*(s+k-1)=='\n'))) *(s+k-1) = '\0';
   if ((k > 1) && (*(s+k-2) == '\r')) *(s+k-2) = '\0';
 }
 
 /* a little bit of a hash table implementation. This simply maps strings
    to state numbers */
@@ -237,17 +237,17 @@ get_state_str (int state, int level)
   for (i = 0; i < HASH_SIZE; i++)
     for (e = global[level]->entries[i]; e; e = e->next)
       if (e->val == state)
 	return e->key;
   return NULL;
 }
 #endif
 
-void hnj_hyphen_load_line(char * buf, HyphenDict * dict, HashTab * hashtab) {
+static void hnj_hyphen_load_line(char * buf, HyphenDict * dict, HashTab * hashtab) {
   int i, j;
   char word[MAX_CHARS];
   char pattern[MAX_CHARS];
   char * repl;
   signed char replindex;
   signed char replcut;
   int state_num = 0;
   int last_state;
@@ -669,46 +669,46 @@ int hnj_hyphen_hyphenate (HyphenDict *di
   hyphens[word_size] = '\0';
 
   hnj_free (prep_word);
     
   return 0;    
 }
 
 /* Unicode ligature length */
-int hnj_ligature(unsigned char c) {
+static int hnj_ligature(unsigned char c) {
     switch (c) {
         case 0x80:			/* ff */
         case 0x81:			/* fi */
         case 0x82: return LIG_xx;	/* fl */
         case 0x83:			/* ffi */
         case 0x84: return LIG_xxx;	/* ffl */
         case 0x85:			/* long st */
         case 0x86: return LIG_xx;	/* st */
     }
     return 0;
 }
 
 /* character length of the first n byte of the input word */
-int hnj_hyphen_strnlen(const char * word, int n, int utf8)
+static int hnj_hyphen_strnlen(const char * word, int n, int utf8)
 {
     int i = 0;
     int j = 0;
     while (j < n && word[j] != '\0') {
       i++;
       // Unicode ligature support
       if (utf8 && ((unsigned char) word[j] == 0xEF) && ((unsigned char) word[j + 1] == 0xAC))  {
         i += hnj_ligature(word[j + 2]);
       }
       for (j++; utf8 && (word[j] & 0xc0) == 0x80; j++);
     }
     return i;
 }
 
-int hnj_hyphen_lhmin(int utf8, const char *word, int word_size, char * hyphens,
+static int hnj_hyphen_lhmin(int utf8, const char *word, int word_size, char * hyphens,
 	char *** rep, int ** pos, int ** cut, int lhmin)
 {
     int i = 1, j;
 
     // Unicode ligature support
     if (utf8 && ((unsigned char) word[0] == 0xEF) && ((unsigned char) word[1] == 0xAC))  {
       i += hnj_ligature(word[2]);
     }
@@ -734,17 +734,17 @@ int hnj_hyphen_lhmin(int utf8, const cha
        // Unicode ligature support
        if (utf8 && ((unsigned char) word[j] == 0xEF) && ((unsigned char) word[j + 1] == 0xAC))  {
          i += hnj_ligature(word[j + 2]);
        }
     } while (utf8 && (word[j] & 0xc0) == 0x80);
     return 0;
 }
 
-int hnj_hyphen_rhmin(int utf8, const char *word, int word_size, char * hyphens,
+static int hnj_hyphen_rhmin(int utf8, const char *word, int word_size, char * hyphens,
 	char *** rep, int ** pos, int ** cut, int rhmin)
 {
     int i = 0;
     int j;
 
     // ignore numbers
     for (j = word_size - 1; j > 0 && word[j] <= '9' && word[j] >= '0'; j--) i--;
 
@@ -762,17 +762,17 @@ int hnj_hyphen_rhmin(int utf8, const cha
          hyphens[j] = '0';
        }
        if (!utf8 || (word[j] & 0xc0) == 0xc0 || (word[j] & 0x80) != 0x80) i++;
     }
     return 0;
 }
 
 // recursive function for compound level hyphenation
-int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
+static int hnj_hyphen_hyph_(HyphenDict *dict, const char *word, int word_size,
     char * hyphens, char *** rep, int ** pos, int ** cut,
     int clhmin, int crhmin, int lend, int rend)
 {
   char *prep_word;
   int i, j, k;
   int state;
   char ch;
   HyphenState *hstate;
@@ -1026,17 +1026,17 @@ int hnj_hyphen_hyph_(HyphenDict *dict, c
      free(hyphens2);
   }
 
   hnj_free (prep_word);
   return 0;
 }
 
 /* UTF-8 normalization of hyphen and non-standard positions */
-int hnj_hyphen_norm(const char *word, int word_size, char * hyphens,
+static int hnj_hyphen_norm(const char *word, int word_size, char * hyphens,
 	char *** rep, int ** pos, int ** cut)
 {
   int i, j, k;
   if ((((unsigned char) word[0]) >> 6) == 2) {
     fprintf(stderr, "error - bad, non UTF-8 input: %s\n", word);
     return 1;
   }
 
@@ -1068,17 +1068,17 @@ int hnj_hyphen_norm(const char *word, in
   hyphens[j + 1] = '\0';
 #ifdef VERBOSE
   printf ("nums: %s\n", hyphens);
 #endif
   return 0;
 }
 
 /* get the word with all possible hyphenations (output: hyphword) */
-void hnj_hyphen_hyphword(const char * word, int l, const char * hyphens, 
+static void hnj_hyphen_hyphword(const char * word, int l, const char * hyphens, 
     char * hyphword, char *** rep, int ** pos, int ** cut)
 {
   int hyphenslen = l + 5;
 
   int i, j;
   for (i = 0, j = 0; i < l; i++, j++) {
     if (hyphens[i]&1) {
       hyphword[j] = word[i];
--- a/intl/lwbrk/rulebrk.c
+++ b/intl/lwbrk/rulebrk.c
@@ -2,16 +2,17 @@
  * 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/. */
 #define TH_UNICODE
 
 #include <stdlib.h>
 #include <stdint.h>
 #include <assert.h>
 #include "th_char.h"
+#include "rulebrk.h"
 #define th_isalpha(c)   (((c)>='a'&&(c)<='z')||((c)>='A'&&(c)<='Z'))
 #define th_isspace(c)   ((c)==' '||(c)=='\t')
 
 
 /*
 /////////////////////////////////////////////////
 // Thai character type array
 */
--- a/intl/lwbrk/rulebrk.h
+++ b/intl/lwbrk/rulebrk.h
@@ -11,16 +11,16 @@ purpose.  It is provided "as is" without
 #ifndef __RULEBRK_H__
 #define __RULEBRK_H__
 #include "th_char.h"
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-int TrbWordBreakPos(const th_char *pstr, int left, 
+int TrbWordBreakPos(const th_char *pstr, int left,
                     const th_char *rstr, int right);
 int TrbFollowing(const th_char *begin, int length, int offset);
 
 #ifdef __cplusplus
 }
 #endif
 #endif
--- a/intl/uconv/moz.build
+++ b/intl/uconv/moz.build
@@ -163,9 +163,13 @@ LOCAL_INCLUDES += [
     'ucvlatin',
     'ucvtw',
     'util',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+	'-Wno-error=shadow',
+	'-Wno-error=missing-prototypes',
+	]
+    CFLAGS += ['-Wno-error=redundant-decls']
--- a/js/src/editline/moz.build
+++ b/js/src/editline/moz.build
@@ -11,8 +11,11 @@ UNIFIED_SOURCES += [
     'sysunix.c',
 ]
 
 FORCE_STATIC_LIB = True
 
 for var in ('ANSI_ARROWS', 'HAVE_TCGETATTR', 'HIDE', 'USE_DIRENT', 'SYS_UNIX',
             'HAVE_STDLIB', 'UNIQUE_HISTORY'):
     DEFINES[var] = True
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wno-error=missing-prototypes']
+
--- a/js/src/gdb/moz.build
+++ b/js/src/gdb/moz.build
@@ -37,17 +37,20 @@ 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']
+    CXXFLAGS += [
+	'-Wno-error=redundant-decls',
+	'-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
@@ -139,16 +139,20 @@ if CONFIG['ENABLE_INTL_API'] and CONFIG[
 
 USE_LIBS += [
     'static:js',
 ]
 
 OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-shadow', '-Werror=format']
+    CXXFLAGS += [
+        '-Wno-shadow',
+        '-Werror=format',
+        '-Wno-error=redundant-decls',
+    ]
 
 # 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/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -2019,24 +2019,16 @@ JS_GetTypedArrayByteOffset(JSObject* obj
  * |obj| must have passed a JS_IsTypedArrayObject/JS_Is*Array test, or somehow
  * be known that it would pass such a test: it is a typed array or a wrapper of
  * a typed array, and the unwrapping will succeed.
  */
 extern JS_FRIEND_API(uint32_t)
 JS_GetTypedArrayByteLength(JSObject* obj);
 
 /**
- * Check whether obj supports JS_ArrayBufferView* APIs. Note that this may
- * return false if a security wrapper is encountered that denies the
- * unwrapping.
- */
-extern JS_FRIEND_API(bool)
-JS_IsArrayBufferViewObject(JSObject* obj);
-
-/**
  * More generic name for JS_GetTypedArrayByteLength to cover DataViews as well
  */
 extern JS_FRIEND_API(uint32_t)
 JS_GetArrayBufferViewByteLength(JSObject* obj);
 
 /*
  * Return a pointer to the start of the data referenced by a typed array. The
  * data is still owned by the typed array, and should not be modified on
--- a/js/src/jsmath.h
+++ b/js/src/jsmath.h
@@ -280,38 +280,29 @@ extern double
 ecmaAtan2(double x, double y);
 
 extern double
 math_atan_impl(MathCache* cache, double x);
 
 extern double
 math_atan_uncached(double x);
 
-extern bool
-math_atan(JSContext* cx, unsigned argc, js::Value* vp);
-
 extern double
 math_asin_impl(MathCache* cache, double x);
 
 extern double
 math_asin_uncached(double x);
 
-extern bool
-math_asin(JSContext* cx, unsigned argc, js::Value* vp);
-
 extern double
 math_acos_impl(MathCache* cache, double x);
 
 extern double
 math_acos_uncached(double x);
 
 extern bool
-math_acos(JSContext* cx, unsigned argc, js::Value* vp);
-
-extern bool
 math_ceil_handle(JSContext* cx, HandleValue value, MutableHandleValue res);
 
 extern bool
 math_ceil(JSContext* cx, unsigned argc, Value* vp);
 
 extern double
 math_ceil_impl(double x);
 
@@ -343,19 +334,16 @@ extern float
 math_roundf_impl(float x);
 
 extern double
 powi(double x, int y);
 
 extern double
 ecmaPow(double x, double y);
 
-extern bool
-math_imul(JSContext* cx, unsigned argc, Value* vp);
-
 extern double
 math_log10_impl(MathCache* cache, double x);
 
 extern double
 math_log10_uncached(double x);
 
 extern double
 math_log2_impl(MathCache* cache, double x);
--- a/js/src/jsobj.h
+++ b/js/src/jsobj.h
@@ -1263,20 +1263,16 @@ GetGetterPure(ExclusiveContext* cx, JSOb
 
 bool
 GetOwnNativeGetterPure(JSContext* cx, JSObject* obj, jsid id, JSNative* native);
 
 bool
 HasOwnDataPropertyPure(JSContext* cx, JSObject* obj, jsid id, bool* result);
 
 bool
-GetOwnPropertyDescriptor(JSContext* cx, HandleObject obj, HandleId id,
-                         MutableHandle<JS::PropertyDescriptor> desc);
-
-bool
 GetOwnPropertyDescriptor(JSContext* cx, HandleObject obj, HandleId id, MutableHandleValue vp);
 
 /*
  * Like JS::FromPropertyDescriptor, but ignore desc.object() and always set vp
  * to an object on success.
  *
  * Use JS::FromPropertyDescriptor for getOwnPropertyDescriptor, since desc.object()
  * is used to indicate whether a result was found or not.  Use this instead for
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -783,13 +783,17 @@ selfhosted.inputs = [
 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', '-Werror=format']
+    CXXFLAGS += [
+        '-Wno-shadow',
+        '-Werror=format',
+        '-Wno-error=redundant-decls',
+    ]
 
 # 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
@@ -46,17 +46,21 @@ GENERATED_FILES += ['shellmoduleloader.o
 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', '-Werror=format']
+    CXXFLAGS += [
+	'-Wno-shadow',
+	'-Werror=format',
+	'-Wno-error=redundant-decls',
+	]
 
 # 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
--- a/js/src/vm/Runtime.h
+++ b/js/src/vm/Runtime.h
@@ -13,16 +13,17 @@
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/Scoped.h"
 #include "mozilla/ThreadLocal.h"
 #include "mozilla/Vector.h"
 
 #include <setjmp.h>
 
+#include "jsalloc.h"
 #include "jsatom.h"
 #include "jsclist.h"
 #include "jsscript.h"
 
 #ifdef XP_DARWIN
 # include "wasm/WasmSignalHandlers.h"
 #endif
 #include "builtin/AtomicsObject.h"
@@ -80,19 +81,16 @@ struct DtoaState;
 #ifdef JS_SIMULATOR_ARM64
 namespace vixl {
 class Simulator;
 }
 #endif
 
 namespace js {
 
-extern MOZ_COLD void
-ReportOutOfMemory(ExclusiveContext* cx);
-
 /* Different signature because the return type has MOZ_MUST_USE_TYPE. */
 extern MOZ_COLD mozilla::GenericErrorResult<OOM&>
 ReportOutOfMemoryResult(ExclusiveContext* cx);
 
 extern MOZ_COLD void
 ReportAllocationOverflow(ExclusiveContext* maybecx);
 
 extern MOZ_COLD void
--- a/js/xpconnect/src/moz.build
+++ b/js/xpconnect/src/moz.build
@@ -62,9 +62,13 @@ LOCAL_INCLUDES += [
     '/dom/svg',
     '/dom/workers',
     '/layout/base',
     '/layout/style',
     '/xpcom/reflect/xptinfo',
 ]
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-shadow', '-Werror=format']
+    CXXFLAGS += [
+        '-Wno-shadow',
+        '-Werror=format',
+        '-Wno-error=redundant-decls',
+    ]
--- a/layout/base/moz.build
+++ b/layout/base/moz.build
@@ -178,9 +178,13 @@ MOCHITEST_MANIFESTS += ['tests/mochitest
 MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini']
 
 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']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=shadow',
+    ]
+
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -22,16 +22,17 @@
 #include "mozilla/PresShell.h"
 #include "nsAbsoluteContainingBlock.h"
 #include "nsCSSPseudoElements.h"
 #include "nsIAtom.h"
 #include "nsIFrameInlines.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
 #include "nsIDocument.h"
+#include "nsMenuPopupFrame.h"
 #include "nsTableFrame.h"
 #include "nsTableColFrame.h"
 #include "nsTableRowFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsUnicharUtils.h"
@@ -56,16 +57,17 @@
 #include "nsContentUtils.h"
 #include "nsIScriptError.h"
 #ifdef XP_MACOSX
 #include "nsIDocShell.h"
 #endif
 #include "ChildIterator.h"
 #include "nsError.h"
 #include "nsLayoutUtils.h"
+#include "nsRangeFrame.h"
 #include "nsAutoPtr.h"
 #include "nsBoxFrame.h"
 #include "nsBoxLayout.h"
 #include "nsFlexContainerFrame.h"
 #include "nsGridContainerFrame.h"
 #include "RubyUtils.h"
 #include "nsRubyFrame.h"
 #include "nsRubyBaseFrame.h"
@@ -241,40 +243,31 @@ NS_NewLeafBoxFrame (nsIPresShell* aPresS
 
 nsIFrame*
 NS_NewStackFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 nsIFrame*
 NS_NewProgressMeterFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 nsIFrame*
-NS_NewRangeFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
-
-nsIFrame*
 NS_NewImageBoxFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 nsIFrame*
 NS_NewTextBoxFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 nsIFrame*
 NS_NewGroupBoxFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 nsIFrame*
 NS_NewButtonBoxFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 nsIFrame*
 NS_NewSplitterFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 nsIFrame*
-NS_NewMenuPopupFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
-
-nsIFrame*
-NS_NewPopupSetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
-
-nsIFrame*
 NS_NewMenuFrame (nsIPresShell* aPresShell, nsStyleContext* aContext, uint32_t aFlags);
 
 nsIFrame*
 NS_NewMenuBarFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
 nsIFrame*
 NS_NewTreeBodyFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
 
new file mode 100644
--- /dev/null
+++ b/layout/base/nsDocumentViewer.h
@@ -0,0 +1,13 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/. */
+
+#ifndef nsDocumentViewer_h__
+#define nsDocumentViewer_h__
+#include "nsIContentViewer.h"
+
+already_AddRefed<nsIContentViewer> NS_NewContentViewer();
+
+#endif // nsDocumentViewer_h__
+
--- a/layout/build/moz.build
+++ b/layout/build/moz.build
@@ -93,9 +93,12 @@ if CONFIG['MOZ_WEBSPEECH_POCKETSPHINX']:
 if CONFIG['MOZ_SECUREELEMENT']:
     LOCAL_INCLUDES += [
         '/dom/secureelement',
     ]
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=shadow',
+    ]
--- a/layout/build/nsContentDLF.cpp
+++ b/layout/build/nsContentDLF.cpp
@@ -6,16 +6,17 @@
 #include "nsCOMPtr.h"
 #include "nsContentDLF.h"
 #include "nsDocShell.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
 #include "nsIComponentManager.h"
 #include "nsIComponentRegistrar.h"
 #include "nsIContentViewer.h"
+#include "nsDocumentViewer.h"
 #include "nsICategoryManager.h"
 #include "nsIDocumentLoaderFactory.h"
 #include "nsIDocument.h"
 #include "nsIURL.h"
 #include "nsNodeInfoManager.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsString.h"
 #include "nsContentCID.h"
@@ -41,18 +42,16 @@ static NS_DEFINE_CID(kPluginDocumentCID,
 
 static NS_DEFINE_IID(kHTMLDocumentCID, NS_HTMLDOCUMENT_CID);
 static NS_DEFINE_IID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
 static NS_DEFINE_IID(kSVGDocumentCID, NS_SVGDOCUMENT_CID);
 static NS_DEFINE_IID(kVideoDocumentCID, NS_VIDEODOCUMENT_CID);
 static NS_DEFINE_IID(kImageDocumentCID, NS_IMAGEDOCUMENT_CID);
 static NS_DEFINE_IID(kXULDocumentCID, NS_XULDOCUMENT_CID);
 
-already_AddRefed<nsIContentViewer> NS_NewContentViewer();
-
 static const char* const gHTMLTypes[] = {
   TEXT_HTML,
   VIEWSOURCE_CONTENT_TYPE,
   APPLICATION_XHTML_XML,
   APPLICATION_WAPXHTML_XML,
   0
 };
   
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -16,16 +16,17 @@
 #include "nsNoDataProtocolContentPolicy.h"
 #include "nsDOMCID.h"
 #include "nsHTMLContentSerializer.h"
 #include "nsHTMLParts.h"
 #include "nsIComponentManager.h"
 #include "nsIContentIterator.h"
 #include "nsIContentSerializer.h"
 #include "nsIContentViewer.h"
+#include "nsDocumentViewer.h"
 #include "nsIController.h"
 #include "nsIControllers.h"
 #include "nsIDOMDOMImplementation.h"
 #include "nsIDocument.h"
 #include "nsIDocumentEncoder.h"
 #include "nsIFactory.h"
 #include "nsIFrameUtil.h"
 #include "nsIIdleService.h"
@@ -48,16 +49,19 @@
 #include "nsLayoutCID.h"
 #include "nsStyleSheetService.h"
 #include "nsFocusManager.h"
 #include "ThirdPartyUtil.h"
 #include "nsStructuredCloneContainer.h"
 #include "gfxPlatform.h"
 #include "mozilla/gfx/gfxVars.h"
 
+#include "nsContentDLF.h"
+#include "nsDocumentViewer.h"
+
 #include "nsIEventListenerService.h"
 #include "nsIMessageManager.h"
 
 // Transformiix stuff
 #include "mozilla/dom/XPathEvaluator.h"
 #include "txMozillaXSLTProcessor.h"
 #include "txNodeSetAdaptor.h"
 
@@ -401,36 +405,32 @@ Shutdown()
   nsLayoutStatics::Release();
 }
 
 #ifdef DEBUG
 nsresult NS_NewFrameUtil(nsIFrameUtil** aResult);
 nsresult NS_NewLayoutDebugger(nsILayoutDebugger** aResult);
 #endif
 
-nsresult NS_NewBoxObject(nsIBoxObject** aResult);
-
 #ifdef MOZ_XUL
 nsresult NS_NewListBoxObject(nsIBoxObject** aResult);
 nsresult NS_NewScrollBoxObject(nsIBoxObject** aResult);
 nsresult NS_NewMenuBoxObject(nsIBoxObject** aResult);
 nsresult NS_NewPopupBoxObject(nsIBoxObject** aResult);
 nsresult NS_NewContainerBoxObject(nsIBoxObject** aResult);
 nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
 #endif
 
 nsresult NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult);
 
 nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
 
 nsresult NS_NewDomSelection(nsISelection** aResult);
-already_AddRefed<nsIContentViewer> NS_NewContentViewer();
 nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
 nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
-nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
 nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
 nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
 nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
 
 nsresult NS_NewEventListenerService(nsIEventListenerService** aResult);
 nsresult NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult);
 nsresult NS_NewParentProcessMessageManager(nsIMessageBroadcaster** aResult);
 nsresult NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult);
--- a/layout/generic/moz.build
+++ b/layout/generic/moz.build
@@ -221,9 +221,12 @@ MOCHITEST_MANIFESTS += ['test/mochitest.
 MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 
 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
     CXXFLAGS += CONFIG['TK_CFLAGS']
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=shadow',
+    ]
--- a/layout/mathml/moz.build
+++ b/layout/mathml/moz.build
@@ -65,9 +65,14 @@ RESOURCE_FILES.fonts += [
 ]
 
 if CONFIG['OS_TARGET'] == 'WINNT':
     RESOURCE_FILES.fonts += [
         'mathfontSymbol.properties',
     ]
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=shadow',
+    ]
+
+
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -235,17 +235,17 @@ nsMathMLmactionFrame::AttributeChanged(i
 // ################################################################
 
 NS_IMPL_ISUPPORTS(nsMathMLmactionFrame::MouseListener,
                   nsIDOMEventListener)
 
 
 // helper to show a msg on the status bar
 // curled from nsPluginFrame.cpp ...
-void
+static void
 ShowStatus(nsPresContext* aPresContext, nsString& aStatusMsg)
 {
   nsCOMPtr<nsIDocShellTreeItem> docShellItem(aPresContext->GetDocShell());
   if (docShellItem) {
     nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
     docShellItem->GetTreeOwner(getter_AddRefs(treeOwner));
     if (treeOwner) {
       nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(treeOwner));
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -264,8 +264,12 @@ if CONFIG['COMPILE_ENVIRONMENT']:
         'nsCSSPropsGenerated.inc',
     ]
     css_props = GENERATED_FILES['nsCSSPropsGenerated.inc']
     css_props.script = 'GenerateCSSPropsGenerated.py:generate'
     css_props.inputs = [
         'nsCSSPropsGenerated.inc.in',
         'PythonCSSProps.h',
     ]
+
+if CONFIG['GNU_CC']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
--- a/layout/svg/moz.build
+++ b/layout/svg/moz.build
@@ -70,8 +70,12 @@ LOCAL_INCLUDES += [
     '../xul',
     '/dom/base',
     '/dom/svg',
 ]
 
 RESOURCE_FILES += [
     'svg.css',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
--- a/media/gmp-clearkey/0.1/moz.build
+++ b/media/gmp-clearkey/0.1/moz.build
@@ -58,16 +58,17 @@ DEFINES['MOZ_NO_MOZALLOC'] = True
 USE_LIBS += ['psshparser']
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CXX']:
     CFLAGS += [
         '-Wno-missing-braces',
         '-Wno-pointer-to-int-cast',
         '-Wno-sign-compare',
+        '-Wno-error=missing-prototypes',
         '-include', 'stdio.h',      # for sprintf() prototype
         '-include', 'unistd.h',     # for getpid() prototype
     ]
 elif CONFIG['_MSC_VER']:
     CFLAGS += [
         '-FI', 'stdio.h',           # for sprintf() prototype
         '-wd4090',                  # '=' : different 'const' qualifiers
     ]
--- a/media/libcubeb/src/moz.build
+++ b/media/libcubeb/src/moz.build
@@ -91,8 +91,14 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk
             '%' + '%s/system/media/wilhelm/include' % CONFIG['ANDROID_SOURCE'],
         ]
 
 CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
 CFLAGS += CONFIG['MOZ_PULSEAUDIO_CFLAGS']
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
+
+# Suppress warnings in third-party code.
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wno-missing-prototypes']
+
+
--- a/media/libogg/moz.build
+++ b/media/libogg/moz.build
@@ -15,8 +15,15 @@ EXPORTS.ogg += [
 
 UNIFIED_SOURCES += [
     'src/ogg_alloc.c',
     'src/ogg_bitwise.c',
     'src/ogg_framing.c',
 ]
 
 FINAL_LIBRARY = 'gkmedias'
+
+if CONFIG['GNU_CC']:
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
+    ]
+
--- a/media/libopus/moz.build
+++ b/media/libopus/moz.build
@@ -105,10 +105,14 @@ if CONFIG['CPU_ARCH'] == 'arm' and CONFI
     # opcodes; actual arch detection is done at runtime.
     ASFLAGS += [
         '-march=armv7-a',
     ]
     ASFLAGS += CONFIG['NEON_FLAGS']
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CC']:
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
+    ]
     if CONFIG['CLANG_CXX']:
         CFLAGS += ['-Wno-#pragma-messages']
--- a/media/libstagefright/moz.build
+++ b/media/libstagefright/moz.build
@@ -149,17 +149,18 @@ if CONFIG['_MSC_VER']:
         '-wd4309', # '=' : truncation of constant value
         '-wd4355', # 'this' : used in base member initializer list
         '-wd4804', # '>' : unsafe use of type 'bool' in operation
         '-wd4099', # mismatched class/struct tags
     ]
 elif CONFIG['GNU_CXX']:
     CFLAGS += [
         '-Wno-comment',
-        '-Wno-sign-compare'
+        '-Wno-sign-compare',
+        '-Wno-error=missing-prototypes',
     ]
     CXXFLAGS += [
         '-Wno-format',
         '-Wno-format-security',
         '-Wno-multichar',
         '-Wno-sign-compare',
         '-Wno-unused',
     ]
--- a/media/libtheora/moz.build
+++ b/media/libtheora/moz.build
@@ -18,17 +18,21 @@ ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'gkmedias'
 
 # The encoder is currently not included.
 DEFINES['THEORA_DISABLE_ENCODE'] = True
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
-    CFLAGS += ['-Wno-type-limits']
+    CFLAGS += [
+        '-Wno-type-limits',
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
+    ]
 if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
     CFLAGS += ['-Wno-tautological-compare']
 if CONFIG['CLANG_CL']:
     CFLAGS += [
         '-Wno-pointer-sign',
         '-Wno-shift-op-parentheses',
     ]
 
--- a/media/libvorbis/moz.build
+++ b/media/libvorbis/moz.build
@@ -50,9 +50,13 @@ if CONFIG['OS_ARCH'] == 'SunOS':
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'gkmedias'
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CC']:
-    CFLAGS += ['-Wno-uninitialized']
+    CFLAGS += [
+        '-Wno-uninitialized',
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
+    ]
--- a/media/libvpx/moz.build
+++ b/media/libvpx/moz.build
@@ -92,16 +92,18 @@ if CONFIG['CLANG_CL'] or not CONFIG['_MS
             if 'avx2' in f:
                 SOURCES[f].flags += ['-mavx2']
 
 # Suppress warnings in third-party code.
 if CONFIG['GNU_CC'] or CONFIG['CLANG_CL']:
     CFLAGS += [
         '-Wno-sign-compare',
         '-Wno-unused-function', # so many of these warnings; just ignore them
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
     ]
 if CONFIG['CLANG_CXX'] or CONFIG['CLANG_CL']:
     CFLAGS += [
         '-Wno-unreachable-code',
         '-Wno-unneeded-internal-declaration',
     ]
 
 ASFLAGS += CONFIG['VPX_ASFLAGS']
--- a/media/libyuv/libyuv.gyp
+++ b/media/libyuv/libyuv.gyp
@@ -44,17 +44,17 @@
       # Change type to 'shared_library' to build .so or .dll files.
       'type': 'static_library',
       'variables': {
         'optimize': 'max',  # enable O2 and ltcg.
       },
       # Allows libyuv.a redistributable library without external dependencies.
       # 'standalone_static_library': 1,
       'conditions': [
-       # Disable -Wunused-parameter
+        # Disable -Wunused-parameter
         ['clang == 1', {
           'cflags': [
             '-Wno-unused-parameter',
          ],
         }],
         ['build_neon != 0', {
           'defines': [
             'LIBYUV_NEON',
@@ -104,16 +104,17 @@
           ]
         }],
         ['build_with_mozilla == 1', {
           'defines': [
             'HAVE_JPEG'
           ],
           'cflags_mozilla': [
             '$(MOZ_JPEG_CFLAGS)',
+            '-Wno-error=redundant-decls',
           ],
         }],
         ['OS != "ios" and libyuv_disable_jpeg != 1 and build_with_mozilla != 1', {
           'defines': [
             'HAVE_JPEG'
           ],
           'conditions': [
             # Caveat system jpeg support may not support motion jpeg
--- a/media/libyuv/moz.build
+++ b/media/libyuv/moz.build
@@ -12,15 +12,22 @@ libyuv_non_unified_sources = [
     'source/convert.cc',
     'source/convert_from.cc',
     'source/mjpeg_decoder.cc',
     'source/rotate_argb.cc',
     'source/row_common.cc',
     'source/scale.cc',
     'source/scale_common.cc',
 ]
+
+CXXFLAGS += [
+    '-Wno-error=missing-prototypes',
+    '-Wno-error=redundant-decls',
+]
+
+
 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/build/moz.build
+++ b/media/mtransport/build/moz.build
@@ -28,9 +28,12 @@ EXPORTS.mtransport += [
 
 include('../common.build')
 
 # These files cannot be built in unified mode because of the redefinition of
 # getLogModule, UNIMPLEMENTED, nr_socket_long_term_violation_time,
 # nr_socket_short_term_violation_time.
 SOURCES += mtransport_cppsrcs
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
 FINAL_LIBRARY = 'xul'
--- a/media/mtransport/third_party/nICEr/nicer.gyp
+++ b/media/mtransport/third_party/nICEr/nicer.gyp
@@ -204,17 +204,18 @@
 		 ],
               }],
               ## Linux/Android
               [ '(OS == "linux") or (OS=="android")', {
                 'cflags_mozilla': [
                     '-Wall',
                     '-Wno-parentheses',
                     '-Wno-strict-prototypes',
-                    '-Wmissing-prototypes',
+                    '-Wno-error=missing-prototypes',
+                    '-Wno-error=redundant-decls',
                  ],
                  'defines' : [
                      'LINUX',
                      'HAVE_LIBM=1',
                      'HAVE_STRDUP=1',
                      'HAVE_STRLCPY=1',
                      'HAVE_SYS_TIME_H=1',
                      'HAVE_VFPRINTF=1',
--- a/media/mtransport/third_party/nrappkit/nrappkit.gyp
+++ b/media/mtransport/third_party/nrappkit/nrappkit.gyp
@@ -154,16 +154,17 @@
                 ],
               }],
               [ 'OS == "mac" or OS == "ios" or os_bsd == 1', {
                 'cflags_mozilla': [
                     '-Wall',
                     '-Wno-parentheses',
                     '-Wno-strict-prototypes',
                     '-Wmissing-prototypes',
+                    '-Wno-error=redundant-decls',
                  ],
                  'defines' : [
                      'HAVE_LIBM=1',
                      'HAVE_STRDUP=1',
                      'HAVE_STRLCPY=1',
                      'HAVE_SYS_TIME_H=1',
                      'HAVE_VFPRINTF=1',
                      'NEW_STDIO'
@@ -190,26 +191,27 @@
                      'NO_REG_RPC'
                  ],
 
 		 'include_dirs': [
 		     'src/port/win32/include'
 		 ],
 
 		 'sources': [
-              	      './src/port/win32/include/csi_platform.h',
+                      './src/port/win32/include/csi_platform.h',
 		 ],
               }],
               ## Linux
               [ '(OS == "linux") or (OS == "android")', {
                  'cflags_mozilla': [
                      '-Wall',
                      '-Wno-parentheses',
                      '-Wno-strict-prototypes',
                      '-Wmissing-prototypes',
+                     '-Wno-error=redundant-decls',
                  ],
                  'defines' : [
                      'LINUX',
                      'HAVE_LIBM=1',
                      'HAVE_STRDUP=1',
                      'HAVE_STRLCPY=1',
                      'HAVE_SYS_TIME_H=1',
                      'HAVE_VFPRINTF=1',
--- a/media/webrtc/moz.build
+++ b/media/webrtc/moz.build
@@ -119,8 +119,13 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk
             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
 
 if CONFIG['ENABLE_TESTS']:
     DIRS += ['signaling/fuzztest']
+
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=missing-prototypes']
+
--- a/media/webrtc/signaling/fuzztest/moz.build
+++ b/media/webrtc/signaling/fuzztest/moz.build
@@ -40,9 +40,13 @@ if CONFIG['OS_TARGET'] == 'Linux' or CON
       '/media/webrtc/signaling/src/sdp/sipcc/sdp_utils.c',
       '/media/webrtc/signaling/src/sdp/SipccSdp.cpp',
       '/media/webrtc/signaling/src/sdp/SipccSdpAttributeList.cpp',
       '/media/webrtc/signaling/src/sdp/SipccSdpMediaSection.cpp',
       '/media/webrtc/signaling/src/sdp/SipccSdpParser.cpp',
       'sdp_file_parser.cpp',
     ]
 
+    if CONFIG['GNU_CC']:
+         CFLAGS += ['-Wno-error=missing-prototypes']
+
     Program('sdp_file_parser')
+
--- a/media/webrtc/signaling/signaling.gyp
+++ b/media/webrtc/signaling/signaling.gyp
@@ -198,16 +198,17 @@
         'HAVE_UINT32_T=1',
         'HAVE_UINT64_T=1',
       ],
 
       'cflags_mozilla': [
         '$(NSPR_CFLAGS)',
         '$(NSS_CFLAGS)',
         '$(MOZ_PIXMAN_CFLAGS)',
+        '-Wno-error=missing-prototypes',
       ],
 
 
       #
       # Conditionals
       #
       'conditions': [
         # hack so I can change the include flow for SrtpFlow
--- a/media/webrtc/signaling/src/common/time_profiling/timecard.h
+++ b/media/webrtc/signaling/src/common/time_profiling/timecard.h
@@ -42,17 +42,17 @@ typedef struct Timecard {
   TimecardEntry *entries;
   PRTime start_time;
 } Timecard;
 
 /**
  * Creates a new Timecard structure for tracking events.
  */
 Timecard *
-create_timecard();
+create_timecard(void);
 
 /**
  * Frees the memory associated with a timecard. After returning, the
  * timecard pointed to by tc is no longer valid.
  */
 void
 destroy_timecard(Timecard *tc);
 
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp_attr.c
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_attr.c
@@ -530,17 +530,17 @@ static sdp_result_e sdp_verify_attr_fmtp
  *        single number or a range separated by a '-'.
  *        Example:  fmtp:101 1,3-15,20
  * Video codecs have annexes that can be listed in the following legal formats:
  * a) a=fmtp:34 param1=token;D;I;J;K=1;N=2;P=1,3
  * b) a=fmtp:34 param1=token;D;I;J;K=1;N=2;P=1,3;T
  * c) a=fmtp:34 param1=token;D;I;J
  *
  */
-sdp_result_e sdp_get_fmtp_tok(sdp_t *sdp_p,
+static sdp_result_e sdp_get_fmtp_tok(sdp_t *sdp_p,
                               const char** fmtp_ptr,
                               const char* fmtp_name,
                               char* buf,
                               size_t buf_size,
                               char** tok)
 {
     sdp_result_e result1 = SDP_SUCCESS;
 
@@ -553,17 +553,17 @@ sdp_result_e sdp_get_fmtp_tok(sdp_t *sdp
         }
     }
     *tok = buf;
     (*tok)++;
 
     return SDP_SUCCESS;
 }
 
-sdp_result_e sdp_get_fmtp_tok_val(sdp_t *sdp_p,
+static sdp_result_e sdp_get_fmtp_tok_val(sdp_t *sdp_p,
                               const char** fmtp_ptr,
                               const char* fmtp_name,
                               char* buf,
                               size_t buf_size,
                               char** tok,
                               unsigned long* strtoul_result,
                               unsigned long illegal_value,
                               unsigned long min_limit,
@@ -3427,17 +3427,17 @@ sdp_result_e sdp_build_attr_silencesupp 
 
 /*
  * sdp_parse_context_crypto_suite
  *
  * This routine parses the crypto suite pointed to by str, stores the crypto suite value into the
  * srtp context suite component of the LocalConnectionOptions pointed to by lco_node_ptr and stores
  * pointer to the next crypto parameter in tmp_ptr
  */
-tinybool sdp_parse_context_crypto_suite(char * str,  sdp_attr_t *attr_p, sdp_t *sdp_p) {
+static tinybool sdp_parse_context_crypto_suite(char * str,  sdp_attr_t *attr_p, sdp_t *sdp_p) {
       /*
        * Three crypto_suites are defined: (Notice no SPACE between "crypto:" and the <crypto-suite>
        * AES_CM_128_HMAC_SHA1_80
        * AES_CM_128_HMAC_SHA1_32
        * F8_128_HMAC_SHA1_80
        */
 
        int i;
@@ -4027,17 +4027,17 @@ sdp_result_e sdp_build_attr_rtcp_unicast
  *   buf    - pointer to MKI or lifetime string assumes string is null
  *            terminated.
  *   attr_p - pointer to attribute struct
  *
  * Outputs:
  *   Return TRUE all is good otherwise FALSE for error.
  */
 
-tinybool
+static tinybool
 store_sdescriptions_mki_or_lifetime (char *buf, sdp_attr_t *attr_p)
 {
 
     tinybool  result;
     uint16_t       mkiLen;
     char      mkiValue[SDP_SRTP_MAX_MKI_SIZE_BYTES];
 
     /* MKI has a colon */
@@ -4080,17 +4080,17 @@ store_sdescriptions_mki_or_lifetime (cha
  * mki-value     = 1*DIGIT
  * mki-length    = 1*3DIGIT   ; range 1..128.
  *
  * Inputs: str - pointer to beginning of key-params and assumes
  *               null terminated string.
  */
 
 
-tinybool
+static tinybool
 sdp_parse_sdescriptions_key_param (const char *str, sdp_attr_t *attr_p,
                                    sdp_t *sdp_p)
 {
     char            buf[SDP_MAX_STRING_LEN],
                     base64decodeData[SDP_MAX_STRING_LEN];
     const char      *ptr;
     sdp_result_e    result = SDP_SUCCESS;
     tinybool        keyFound = FALSE;
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp_attr_access.c
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_attr_access.c
@@ -1036,17 +1036,17 @@ sdp_direction_e sdp_get_media_direction 
 }
 
 /* Since there are four different attribute names which all have the same
  * qos parameters, all of these attributes are accessed through this same
  * set of APIs.  To distinguish between specific attributes, the application
  * must also pass the attribute type.  The attribute must be one of:
  * SDP_ATTR_QOS, SDP_ATTR_SECURE, SDP_ATTR_X_PC_QOS, and SDP_ATTR_X_QOS.
  */
-tinybool sdp_validate_qos_attr (sdp_attr_e qos_attr)
+static tinybool sdp_validate_qos_attr (sdp_attr_e qos_attr)
 {
     if ((qos_attr == SDP_ATTR_QOS) ||
         (qos_attr == SDP_ATTR_SECURE) ||
         (qos_attr == SDP_ATTR_X_PC_QOS) ||
         (qos_attr == SDP_ATTR_X_QOS) ||
         (qos_attr == SDP_ATTR_CURR) ||
         (qos_attr == SDP_ATTR_DES) ||
         (qos_attr == SDP_ATTR_CONF)){
@@ -5927,17 +5927,17 @@ sdp_attr_get_srtp_crypto_selection_flags
  * Parameters:  sdp_p        The SDP handle returned by sdp_init_description.
  *              level        The level to check for the attribute.
  *              payload_type The payload to get the attribute for
  *              fb_type      The feedback type to look for.
  *              inst_num     The attribute instance number to check.
  * Returns:     Pointer to the attribute, or NULL if not found.
  */
 
-sdp_attr_t *
+static sdp_attr_t *
 sdp_find_rtcp_fb_attr (sdp_t *sdp_p,
                        uint16_t level,
                        uint16_t payload_type,
                        sdp_rtcp_fb_type_e fb_type,
                        uint16_t inst_num)
 {
     uint16_t          attr_count=0;
     sdp_mca_t   *mca_p;
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_main.c
@@ -902,17 +902,17 @@ void sdp_set_string_debug (sdp_t *sdp_p,
 
 
 /* Function:    sdp_validate_sdp
  * Description: Validate an SDP structure.
  * Parameters:  sdp_p    The SDP handle of the struct to validate.
  * Returns:     A result value indicating if the validation was successful.
  *              If not, what type of error was encountered.
  */
-sdp_result_e sdp_validate_sdp (sdp_t *sdp_p)
+static sdp_result_e sdp_validate_sdp (sdp_t *sdp_p)
 {
     int i;
     uint16_t num_media_levels;
 
     /* Need to validate c= info is specified at session level or
      * at all m= levels.
      */
     if (sdp_connection_valid((void *)sdp_p, SDP_SESSION_LEVEL) == FALSE) {
--- a/media/webrtc/signaling/src/sdp/sipcc/sdp_private.h
+++ b/media/webrtc/signaling/src/sdp/sipcc/sdp_private.h
@@ -244,18 +244,16 @@ extern sdp_result_e sdp_parse_attr_long_
                                      sdp_attr_t *attr_p, const char *ptr);
 extern sdp_result_e sdp_build_attr_long_line(sdp_t *sdp_p,
                                      sdp_attr_t *attr_p, flex_string *fs);
 
 /* sdp_attr_access.c */
 extern void sdp_free_attr(sdp_attr_t *attr_p);
 extern sdp_result_e sdp_find_attr_list(sdp_t *sdp_p, uint16_t level, uint8_t cap_num,
                                        sdp_attr_t **attr_p, char *fname);
-extern sdp_attr_t *sdp_find_attr(sdp_t *sdp_p, uint16_t level, uint8_t cap_num,
-                                 sdp_attr_e attr_type, uint16_t inst_num);
 extern sdp_attr_t *sdp_find_capability(sdp_t *sdp_p, uint16_t level, uint8_t cap_num);
 
 /* sdp_main.c */
 extern const char *sdp_get_attr_name(sdp_attr_e attr_type);
 extern const char *sdp_get_media_name(sdp_media_e media_type);
 extern const char *sdp_get_network_name(sdp_nettype_e network_type);
 extern const char *sdp_get_address_name(sdp_addrtype_e addr_type);
 extern const char *sdp_get_transport_name(sdp_transport_e transport_type);
@@ -313,18 +311,16 @@ extern sdp_result_e sdp_build_repeat_tim
 extern sdp_result_e sdp_parse_timezone_adj(sdp_t *sdp_p, uint16_t token,
                                            const char *ptr);
 extern sdp_result_e sdp_build_timezone_adj(sdp_t *sdp_p, uint16_t token, flex_string *fs);
 extern sdp_result_e sdp_parse_encryption(sdp_t *sdp_p, uint16_t token,
                                          const char *ptr);
 extern sdp_result_e sdp_build_encryption(sdp_t *sdp_p, uint16_t token, flex_string *fs);
 extern sdp_result_e sdp_parse_media(sdp_t *sdp_p, uint16_t token, const char *ptr);
 extern sdp_result_e sdp_build_media(sdp_t *sdp_p, uint16_t token, flex_string *fs);
-extern sdp_result_e sdp_parse_attribute(sdp_t *sdp_p, uint16_t token,
-                                        const char *ptr);
 extern sdp_result_e sdp_build_attribute(sdp_t *sdp_p, uint16_t token, flex_string *fs);
 
 extern void sdp_parse_payload_types(sdp_t *sdp_p, sdp_mca_t *mca_p,
                                      const char *ptr);
 extern sdp_result_e sdp_parse_multiple_profile_payload_types(sdp_t *sdp_p,
                                                sdp_mca_t *mca_p,
                                                const char *ptr);
 extern sdp_result_e
@@ -356,9 +352,12 @@ tinybool verify_sdescriptions_mki(char *
 extern
 tinybool verify_sdescriptions_lifetime(char *buf);
 
 /* sdp_services_xxx.c */
 extern void sdp_dump_buffer(char *_ptr, int _size_bytes);
 
 tinybool sdp_checkrange(sdp_t *sdp, char *num, ulong* lval);
 
+sdp_result_e sdp_parse_attr_srtp (sdp_t *sdp_p, sdp_attr_t *attr_p,
+                     const char *ptr, sdp_attr_e vtype);
+
 #endif /* _SDP_PRIVATE_H_ */
--- a/media/webrtc/trunk/webrtc/common_audio/common_audio.gyp
+++ b/media/webrtc/trunk/webrtc/common_audio/common_audio.gyp
@@ -113,16 +113,19 @@
         'vad/vad_sp.h',
         'wav_header.cc',
         'wav_header.h',
         'wav_file.cc',
         'wav_file.h',
         'window_generator.cc',
         'window_generator.h',
       ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+      ],
       'conditions': [
         ['rtc_use_openmax_dl==1', {
           'sources': [
             'real_fourier_openmax.cc',
             'real_fourier_openmax.h',
           ],
           'defines': ['RTC_USE_OPENMAX_DL',],
           'conditions': [
--- a/media/webrtc/trunk/webrtc/common_video/common_video.gyp
+++ b/media/webrtc/trunk/webrtc/common_video/common_video.gyp
@@ -46,11 +46,15 @@
         'i420_buffer_pool.cc',
         'i420_video_frame.cc',
         'libyuv/include/webrtc_libyuv.h',
         'libyuv/include/scaler.h',
         'libyuv/webrtc_libyuv.cc',
         'libyuv/scaler.cc',
         'video_frame_buffer.cc',
       ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+           '-Wno-error=redundant-decls',
+      ],
     },
   ],  # targets
 }
--- a/media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac/isac.gypi
+++ b/media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac/isac.gypi
@@ -76,16 +76,20 @@
         'main/source/pitch_estimator.h',
         'main/source/pitch_gain_tables.h',
         'main/source/pitch_lag_tables.h',
         'main/source/settings.h',
         'main/source/spectrum_ar_model_tables.h',
         'main/source/structs.h',
         'main/source/os_specific_inline.h',
      ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+           '-Wno-error=redundant-decls',
+      ],
      'conditions': [
        ['OS=="linux"', {
          'link_settings': {
            'libraries': ['-lm',],
          },
        }],
      ],
     },
--- a/media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac/isacfix.gypi
+++ b/media/webrtc/trunk/webrtc/modules/audio_coding/codecs/isac/isacfix.gypi
@@ -69,16 +69,20 @@
         'fix/source/lpc_tables.h',
         'fix/source/pitch_estimator.h',
         'fix/source/pitch_gain_tables.h',
         'fix/source/pitch_lag_tables.h',
         'fix/source/settings.h',
         'fix/source/spectrum_ar_model_tables.h',
         'fix/source/structs.h',
       ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+           '-Wno-error=redundant-decls',
+      ],
       'conditions': [
         ['OS!="win"', {
           'defines': [
             'WEBRTC_LINUX',
           ],
         }],
         ['target_arch=="arm" and arm_version>=7', {
           'sources': [
--- a/media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing.gypi
+++ b/media/webrtc/trunk/webrtc/modules/audio_processing/audio_processing.gypi
@@ -127,16 +127,19 @@
         'utility/delay_estimator.c',
         'utility/delay_estimator.h',
         'utility/delay_estimator_internal.h',
         'utility/delay_estimator_wrapper.c',
         'utility/delay_estimator_wrapper.h',
         'voice_detection_impl.cc',
         'voice_detection_impl.h',
       ],
+      'cflags_mozilla': [
+        '-Wno-error=missing-prototypes'
+      ],
       'conditions': [
         ['aec_debug_dump==1', {
           'defines': ['WEBRTC_AEC_DEBUG_DUMP',],
         }],
         ['aec_untrusted_delay_for_testing==1', {
           'defines': ['WEBRTC_UNTRUSTED_DELAY',],
         }],
         ['agc_debug_dump==1', {
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -48,8 +48,11 @@ if CONFIG['MOZ_GLUE_IN_PROGRAM']:
 # Keep jemalloc separated when mozglue is statically linked
 if CONFIG['MOZ_MEMORY'] and (CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android') or
                              CONFIG['MOZ_SYSTEM_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 += ['-Wno-error=redundant-decls']
--- a/memory/build/replace_malloc.c
+++ b/memory/build/replace_malloc.c
@@ -127,25 +127,27 @@ init()
 #endif
   // Set this *before* calling replace_init, otherwise if replace_init calls
   // malloc() we'll get an infinite loop.
   replace_malloc_initialized = 1;
   if (replace_init)
     replace_init(&malloc_table);
 }
 
+#if MALLOC_FUNCS & MALLOC_FUNCS_BRIDGE
 MFBT_API struct ReplaceMallocBridge*
 get_bridge(void)
 {
   if (MOZ_UNLIKELY(!replace_malloc_initialized))
     init();
   if (MOZ_LIKELY(!replace_get_bridge))
     return NULL;
   return replace_get_bridge();
 }
+#endif
 
 void*
 malloc_impl(size_t size)
 {
   if (MOZ_UNLIKELY(!replace_malloc_initialized))
     init();
   if (MOZ_LIKELY(!replace_malloc))
     return je_malloc(size);
--- a/memory/mozalloc/moz.build
+++ b/memory/mozalloc/moz.build
@@ -50,8 +50,12 @@ if CONFIG['_MSC_VER']:
     DIRS += ['staticruntime']
 
 LOCAL_INCLUDES += [
     '!/xpcom',
     '/memory/build',
 ]
 
 DIST_INSTALL = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
--- a/memory/mozjemalloc/moz.build
+++ b/memory/mozjemalloc/moz.build
@@ -33,12 +33,15 @@ DEFINES['MOZ_JEMALLOC_IMPL'] = True
 if CONFIG['OS_TARGET'] == 'Linux':
     NO_PGO = True
 
 LOCAL_INCLUDES += [
     '/memory/build',
 ]
 
 if CONFIG['GNU_CC']:
-    CFLAGS += ['-Wno-unused'] # too many annoying warnings from mfbt/ headers
+    CFLAGS += [
+        '-Wno-unused',
+        '-Wno-error=missing-prototypes',
+    ] # too many annoying warnings from mfbt/ headers
 
 if CONFIG['_MSC_VER']:
     CFLAGS += ['-wd4273'] # inconsistent dll linkage (bug 558163)
--- a/memory/replace/dummy/moz.build
+++ b/memory/replace/dummy/moz.build
@@ -7,8 +7,12 @@ DIST_INSTALL = False
 
 SOURCES += [
     'dummy_replace_malloc.c',
 ]
 
 SharedLibrary('dummy_replace_malloc')
 
 DISABLE_STL_WRAPPING = True
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wno-error=missing-prototypes']
+
--- a/memory/replace/jemalloc/moz.build
+++ b/memory/replace/jemalloc/moz.build
@@ -24,8 +24,14 @@ DEFINES['MOZ_REPLACE_JEMALLOC'] = True
 
 LOCAL_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 += [
+        '-Wno-error=missing-prototypes',
+    ]
+
--- a/memory/replace/logalloc/replay/moz.build
+++ b/memory/replace/logalloc/replay/moz.build
@@ -17,8 +17,12 @@ LOCAL_INCLUDES += [
 ]
 
 # Link replace-malloc and the default allocator.
 USE_LIBS += [
     'memory',
 ]
 
 DISABLE_STL_WRAPPING = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
--- a/memory/volatile/VolatileBufferFallback.cpp
+++ b/memory/volatile/VolatileBufferFallback.cpp
@@ -1,19 +1,21 @@
 /* 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/. */
 
 #include "VolatileBuffer.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/mozalloc.h"
 
+/*
 #ifdef MOZ_MEMORY
 int posix_memalign(void** memptr, size_t alignment, size_t size);
 #endif
+*/
 
 namespace mozilla {
 
 VolatileBuffer::VolatileBuffer()
   : mMutex("VolatileBuffer")
   , mBuf(nullptr)
   , mSize(0)
   , mLockCount(0)
--- a/mfbt/decimal/moz-decimal-utils.h
+++ b/mfbt/decimal/moz-decimal-utils.h
@@ -37,44 +37,52 @@
 
 #define WTF_MAKE_NONCOPYABLE(ClassName) \
   private: \
     ClassName(const ClassName&) = delete; \
     void operator=(const ClassName&) = delete;
 
 typedef std::string String;
 
+double mozToDouble(const String &aStr, bool *valid);
+
 double mozToDouble(const String &aStr, bool *valid) {
   double_conversion::StringToDoubleConverter converter(
     double_conversion::StringToDoubleConverter::NO_FLAGS,
     mozilla::UnspecifiedNaN<double>(), mozilla::UnspecifiedNaN<double>(), nullptr, nullptr);
   const char* str = aStr.c_str();
   int length = mozilla::AssertedCast<int>(strlen(str));
   int processed_char_count; // unused - NO_FLAGS requires the whole string to parse
   double result = converter.StringToDouble(str, length, &processed_char_count);
   *valid = mozilla::IsFinite(result);
   return result;
 }
 
+String mozToString(double aNum);
+
 String mozToString(double aNum) {
   char buffer[64];
   int buffer_length = mozilla::ArrayLength(buffer);
   const double_conversion::DoubleToStringConverter& converter =
     double_conversion::DoubleToStringConverter::EcmaScriptConverter();
   double_conversion::StringBuilder builder(buffer, buffer_length);
   converter.ToShortest(aNum, &builder);
   return String(builder.Finalize());
 }
 
+String mozToString(int64_t aNum);
+
 String mozToString(int64_t aNum) {
   std::ostringstream o;
   o << std::setprecision(std::numeric_limits<int64_t>::digits10) << aNum;
   return o.str();
 }
 
+String mozToString(uint64_t aNum);
+
 String mozToString(uint64_t aNum) {
   std::ostringstream o;
   o << std::setprecision(std::numeric_limits<uint64_t>::digits10) << aNum;
   return o.str();
 }
 
 namespace moz_decimal_utils {
 
--- a/mfbt/lz4.h
+++ b/mfbt/lz4.h
@@ -227,20 +227,18 @@ int LZ4_saveDict (void* LZ4_stream, char
  * important : set this structure content to zero before first use !
  */
 typedef struct { unsigned int table[LZ4_STREAMDECODESIZE_U32]; } LZ4_streamDecode_t;
 
 /*
  * If you prefer dynamic allocation methods,
  * LZ4_createStreamDecode()
  * provides a pointer (void*) towards an initialized LZ4_streamDecode_t structure.
- * LZ4_free just frees it.
  */
 void* LZ4_createStreamDecode();
-int   LZ4_free (void* LZ4_stream);   /* yes, it's the same one as for compression */
 
 /*
 *_continue() :
     These decoding functions allow decompression of multiple blocks in "streaming" mode.
     Previously decoded blocks must still be available at the memory position where they were decoded.
     If it's not possible, save the relevant part of decoded data into a safe buffer,
     and indicate where it stands using LZ4_setDictDecode()
 */
--- a/modules/brotli/moz.build
+++ b/modules/brotli/moz.build
@@ -22,8 +22,13 @@ UNIFIED_SOURCES += [
 ]
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 CFLAGS += ['-DBROTLI_BUILD_PORTABLE']
 
 Library('brotli')
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wno-error=redundant-decls']
+
+
--- a/modules/libjar/zipwriter/moz.build
+++ b/modules/libjar/zipwriter/moz.build
@@ -17,8 +17,12 @@ UNIFIED_SOURCES += [
     'nsZipDataStream.cpp',
     'nsZipHeader.cpp',
     'nsZipWriter.cpp',
     'StreamFunctions.cpp',
     'ZipWriterModule.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=redundant-decls']
+
--- a/modules/libmar/sign/mar_sign.c
+++ b/modules/libmar/sign/mar_sign.c
@@ -46,17 +46,17 @@ NSSInitCryptoContext(const char *NSSConf
 
 /** 
  * Obtains a signing context.
  *
  * @param  ctx A pointer to the signing context to fill
  * @return 0 on success
  *         -1 on error
 */
-int
+static int
 NSSSignBegin(const char *certName, 
              SGNContext **ctx, 
              SECKEYPrivateKey **privKey, 
              CERTCertificate **cert,
              uint32_t *signatureLength) 
 {
   secuPWData pwdata = { PW_NONE, 0 };
   if (!certName || !ctx || !privKey || !cert || !signatureLength) {
@@ -118,17 +118,17 @@ NSSSignBegin(const char *certName,
  * @param  ctxs     Pointer to the first element in an array of signature
  *                  contexts to update.
  * @param  ctxCount The number of signature contexts pointed to by ctxs
  * @param  err    The name of what is being written to in case of error.
  * @return  0 on success
  *         -2 on write error
  *         -3 on signature update error
 */
-int
+static int
 WriteAndUpdateSignatures(FILE *fpDest, void *buffer,
                          uint32_t size, SGNContext **ctxs,
                          uint32_t ctxCount,
                          const char *err)
 {
   uint32_t k;
   if (!size) { 
     return 0;
@@ -151,17 +151,17 @@ WriteAndUpdateSignatures(FILE *fpDest, v
 /** 
  * Adjusts each entry's content offset in the the passed in index by the 
  * specified amount.
  *
  * @param indexBuf     A buffer containing the MAR index
  * @param indexLength  The length of the MAR index
  * @param offsetAmount The amount to adjust each index entry by
 */
-void
+static void
 AdjustIndexContentOffsets(char *indexBuf, uint32_t indexLength, uint32_t offsetAmount) 
 {
   uint32_t *offsetToContent;
   char *indexBufLoc = indexBuf;
 
   /* Consume the index and adjust each index by the specified amount */
   while (indexBufLoc != (indexBuf + indexLength)) {
     /* Adjust the offset */
@@ -186,17 +186,17 @@ AdjustIndexContentOffsets(char *indexBuf
  *                  contexts to update.
  * @param  ctxCount The number of signature contexts pointed to by ctxs
  * @param  err    The name of what is being written to in case of error.
  * @return  0 on success
  *         -1 on read error
  *         -2 on write error
  *         -3 on signature update error
 */
-int
+static int
 ReadWriteAndUpdateSignatures(FILE *fpSrc, FILE *fpDest, void *buffer,
                              uint32_t size, SGNContext **ctxs,
                              uint32_t ctxCount,
                              const char *err)
 {
   if (!size) { 
     return 0;
   }
@@ -217,17 +217,17 @@ ReadWriteAndUpdateSignatures(FILE *fpSrc
  * @param  fpDest The file pointer to write to.
  * @param  buffer The buffer to write.
  * @param  size   The size of the buffer to write.
  * @param  err    The name of what is being written to in case of error.
  * @return  0 on success
  *         -1 on read error
  *         -2 on write error
 */
-int
+static int
 ReadAndWrite(FILE *fpSrc, FILE *fpDest, void *buffer, 
              uint32_t size, const char *err) 
 {
   if (!size) { 
     return 0;
   }
 
   if (fread(buffer, size, 1, fpSrc) != 1) {
--- a/modules/libmar/sign/nss_secutil.c
+++ b/modules/libmar/sign/nss_secutil.c
@@ -54,17 +54,17 @@ static char * quiet_fgets (char *buf, in
     if (!c || c == '\n' || c == '\r')
       break;
   }
 
   return buf;
 }
 #endif
 
-char *
+static char *
 GetPasswordString(void *arg, char *prompt)
 {
   FILE *input = stdin;
   char phrase[200] = {'\0'};
   int isInputTerminal = isatty(fileno(stdin));
 
 #ifndef _WINDOWS
   if (isInputTerminal) {
@@ -99,17 +99,17 @@ GetPasswordString(void *arg, char *promp
   /* Strip off the newlines if present */
   if (phrase[PORT_Strlen(phrase)-1] == '\n' || 
       phrase[PORT_Strlen(phrase)-1] == '\r') {
     phrase[PORT_Strlen(phrase)-1] = 0;
   }
   return (char*) PORT_Strdup(phrase);
 }
 
-char *
+static char *
 SECU_FilePasswd(PK11SlotInfo *slot, PRBool retry, void *arg)
 {
   char* phrases, *phrase;
   PRFileDesc *fd;
   int32_t nb;
   char *pwFile = arg;
   int i;
   const long maxPwdFileSize = 4096;
--- a/modules/libmar/sign/nss_secutil.h
+++ b/modules/libmar/sign/nss_secutil.h
@@ -33,9 +33,17 @@ typedef struct {
 static char * quiet_fgets (char *buf, int length, FILE *input);
 #else
 #define QUIET_FGETS fgets
 #endif
 
 char *
 SECU_GetModulePassword(PK11SlotInfo *slot, PRBool retry, void *arg);
 
+int NSSInitCryptoContext(const char *NSSConfigDir);
+
+int mar_repackage_and_sign(const char *NSSConfigDir,
+                       const char * const *certNames,
+                       uint32_t certCount,
+                       const char *src,
+                       const char *dest);
+
 #endif
--- a/modules/libmar/src/mar_read.c
+++ b/modules/libmar/src/mar_read.c
@@ -228,17 +228,17 @@ void mar_close(MarFile *mar) {
  * @param offsetAdditionalBlocks Optional out parameter for the offset to the 
  *                               first additional block. Value is only valid if
  *                               hasAdditionalBlocks is not equal to 0.
  * @param numAdditionalBlocks    Optional out parameter for the number of
  *                               additional blocks.  Value is only valid if
  *                               hasAdditionalBlocks is not equal to 0.
  * @return 0 on success and non-zero on failure.
  */
-int get_mar_file_info_fp(FILE *fp, 
+static int get_mar_file_info_fp(FILE *fp, 
                          int *hasSignatureBlock,
                          uint32_t *numSignatures,
                          int *hasAdditionalBlocks,
                          uint32_t *offsetAdditionalBlocks,
                          uint32_t *numAdditionalBlocks)
 {
   uint32_t offsetToIndex, offsetToContent, signatureCount, signatureLen, i;
   
--- a/modules/libmar/verify/mar_verify.c
+++ b/modules/libmar/verify/mar_verify.c
@@ -79,17 +79,17 @@ int mar_verify_signatures_for_fp(FILE *f
  *                at least of this size.
  * @param  ctxs   Pointer to the first element in an array of verify context.
  * @param  count  The number of elements in ctxs
  * @param  err    The name of what is being written to in case of error.
  * @return  0 on success
  *         -1 on read error
  *         -2 on verify update error
 */
-int
+static int
 ReadAndUpdateVerifyContext(FILE *fp, 
                            void *buffer,
                            uint32_t size, 
                            CryptoX_SignatureHandle *ctxs,
                            uint32_t count,
                            const char *err) 
 {
   uint32_t k;
--- a/modules/woff2/moz.build
+++ b/modules/woff2/moz.build
@@ -16,8 +16,11 @@ UNIFIED_SOURCES += [
     'src/woff2_dec.cc',
     'src/woff2_out.cc',
 ]
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 Library('woff2')
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=unused-variable']
--- a/modules/zlib/src/moz.build
+++ b/modules/zlib/src/moz.build
@@ -29,8 +29,11 @@ SOURCES += [
     'infback.c',
     'inffast.c',
     'inflate.c',
     'inftrees.c',
     'trees.c',
     'uncompr.c',
     'zutil.c',
 ]
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wno-missing-prototypes']
--- a/mozglue/misc/moz.build
+++ b/mozglue/misc/moz.build
@@ -39,8 +39,12 @@ elif CONFIG['COMPILE_ENVIRONMENT']:
 # the conditions for GeckoStackWalk to work correctly.
 # We exclude this file from other build configurations so that if somebody adds a
 # new usage of NS_StackWalk it will cause a link error, which is better than having
 # GeckoStackWalk silently return garbage at runtime.
 if CONFIG['MOZ_STACKWALKING']:
     SOURCES += [
         'StackWalk.cpp',
     ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=missing-prototypes']
+
--- a/netwerk/base/LoadInfo.h
+++ b/netwerk/base/LoadInfo.h
@@ -8,39 +8,32 @@
 #define mozilla_LoadInfo_h
 
 #include "nsIContentPolicy.h"
 #include "nsILoadInfo.h"
 #include "nsIPrincipal.h"
 #include "nsIWeakReferenceUtils.h" // for nsWeakPtr
 #include "nsIURI.h"
 #include "nsTArray.h"
-
 #include "mozilla/BasePrincipal.h"
+#include "mozilla/ipc/BackgroundUtils.h"
 
 class nsINode;
 class nsPIDOMWindowOuter;
 
 namespace mozilla {
 
 namespace dom {
 class XMLHttpRequestMainThread;
 }
 
 namespace net {
 class OptionalLoadInfoArgs;
 } // namespace net
 
-namespace ipc {
-// we have to forward declare that function so we can use it as a friend.
-nsresult
-LoadInfoArgsToLoadInfo(const mozilla::net::OptionalLoadInfoArgs& aLoadInfoArgs,
-                       nsILoadInfo** outLoadInfo);
-} // namespace ipc
-
 namespace net {
 
 /**
  * Class that provides an nsILoadInfo implementation.
  *
  * Note that there is no reason why this class should be MOZ_EXPORT, but
  * Thunderbird relies on some insane hacks which require this, so we'll leave it
  * as is for now, but hopefully we'll be able to remove the MOZ_EXPORT keyword
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -312,9 +312,12 @@ LOCAL_INCLUDES += [
 
 if 'rtsp' in CONFIG['NECKO_PROTOCOLS']:
     LOCAL_INCLUDES += [
         '/netwerk/protocol/rtsp/controller',
         '/netwerk/protocol/rtsp/rtsp',
     ]
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=shadow',
+    ]
--- a/netwerk/dns/moz.build
+++ b/netwerk/dns/moz.build
@@ -70,9 +70,16 @@ if CONFIG['ENABLE_INTL_API']:
     DEFINES['IDNA2008'] = True
     USE_LIBS += ['icu']
 else:
     UNIFIED_SOURCES += [
         'nameprep.c',
     ]
 
 if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
+    CXXFLAGS += [
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=shadow',
+    ]
+
+if CONFIG['GNU_CCC']:
+    CFLAGS += ['-Wno-error=missing-prototypes']
+
--- a/netwerk/dns/nameprep.c
+++ b/netwerk/dns/nameprep.c
@@ -307,41 +307,42 @@ idn_nameprep_isvalidbidi(idn_nameprep_t 
 			return (idn_success);
 		}
 	}
 
 	*found = NULL;
 	return (idn_success);
 }
 
-idn_result_t
+/*idn_result_t
 idn_nameprep_createproc(const char *parameter, void **handlep) {
 	return idn_nameprep_create(parameter, (idn_nameprep_t *)handlep);
 }
 
-void
+static void
 idn_nameprep_destroyproc(void *handle) {
 	idn_nameprep_destroy((idn_nameprep_t)handle);
 }
 
-idn_result_t
+static idn_result_t
 idn_nameprep_mapproc(void *handle, const uint32_t *from,
 		      uint32_t *to, size_t tolen) {
 	return idn_nameprep_map((idn_nameprep_t)handle, from, to, tolen);
 }
 
-idn_result_t
+static idn_result_t
 idn_nameprep_prohibitproc(void *handle, const uint32_t *str,
 			   const uint32_t **found) {
 	return idn_nameprep_isprohibited((idn_nameprep_t)handle, str, found);
 }
 
-idn_result_t
+static idn_result_t
 idn_nameprep_unassignedproc(void *handle, const uint32_t *str,
 			     const uint32_t **found) {
 	return idn_nameprep_isunassigned((idn_nameprep_t)handle, str, found);
 }
 
-idn_result_t
+static idn_result_t
 idn_nameprep_bidiproc(void *handle, const uint32_t *str,
 		      const uint32_t **found) {
 	return idn_nameprep_isvalidbidi((idn_nameprep_t)handle, str, found);
 }
+*/
--- a/netwerk/sctp/src/moz.build
+++ b/netwerk/sctp/src/moz.build
@@ -90,8 +90,13 @@ if CONFIG['OS_TARGET'] == 'OpenBSD':
 
 if CONFIG['OS_TARGET'] == 'DragonFly':
     DEFINES['__DragonFly__'] = False
 
 NO_PGO = True # Don't PGO
 
 if CONFIG['GNU_CC']:
     CFLAGS += ['-std=gnu99']
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
+    ]
+
--- a/netwerk/srtp/src/moz.build
+++ b/netwerk/srtp/src/moz.build
@@ -62,8 +62,12 @@ if  CONFIG['CPU_ARCH'] in ('x86', 'x86_6
     DEFINES['HAVE_X86'] = True
 
 if CONFIG['OS_TARGET'] == 'WINNT':
     DEFINES['HAVE_WINSOCK2_H'] = True
     DEFINES['inline'] = '__inline'
 
 if CONFIG['GNU_CC']:
     CFLAGS += ['-std=gnu99']
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
+    ]
--- a/netwerk/standalone/moz.build
+++ b/netwerk/standalone/moz.build
@@ -46,9 +46,17 @@ LOCAL_INCLUDES = [
 
 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']
+    CXXFLAGS += [
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=shadow',
+    ]
+
+if CONFIG['GNU_CCC']:
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+    ]
--- a/nsprpub/pr/include/md/_unixos.h
+++ b/nsprpub/pr/include/md/_unixos.h
@@ -233,17 +233,16 @@ extern PRStatus _MD_WaitUnixProcess(stru
     PRInt32 *exitCode);
 
 #define _MD_KILL_PROCESS _MD_KillUnixProcess
 extern PRStatus _MD_KillUnixProcess(struct PRProcess *process);
 
 /************************************************************************/
 
 extern void _MD_EnableClockInterrupts(void);
-extern void _MD_DisableClockInterrupts(void);
 
 #define _MD_START_INTERRUPTS			_MD_StartInterrupts
 #define _MD_STOP_INTERRUPTS				_MD_StopInterrupts
 #define _MD_DISABLE_CLOCK_INTERRUPTS	_MD_DisableClockInterrupts
 #define _MD_ENABLE_CLOCK_INTERRUPTS		_MD_EnableClockInterrupts
 #define _MD_BLOCK_CLOCK_INTERRUPTS		_MD_BlockClockInterrupts
 #define _MD_UNBLOCK_CLOCK_INTERRUPTS	_MD_UnblockClockInterrupts
 
--- a/parser/expat/lib/moz.build
+++ b/parser/expat/lib/moz.build
@@ -13,8 +13,14 @@ SOURCES += [
     'xmlparse.c',
     'xmlrole.c',
     'xmltok.c',
 ]
 
 FINAL_LIBRARY = 'gkmedias'
 
 DEFINES['HAVE_EXPAT_CONFIG_H'] = True
+
+if CONFIG['GNU_CC']:
+    CFLAGS += [
+        '-Wno-missing-prototypes',
+    ]
+
--- a/security/certverifier/NSSCertDBTrustDomain.h
+++ b/security/certverifier/NSSCertDBTrustDomain.h
@@ -33,18 +33,16 @@ enum class NetscapeStepUpPolicy : uint32
   AlwaysMatch = 0,
   MatchBefore23August2016 = 1,
   MatchBefore23August2015 = 2,
   NeverMatch = 3,
 };
 
 SECStatus InitializeNSS(const char* dir, bool readOnly, bool loadPKCS11Modules);
 
-void DisableMD5();
-
 extern const char BUILTIN_ROOTS_MODULE_DEFAULT_NAME[];
 
 // The dir parameter is the path to the directory containing the NSS builtin
 // roots module. Usually this is the same as the path to the other NSS shared
 // libraries. If it is null then the (library) path will be searched.
 //
 // The modNameUTF8 parameter should usually be
 // BUILTIN_ROOTS_MODULE_DEFAULT_NAME.
--- a/security/manager/ssl/PublicSSL.h
+++ b/security/manager/ssl/PublicSSL.h
@@ -8,18 +8,18 @@
 #define mozilla_SSL_h
 
 namespace mozilla {
 
 void ClearPrivateSSLState();
 
 namespace psm {
 
-void InitializeSSLServerCertVerificationThreads();
-void StopSSLServerCertVerificationThreads();
-void DisableMD5();
-nsresult InitializeCipherSuite();
+void InitializeSSLServerCertVerificationThreads(void);
+void StopSSLServerCertVerificationThreads(void);
+void DisableMD5(void);
+nsresult InitializeCipherSuite(void);
 
 } //namespace psm
 } // namespace mozilla
 
 #endif
 
--- a/security/manager/ssl/SSLServerCertVerification.cpp
+++ b/security/manager/ssl/SSLServerCertVerification.cpp
@@ -126,16 +126,17 @@
 #include "nsNSSCertificate.h"
 #include "nsNSSComponent.h"
 #include "nsNSSIOLayer.h"
 #include "nsNSSShutDown.h"
 #include "nsSSLStatus.h"
 #include "nsServiceManagerUtils.h"
 #include "nsURLHelper.h"
 #include "nsXPCOMCIDInternal.h"
+#include "PublicSSL.h"
 #include "pkix/pkix.h"
 #include "pkix/pkixnss.h"
 #include "secerr.h"
 #include "secoidt.h"
 #include "secport.h"
 #include "ssl.h"
 #include "sslerr.h"
 
--- a/security/nss/coreconf/config.gypi
+++ b/security/nss/coreconf/config.gypi
@@ -255,16 +255,17 @@
               'XP_UNIX',
               '_REENTRANT',
             ],
             'cflags': [
               '-fPIC',
               '-pipe',
               '-ffunction-sections',
               '-fdata-sections',
+              '-Wno-error=missing-prototypes',
             ],
             'cflags_cc': [
               '-std=c++0x',
             ],
             'conditions': [
               [ 'target_arch=="ia32"', {
                 'cflags': ['-m32'],
                 'ldflags': ['-m32'],
--- a/security/nss/lib/base/base.gyp
+++ b/security/nss/lib/base/base.gyp
@@ -16,17 +16,21 @@
         'hash.c',
         'hashops.c',
         'item.c',
         'libc.c',
         'list.c',
         'tracker.c',
         'utf8.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=redundant-decls',
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ]
     }
   ],
   'variables': {
     'module': 'nss'
   }
-}
\ No newline at end of file
+}
--- a/security/nss/lib/certdb/certdb.gyp
+++ b/security/nss/lib/certdb/certdb.gyp
@@ -18,17 +18,21 @@
         'genname.c',
         'polcyxtn.c',
         'secname.c',
         'stanpcertdb.c',
         'xauthkid.c',
         'xbsconst.c',
         'xconst.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=redundant-decls',
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ]
     }
   ],
   'variables': {
     'module': 'nss'
   }
-}
\ No newline at end of file
+}
--- a/security/nss/lib/certhigh/certhigh.gyp
+++ b/security/nss/lib/certhigh/certhigh.gyp
@@ -15,17 +15,21 @@
         'certreq.c',
         'certvfy.c',
         'certvfypkix.c',
         'crlv2.c',
         'ocsp.c',
         'ocspsig.c',
         'xcrldist.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=redundant-decls',
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ]
     }
   ],
   'variables': {
     'module': 'nss'
   }
-}
\ No newline at end of file
+}
--- a/security/nss/lib/crmf/crmf.gyp
+++ b/security/nss/lib/crmf/crmf.gyp
@@ -26,16 +26,23 @@
         'encutil.c',
         'respcli.c',
         'respcmn.c',
         'servget.c'
       ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ],
+      'cflags': [
+        '-Wno-error=redundant-decls',
+      ],
+      'cflags_mozilla': [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=missing-prototypes'
+      ],
       'variables': {
         # This is purely for the use of the Mozilla build system.
         'no_expand_libs': 1,
       },
     }
   ],
   'variables': {
     'module': 'nss'
--- a/security/nss/lib/crmf/crmf.h
+++ b/security/nss/lib/crmf/crmf.h
@@ -1466,32 +1466,16 @@ extern SECItem *CRMF_ControlGetAuthicato
  * Get the PKIArchiveOptions associated with the Control.  A return
  * value of NULL indicates the Control was not a PKIArchiveOptions
  * Control.
  */
 extern CRMFPKIArchiveOptions *
 CRMF_ControlGetPKIArchiveOptions(CRMFControl *inControl);
 
 /*
- * FUNCTION: CMRF_DestroyPKIArchiveOptions
- * INPUTS:
- *    inOptions
- *        The ArchiveOptions to destroy.
- * NOTE:
- * Destroy the CRMFPKIArchiveOptions structure.
- *
- * RETURN:
- * SECSuccess if successful in freeing all the memory associated with
- * the PKIArchiveOptions.  Any other return value indicates an error while
- * freeing the PKIArchiveOptions.
- */
-extern SECStatus
-CRMF_DestroyPKIArchiveOptions(CRMFPKIArchiveOptions *inOptions);
-
-/*
  * FUNCTION: CRMF_PKIArchiveOptionsGetOptionType
  * INPUTS:
  *    inOptions
  *        The PKIArchiveOptions to operate on.
  * RETURN:
  * Returns the choice used for the PKIArchiveOptions.  Look at the definition
  * of CRMFPKIArchiveOptionsType in crmft.h for possible return values.
  */
--- a/security/nss/lib/cryptohi/cryptohi.gyp
+++ b/security/nss/lib/cryptohi/cryptohi.gyp
@@ -11,17 +11,20 @@
       'type': 'static_library',
       'sources': [
         'dsautil.c',
         'sechash.c',
         'seckey.c',
         'secsign.c',
         'secvfy.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ]
     }
   ],
   'variables': {
     'module': 'nss'
   }
-}
\ No newline at end of file
+}
--- a/security/nss/lib/dbm/src/src.gyp
+++ b/security/nss/lib/dbm/src/src.gyp
@@ -15,16 +15,19 @@
         'h_bigkey.c',
         'h_func.c',
         'h_log2.c',
         'h_page.c',
         'hash.c',
         'hash_buf.c',
         'mktemp.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:dbm_exports'
       ]
     }
   ],
   'target_defaults': {
     'defines': [
       'STDC_HEADERS',
@@ -32,9 +35,9 @@
       'HAVE_SNPRINTF',
       'MEMMOVE',
       '__DBINTERFACE_PRIVATE'
     ]
   },
   'variables': {
     'module': 'dbm'
   }
-}
\ No newline at end of file
+}
--- a/security/nss/lib/dev/dev.gyp
+++ b/security/nss/lib/dev/dev.gyp
@@ -10,17 +10,21 @@
       'target_name': 'nssdev',
       'type': 'static_library',
       'sources': [
         'ckhelper.c',
         'devslot.c',
         'devtoken.c',
         'devutil.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=redundant-decls',
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ]
     }
   ],
   'variables': {
     'module': 'nss'
   }
-}
\ No newline at end of file
+}
--- a/security/nss/lib/freebl/freebl.gyp
+++ b/security/nss/lib/freebl/freebl.gyp
@@ -23,16 +23,19 @@
       ]
     },
     {
       'target_name': 'freebl',
       'type': 'static_library',
       'sources': [
         'loader.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ]
     },
     {
       'target_name': '<(freebl_name)',
       'type': 'shared_library',
       'sources': [
@@ -87,16 +90,20 @@
         'rsapkcs.c',
         'seed.c',
         'sha512.c',
         'sha_fast.c',
         'shvfy.c',
         'sysrand.c',
         'tlsprfalg.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+           '-Wno-error=redundant-decls',
+      ],
       'conditions': [
         [ 'OS=="linux"', {
           'sources': [
             'nsslowhash.c',
             'stubs.c',
           ],
           'conditions': [
             [ 'test_build==1', {
--- a/security/nss/lib/nss/nss.gyp
+++ b/security/nss/lib/nss/nss.gyp
@@ -10,16 +10,20 @@
       'target_name': 'nss_static',
       'type': 'static_library',
       'sources': [
         'nssinit.c',
         'nssoptions.c',
         'nssver.c',
         'utilwrap.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=redundant-decls',
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports',
       ]
     },
     {
       # This is here so Firefox can link this without having to
       # repeat the list of dependencies.
       'target_name': 'nss3_deps',
--- a/security/nss/lib/pk11wrap/pk11wrap.gyp
+++ b/security/nss/lib/pk11wrap/pk11wrap.gyp
@@ -27,25 +27,29 @@
         'pk11pbe.c',
         'pk11pk12.c',
         'pk11pqg.c',
         'pk11sdr.c',
         'pk11skey.c',
         'pk11slot.c',
         'pk11util.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=redundant-decls',
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ]
     }
   ],
   'target_defaults': {
     'defines': [
       'SHLIB_SUFFIX=\"<(dll_suffix)\"',
       'SHLIB_PREFIX=\"<(dll_prefix)\"',
       'SHLIB_VERSION=\"3\"',
       'SOFTOKEN_SHLIB_VERSION=\"3\"'
     ]
   },
   'variables': {
     'module': 'nss'
   }
-}
\ No newline at end of file
+}
--- a/security/nss/lib/pkcs12/p12d.c
+++ b/security/nss/lib/pkcs12/p12d.c
@@ -3028,17 +3028,17 @@ SEC_PKCS12DecoderImportBags(SEC_PKCS12De
 
     if (!p12dcx->bagsVerified) {
         return SECFailure;
     }
 
     return sec_pkcs12_install_bags(p12dcx->safeBags, p12dcx->wincx);
 }
 
-PRBool
+static PRBool
 sec_pkcs12_bagHasKey(SEC_PKCS12DecoderContext *p12dcx, sec_PKCS12SafeBag *bag)
 {
     int i;
     SECItem *keyId;
     SECItem *certKeyId;
 
     certKeyId = sec_pkcs12_get_attribute_value(bag, SEC_OID_PKCS9_LOCAL_KEY_ID);
     if (certKeyId == NULL) {
@@ -3053,17 +3053,17 @@ sec_pkcs12_bagHasKey(SEC_PKCS12DecoderCo
         }
         if (SECITEM_CompareItem(certKeyId, keyId) == SECEqual) {
             return PR_TRUE;
         }
     }
     return PR_FALSE;
 }
 
-SECItem *
+static SECItem *
 sec_pkcs12_get_friendlyName(sec_PKCS12SafeBag *bag)
 {
     SECItem *friendlyName;
     SECItem *tempnm;
 
     tempnm = sec_pkcs12_get_attribute_value(bag, SEC_OID_PKCS9_FRIENDLY_NAME);
     friendlyName = (SECItem *)PORT_ZAlloc(sizeof(SECItem));
     if (friendlyName) {
--- a/security/nss/lib/pkcs12/p12e.c
+++ b/security/nss/lib/pkcs12/p12e.c
@@ -574,17 +574,17 @@ loser:
     return NULL;
 }
 
 /*********************************
  * Routines to handle the exporting of the keys and certificates
  *********************************/
 
 /* creates a safe contents which safeBags will be appended to */
-sec_PKCS12SafeContents *
+static sec_PKCS12SafeContents *
 sec_PKCS12CreateSafeContents(PLArenaPool *arena)
 {
     sec_PKCS12SafeContents *safeContents;
 
     if (arena == NULL) {
         return NULL;
     }
 
@@ -604,17 +604,17 @@ sec_PKCS12CreateSafeContents(PLArenaPool
     return safeContents;
 
 loser:
     return NULL;
 }
 
 /* appends a safe bag to a safeContents using the specified arena.
  */
-SECStatus
+static SECStatus
 sec_pkcs12_append_bag_to_safe_contents(PLArenaPool *arena,
                                        sec_PKCS12SafeContents *safeContents,
                                        sec_PKCS12SafeBag *safeBag)
 {
     void *mark = NULL, *dummy = NULL;
 
     if (!arena || !safeBag || !safeContents) {
         return SECFailure;
@@ -651,17 +651,17 @@ sec_pkcs12_append_bag_to_safe_contents(P
 
     PORT_ArenaUnmark(arena, mark);
 
     return SECSuccess;
 }
 
 /* appends a safeBag to a specific safeInfo.
  */
-SECStatus
+static SECStatus
 sec_pkcs12_append_bag(SEC_PKCS12ExportContext *p12ctxt,
                       SEC_PKCS12SafeInfo *safeInfo, sec_PKCS12SafeBag *safeBag)
 {
     sec_PKCS12SafeContents *dest;
     SECStatus rv = SECFailure;
 
     if (!p12ctxt || !safeBag || !safeInfo) {
         return SECFailure;
@@ -682,17 +682,17 @@ sec_pkcs12_append_bag(SEC_PKCS12ExportCo
 
     return rv;
 }
 
 /* Creates a safeBag of the specified type, and if bagData is specified,
  * the contents are set.  The contents could be set later by the calling
  * routine.
  */
-sec_PKCS12SafeBag *
+static sec_PKCS12SafeBag *
 sec_PKCS12CreateSafeBag(SEC_PKCS12ExportContext *p12ctxt, SECOidTag bagType,
                         void *bagData)
 {
     sec_PKCS12SafeBag *safeBag;
     void *mark = NULL;
     SECStatus rv = SECSuccess;
     SECOidData *oidData = NULL;
 
@@ -763,17 +763,17 @@ loser:
     }
 
     return NULL;
 }
 
 /* Creates a new certificate bag and returns a pointer to it.  If an error
  * occurs NULL is returned.
  */
-sec_PKCS12CertBag *
+static sec_PKCS12CertBag *
 sec_PKCS12NewCertBag(PLArenaPool *arena, SECOidTag certType)
 {
     sec_PKCS12CertBag *certBag = NULL;
     SECOidData *bagType = NULL;
     SECStatus rv;
     void *mark = NULL;
 
     if (!arena) {
@@ -807,17 +807,17 @@ sec_PKCS12NewCertBag(PLArenaPool *arena,
 loser:
     PORT_ArenaRelease(arena, mark);
     return NULL;
 }
 
 /* Creates a new CRL bag and returns a pointer to it.  If an error
  * occurs NULL is returned.
  */
-sec_PKCS12CRLBag *
+static sec_PKCS12CRLBag *
 sec_PKCS12NewCRLBag(PLArenaPool *arena, SECOidTag crlType)
 {
     sec_PKCS12CRLBag *crlBag = NULL;
     SECOidData *bagType = NULL;
     SECStatus rv;
     void *mark = NULL;
 
     if (!arena) {
@@ -857,17 +857,17 @@ loser:
  * adds an attribute to a safeBag.  currently, the only attributes supported
  * are those which are specified within PKCS 12.
  *
  *      p12ctxt - the export context
  *      safeBag - the safeBag to which attributes are appended
  *      attrType - the attribute type
  *      attrData - the attribute data
  */
-SECStatus
+static SECStatus
 sec_PKCS12AddAttributeToBag(SEC_PKCS12ExportContext *p12ctxt,
                             sec_PKCS12SafeBag *safeBag, SECOidTag attrType,
                             SECItem *attrData)
 {
     sec_PKCS12Attribute *attribute;
     void *mark = NULL, *dummy = NULL;
     SECOidData *oiddata = NULL;
     SECItem unicodeName = { siBuffer, NULL, 0 };
@@ -1703,17 +1703,17 @@ sec_P12A1OutputCB_HmacP7Update(void *arg
         SEC_PKCS7EncoderUpdate(bufcx->p7eCx, buf, len);
     } else {
         /* copy it all into the buffer, and return */
         memcpy(bufcx->buf, buf, len);
         bufcx->numBytes = len;
     }
 }
 
-void
+static void
 sec_FlushPkcs12OutputBuffer(sec_pkcs12OutputBuffer *bufcx)
 {
     if (bufcx->numBytes > 0) {
         SEC_PKCS7EncoderUpdate(bufcx->p7eCx, bufcx->buf, bufcx->numBytes);
         bufcx->numBytes = 0;
     }
 }
 
--- a/security/nss/lib/pkcs12/p12local.c
+++ b/security/nss/lib/pkcs12/p12local.c
@@ -41,17 +41,17 @@ sec_pkcs12_algtag_to_mech(SECOidTag algt
         default:
             break;
     }
     return CKM_INVALID_MECHANISM;
 }
 
 /* helper functions */
 /* returns proper bag type template based upon object type tag */
-const SEC_ASN1Template *
+static const SEC_ASN1Template *
 sec_pkcs12_choose_bag_type_old(void *src_or_dest, PRBool encoding)
 {
     const SEC_ASN1Template *theTemplate;
     SEC_PKCS12SafeBag *safebag;
     SECOidData *oiddata;
 
     if (src_or_dest == NULL) {
         return NULL;
@@ -114,17 +114,17 @@ sec_pkcs12_choose_bag_type(void *src_or_
         case SEC_OID_PKCS12_SECRET_BAG_ID:
             theTemplate = SEC_PKCS12SecretBagTemplate;
             break;
     }
     return theTemplate;
 }
 
 /* returns proper cert crl template based upon type tag */
-const SEC_ASN1Template *
+static const SEC_ASN1Template *
 sec_pkcs12_choose_cert_crl_type_old(void *src_or_dest, PRBool encoding)
 {
     const SEC_ASN1Template *theTemplate;
     SEC_PKCS12CertAndCRL *certbag;
     SECOidData *oiddata;
 
     if (src_or_dest == NULL) {
         return NULL;
--- a/security/nss/lib/pkcs7/pkcs7.gyp
+++ b/security/nss/lib/pkcs7/pkcs7.gyp
@@ -13,17 +13,20 @@
         'certread.c',
         'p7common.c',
         'p7create.c',
         'p7decode.c',
         'p7encode.c',
         'p7local.c',
         'secmime.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=redundant-decls',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ]
     }
   ],
   'variables': {
     'module': 'nss'
   }
-}
\ No newline at end of file
+}
--- a/security/nss/lib/pki/pki.gyp
+++ b/security/nss/lib/pki/pki.gyp
@@ -16,17 +16,21 @@
         'cryptocontext.c',
         'pki3hack.c',
         'pkibase.c',
         'pkistore.c',
         'symmkey.c',
         'tdcache.c',
         'trustdomain.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=redundant-decls',
+           '-Wno-error=missing-prototypes',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports'
       ]
     }
   ],
   'variables': {
     'module': 'nss'
   }
-}
\ No newline at end of file
+}
--- a/security/nss/lib/smime/cmsrecinfo.c
+++ b/security/nss/lib/smime/cmsrecinfo.c
@@ -11,17 +11,19 @@
 #include "cert.h"
 #include "key.h"
 #include "secasn1.h"
 #include "secitem.h"
 #include "secoid.h"
 #include "pk11func.h"
 #include "secerr.h"
 
-PRBool
+extern const SEC_ASN1Template NSSCMSRecipientInfoTemplate[];
+
+static PRBool
 nss_cmsrecipientinfo_usessubjectkeyid(NSSCMSRecipientInfo *ri)
 {
     if (ri->recipientInfoType == NSSCMSRecipientInfoID_KeyTrans) {
         NSSCMSRecipientIdentifier *rid;
         rid = &ri->ri.keyTransRecipientInfo.recipientIdentifier;
         if (rid->identifierType == NSSCMSRecipientID_SubjectKeyID) {
             return PR_TRUE;
         }
@@ -33,17 +35,17 @@ nss_cmsrecipientinfo_usessubjectkeyid(NS
  * NOTE: fakeContent marks CMSMessage structure which is only used as a carrier
  * of pwfn_arg and arena pools. In an ideal world, NSSCMSMessage would not have
  * been exported, and we would have added an ordinary enum to handle this
  * check. Unfortunatly wo don't have that luxury so we are overloading the
  * contentTypeTag field. NO code should every try to interpret this content tag
  * as a real OID tag, or use any fields other than pwfn_arg or poolp of this
  * CMSMessage for that matter */
 static const SECOidData fakeContent;
-NSSCMSRecipientInfo *
+static NSSCMSRecipientInfo *
 nss_cmsrecipientinfo_create(NSSCMSMessage *cmsg,
                             NSSCMSRecipientIDSelector type,
                             CERTCertificate *cert,
                             SECKEYPublicKey *pubKey,
                             SECItem *subjKeyID,
                             void *pwfn_arg,
                             SECItem *DERinput)
 {
@@ -53,17 +55,16 @@ nss_cmsrecipientinfo_create(NSSCMSMessag
     SECStatus rv = SECSuccess;
     NSSCMSRecipientEncryptedKey *rek;
     NSSCMSOriginatorIdentifierOrKey *oiok;
     unsigned long version;
     SECItem *dummy;
     PLArenaPool *poolp;
     CERTSubjectPublicKeyInfo *spki, *freeSpki = NULL;
     NSSCMSRecipientIdentifier *rid;
-    extern const SEC_ASN1Template NSSCMSRecipientInfoTemplate[];
 
     if (!cmsg) {
         /* a CMSMessage wasn't supplied, create a fake one to hold the pwfunc
          * and a private arena pool */
         cmsg = NSS_CMSMessage_Create(NULL);
         cmsg->pwfn_arg = pwfn_arg;
         /* mark it as a special cms message */
         cmsg->contentInfo.contentTypeTag = (SECOidData *)&fakeContent;
@@ -652,17 +653,16 @@ NSS_CMSRecipientInfo_GetCertAndKey(NSSCM
     return rv;
 }
 
 SECStatus
 NSS_CMSRecipientInfo_Encode(PLArenaPool *poolp,
                             const NSSCMSRecipientInfo *src,
                             SECItem *returned)
 {
-    extern const SEC_ASN1Template NSSCMSRecipientInfoTemplate[];
     SECStatus rv = SECFailure;
     if (!src || !returned) {
         PORT_SetError(SEC_ERROR_INVALID_ARGS);
     } else if (SEC_ASN1EncodeItem(poolp, returned, src,
                                   NSSCMSRecipientInfoTemplate)) {
         rv = SECSuccess;
     }
     return rv;
--- a/security/nss/lib/smime/cmsudf.c
+++ b/security/nss/lib/smime/cmsudf.c
@@ -40,17 +40,17 @@ static PRLock *nsscmstypeHashLock;
 /* the hash table itself */
 static PLHashTable *nsscmstypeHash;
 /* arena to hold all the hash table data */
 static PLArenaPool *nsscmstypeArena;
 
 /*
  * clean up our global tables
  */
-SECStatus
+static SECStatus
 nss_cmstype_shutdown(void *appData, void *reserved)
 {
     if (nsscmstypeHashLock) {
         PR_Lock(nsscmstypeHashLock);
     }
     if (nsscmstypeHash) {
         PL_HashTableDestroy(nsscmstypeHash);
         nsscmstypeHash = NULL;
--- a/security/nss/lib/smime/smime.gyp
+++ b/security/nss/lib/smime/smime.gyp
@@ -28,16 +28,20 @@
         'cmssigdata.c',
         'cmssiginfo.c',
         'cmsudf.c',
         'cmsutil.c',
         'smimemessage.c',
         'smimeutil.c',
         'smimever.c'
       ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+           '-Wno-error=redundant-decls',
+      ],
       'dependencies': [
         '<(DEPTH)/exports.gyp:nss_exports',
       ]
     },
     {
       # This is here so Firefox can link this without having to
       # repeat the list of dependencies.
       'target_name': 'smime3_deps',
--- a/security/nss/lib/softoken/legacydb/keydb.c
+++ b/security/nss/lib/softoken/legacydb/keydb.c
@@ -1452,17 +1452,17 @@ loser:
     for (i = 0; i < sitem->len; i++) {                \
         printf("%02x:", sitem->data[i]);              \
     }                                                 \
     printf("\n")
 #else
 #define SEC_PRINT(a, b, c, d)
 #endif /* EC_DEBUG */
 
-SECStatus
+static SECStatus
 seckey_encrypt_private_key(PLArenaPool *permarena, NSSLOWKEYPrivateKey *pk,
                            SDB *sdbpw, SECItem *result)
 {
     NSSLOWKEYPrivateKeyInfo *pki = NULL;
     SECStatus rv = SECFailure;
     PLArenaPool *temparena = NULL;
     SECItem *der_item = NULL;
     SECItem *cipherText = NULL;
--- a/security/nss/lib/ssl/ssl.gyp
+++ b/security/nss/lib/ssl/ssl.gyp
@@ -36,16 +36,20 @@
         'sslsnce.c',
         'sslsock.c',
         'ssltrace.c',
         'sslver.c',
         'tls13con.c',
         'tls13exthandle.c',
         'tls13hkdf.c',
       ],
+      'cflags_mozilla': [
+           '-Wno-error=missing-prototypes',
+           '-Wno-error=redundant-decls',
+      ],
       'conditions': [
         [ 'OS=="win"', {
           'sources': [
             'win32err.c',
           ],
           'defines': [
             'IN_LIBSSL',
           ],
--- a/security/nss/lib/ssl/sslimpl.h
+++ b/security/nss/lib/ssl/sslimpl.h
@@ -1801,17 +1801,16 @@ SECStatus ssl3_ComputeHandshakeHashes(ss
                                       ssl3CipherSpec *spec,
                                       SSL3Hashes *hashes,
                                       PRUint32 sender);
 SECStatus ssl_CreateECDHEphemeralKeyPair(const sslSocket *ss,
                                          const sslNamedGroupDef *ecGroup,
                                          sslEphemeralKeyPair **keyPair);
 SECStatus ssl_CreateStaticECDHEKey(sslSocket *ss,
                                    const sslNamedGroupDef *ecGroup);
-SECStatus ssl3_FlushHandshake(sslSocket *ss, PRInt32 flags);
 PK11SymKey *ssl3_GetWrappingKey(sslSocket *ss,
                                 PK11SlotInfo *masterSecretSlot,
                                 const sslServerCert *serverCert,
                                 CK_MECHANISM_TYPE masterWrapMech,
                                 void *pwArg);
 SECStatus ssl3_FillInCachedSID(sslSocket *ss, sslSessionID *sid);
 const ssl3CipherSuiteDef *ssl_LookupCipherSuiteDef(ssl3CipherSuite suite);
 const ssl3BulkCipherDef *
--- a/security/nss/lib/util/oidstring.c
+++ b/security/nss/lib/util/oidstring.c
@@ -1,16 +1,17 @@
 /* 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/. */
 
 #include <string.h>
 #include "secitem.h"
 #include "secport.h"
 #include "secerr.h"
+#include "secoid.h"
 
 /* if to->data is not NULL, and to->len is large enough to hold the result,
  * then the resultant OID will be copyed into to->data, and to->len will be
  * changed to show the actual OID length.
  * Otherwise, memory for the OID will be allocated (from the caller's
  * PLArenaPool, if pool is non-NULL) and to->data will receive the address
  * of the allocated data, and to->len will receive the OID length.
  * The original value of to->data is not freed when a new buffer is allocated.
--- a/security/nss/lib/util/secasn1d.c
+++ b/security/nss/lib/util/secasn1d.c
@@ -2609,17 +2609,17 @@ static void
 sec_asn1d_after_choice(sec_asn1d_state *state)
 {
     state->consumed += state->child->consumed;
     state->child->consumed = 0;
     state->place = afterEndOfContents;
     sec_asn1d_pop_state(state);
 }
 
-unsigned long
+static unsigned long
 sec_asn1d_uinteger(SECItem *src)
 {
     unsigned long value;
     int len;
 
     if (src->len > 5 || (src->len > 4 && src->data[0] == 0))
         return 0;
 
--- a/security/nss/lib/util/utilmod.c
+++ b/security/nss/lib/util/utilmod.c
@@ -164,17 +164,17 @@ static char *
 static SECStatus nssutil_AddSecmodDBEntry(const char *appName,
                                           const char *filename,
                                           const char *dbname,
                                           const char *module, PRBool rw);
 
 enum lfopen_mode { lfopen_truncate,
                    lfopen_append };
 
-FILE *
+static FILE *
 lfopen(const char *name, enum lfopen_mode om, os_open_permissions_type open_perms)
 {
     int fd;
     FILE *file;
 
     fd = os_open(name,
                  (om == lfopen_truncate) ? os_truncate_open_flags : os_append_open_flags,
                  open_perms);
--- a/security/nss/lib/util/utilpars.c
+++ b/security/nss/lib/util/utilpars.c
@@ -10,17 +10,17 @@
 #include "prprf.h"
 #include "prenv.h"
 #include "utilpars.h"
 #include "utilmodt.h"
 
 /*
  * return the expected matching quote value for the one specified
  */
-PRBool
+static PRBool
 NSSUTIL_ArgGetPair(char c)
 {
     switch (c) {
         case '\'':
             return c;
         case '\"':
             return c;
         case '<':
@@ -38,23 +38,23 @@ NSSUTIL_ArgGetPair(char c)
 }
 
 PRBool
 NSSUTIL_ArgIsBlank(char c)
 {
     return isspace((unsigned char)c);
 }
 
-PRBool
+static PRBool
 NSSUTIL_ArgIsEscape(char c)
 {
     return c == '\\';
 }
 
-PRBool
+static PRBool
 NSSUTIL_ArgIsQuote(char c)
 {
     switch (c) {
         case '\'':
         case '\"':
         case '<':
         case '{': /* } end curly to keep vi bracket matching working */
         case '(': /* ) */
@@ -73,17 +73,17 @@ NSSUTIL_ArgStrip(const char *c)
         c++;
     return c;
 }
 
 /*
  * find the end of the current tag/value pair. string should be pointing just
  * after the equal sign. Handles quoted characters.
  */
-const char *
+static const char *
 NSSUTIL_ArgFindEnd(const char *string)
 {
     char endChar = ' ';
     PRBool lastEscape = PR_FALSE;
 
     if (NSSUTIL_ArgIsQuote(*string)) {
         endChar = NSSUTIL_ArgGetPair(*string);
         string++;
@@ -200,17 +200,17 @@ NSSUTIL_ArgGetParamValue(const char *par
         parameters = NSSUTIL_ArgStrip(parameters);
     }
     return returnValue;
 }
 
 /*
  * find the next flag in the parameter list
  */
-const char *
+static const char *
 NSSUTIL_ArgNextFlag(const char *flags)
 {
     for (; *flags; flags++) {
         if (*flags == ',') {
             flags++;
             break;
         }
     }
--- a/storage/TelemetryVFS.cpp
+++ b/storage/TelemetryVFS.cpp
@@ -8,16 +8,18 @@
 #include "mozilla/Telemetry.h"
 #include "mozilla/Preferences.h"
 #include "sqlite3.h"
 #include "nsThreadUtils.h"
 #include "mozilla/dom/quota/PersistenceType.h"
 #include "mozilla/dom/quota/QuotaManager.h"
 #include "mozilla/dom/quota/QuotaObject.h"
 #include "mozilla/IOInterposer.h"
+#include "mozStorageService.h"
+#include "TelemetryVFS.h"
 
 // The last VFS version for which this file has been updated.
 #define LAST_KNOWN_VFS_VERSION 3
 
 // The last io_methods version for which this file has been updated.
 #define LAST_KNOWN_IOMETHODS_VERSION 3
 
 /**
new file mode 100644
--- /dev/null
+++ b/storage/TelemetryVFS.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
+ * 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/. */
+
+#ifndef TelemetryVHS_h__
+#define TelemetryVHS_h__
+
+#include "sqlite3.h"
+#include "mozilla/dom/quota/QuotaObject.h"
+
+using namespace mozilla::dom::quota;
+
+namespace mozilla {
+namespace storage {
+
+sqlite3_vfs* ConstructTelemetryVFS();
+
+already_AddRefed<QuotaObject> GetQuotaObjectForFile(sqlite3_file *pFile);
+
+} // namespace storage
+} // namespace mozilla
+
+#endif // TelemetryVHS_h__
--- a/storage/mozStorageConnection.cpp
+++ b/storage/mozStorageConnection.cpp
@@ -31,16 +31,17 @@
 #include "mozStorageService.h"
 #include "mozStorageStatement.h"
 #include "mozStorageAsyncStatement.h"
 #include "mozStorageArgValueArray.h"
 #include "mozStoragePrivateHelpers.h"
 #include "mozStorageStatementData.h"
 #include "StorageBaseStatementInternal.h"
 #include "SQLCollations.h"
+#include "TelemetryVFS.h"
 #include "FileSystemModule.h"
 #include "mozStorageHelper.h"
 #include "GeckoProfiler.h"
 
 #include "mozilla/Logging.h"
 #include "prprf.h"
 #include "nsProxyRelease.h"
 #include <algorithm>
@@ -1990,20 +1991,16 @@ Connection::EnableModule(const nsACStrin
 
       return NS_OK;
     }
   }
 
   return NS_ERROR_FAILURE;
 }
 
-// Implemented in TelemetryVFS.cpp
-already_AddRefed<QuotaObject>
-GetQuotaObjectForFile(sqlite3_file *pFile);
-
 NS_IMETHODIMP
 Connection::GetQuotaObjects(QuotaObject** aDatabaseQuotaObject,
                             QuotaObject** aJournalQuotaObject)
 {
   MOZ_ASSERT(aDatabaseQuotaObject);
   MOZ_ASSERT(aJournalQuotaObject);
 
   if (!mDBConn) {
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -3520,47 +3520,16 @@ nsNavHistory::ResultsAsList(mozIStorageS
     RefPtr<nsNavHistoryResultNode> result;
     rv = RowToResult(row, aOptions, getter_AddRefs(result));
     NS_ENSURE_SUCCESS(rv, rv);
     aResults->AppendElement(result.forget());
   }
   return NS_OK;
 }
 
-const int64_t UNDEFINED_URN_VALUE = -1;
-
-// Create a urn (like
-// urn:places-persist:place:group=0&group=1&sort=1&type=1,,%28local%20files%29)
-// to be used to persist the open state of this container
-nsresult
-CreatePlacesPersistURN(nsNavHistoryQueryResultNode *aResultNode,
-                       int64_t aValue, const nsCString& aTitle, nsCString& aURN)
-{
-  nsAutoCString uri;
-  nsresult rv = aResultNode->GetUri(uri);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  aURN.AssignLiteral("urn:places-persist:");
-  aURN.Append(uri);
-
-  aURN.Append(',');
-  if (aValue != UNDEFINED_URN_VALUE)
-    aURN.AppendInt(aValue);
-
-  aURN.Append(',');
-  if (!aTitle.IsEmpty()) {
-    nsAutoCString escapedTitle;
-    bool success = NS_Escape(aTitle, escapedTitle, url_XAlphas);
-    NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
-    aURN.Append(escapedTitle);
-  }
-
-  return NS_OK;
-}
-
 int64_t
 nsNavHistory::GetTagsFolder()
 {
   // cache our tags folder
   // note, we can't do this in nsNavHistory::Init(),
   // as getting the bookmarks service would initialize it.
   if (mTagsFolder == -1) {
     nsNavBookmarks *bookmarks = nsNavBookmarks::GetBookmarksService();
--- a/toolkit/components/url-classifier/tests/gtest/Common.h
+++ b/toolkit/components/url-classifier/tests/gtest/Common.h
@@ -1,8 +1,11 @@
+#ifndef common_h
+#define common_h
+
 #include "HashStore.h"
 #include "nsIFile.h"
 #include "nsTArray.h"
 #include "gtest/gtest.h"
 
 using namespace mozilla;
 using namespace mozilla::safebrowsing;
 
@@ -19,8 +22,9 @@ void ApplyUpdate(nsTArray<TableUpdate*>&
 
 void ApplyUpdate(TableUpdate* update);
 
 // This function converts lexigraphic-sorted prefixes to a hashtable
 // which key is prefix size and value is concatenated prefix string.
 void PrefixArrayToPrefixStringMap(const nsTArray<nsCString>& prefixArray,
                                   PrefixStringMap& out);
 
+#endif // common_h
--- a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
@@ -48,9 +48,12 @@ 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']
+    CXXFLAGS += [
+	'-Wno-error=missing-prototypes',
+	'-Wno-shadow',
+	]
--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -57,16 +57,20 @@ if CONFIG['OS_TARGET'] == 'Android':
     # We don't support unifying assembly files.
     SOURCES += [
         'android/breakpad_getcontext.S',
     ]
     LOCAL_INCLUDES += [
         '/toolkit/crashreporter/google-breakpad/src/common/android/include',
     ]
 
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wno-error=missing-prototypes']
+
 Library('breakpad_common_s')
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
 
 include('/toolkit/crashreporter/crashreporter.mozbuild')
--- a/toolkit/xre/moz.build
+++ b/toolkit/xre/moz.build
@@ -178,12 +178,15 @@ 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']
+    CXXFLAGS += [
+        '-Wno-error=redundant-decls',
+        '-Wno-error=shadow',
+    ]
 
 if CONFIG['MOZ_IPDL_TESTS']:
     DEFINES['MOZ_IPDL_TESTS'] = True
--- a/toolkit/xre/nsX11ErrorHandler.h
+++ b/toolkit/xre/nsX11ErrorHandler.h
@@ -1,12 +1,17 @@
 /* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+#ifndef nsX11ErrorHandler_h
+#define nsX11ErrorHandler_h
+
 #ifdef MOZ_X11
 #include <X11/Xlib.h>
 #if (MOZ_WIDGET_GTK != 3)
 void InstallX11ErrorHandler();
 #endif
 extern "C" int X11Error(Display *display, XErrorEvent *event);
 #endif
+
+#endif // nsX11ErrorHandler_h
--- a/tools/profiler/gecko/nsProfiler.cpp
+++ b/tools/profiler/gecko/nsProfiler.cpp
@@ -137,17 +137,17 @@ nsProfiler::GetProfile(double aSinceTime
     char *profileStr = static_cast<char *>
                          (nsMemory::Clone(profile.get(), (len + 1) * sizeof(char)));
     profileStr[len] = '\0';
     *aProfile = profileStr;
   }
   return NS_OK;
 }
 
-std::string GetSharedLibraryInfoStringInternal();
+std::string GetSharedLibraryInfoStringInternal(nsAString& aOutString);
 
 std::string
 GetSharedLibraryInfoString()
 {
   return GetSharedLibraryInfoStringInternal();
 }
 
 NS_IMETHODIMP
@@ -300,9 +300,9 @@ nsProfiler::GetProfileGatherer(nsISuppor
   if (!profiler_is_active()) {
     *aRetVal = nullptr;
   } else {
     nsCOMPtr<nsISupports> gatherer;
     profiler_get_gatherer(getter_AddRefs(gatherer));
     gatherer.forget(aRetVal);
   }
   return NS_OK;
-}
\ No newline at end of file
+}
--- a/tools/profiler/moz.build
+++ b/tools/profiler/moz.build
@@ -142,11 +142,12 @@ if CONFIG['MOZ_TASK_TRACER']:
         'tasktracer/GeckoTaskTracer.cpp',
         'tasktracer/TracedTaskCommon.cpp',
     ]
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell.ini']
 
 if CONFIG['GNU_CXX']:
     CXXFLAGS += [
+        '-Wno-error=redundant-decls',
         '-Wno-error=shadow',
         '-Wno-ignored-qualifiers', # due to use of breakpad headers
     ]
--- a/tools/profiler/public/GeckoProfilerImpl.h
+++ b/tools/profiler/public/GeckoProfilerImpl.h
@@ -500,18 +500,16 @@ inline void mozilla_sampler_call_exit(vo
 {
   if (!aHandle)
     return;
 
   PseudoStack *stack = (PseudoStack*)aHandle;
   stack->popAndMaybeDelete();
 }
 
-void mozilla_sampler_add_marker(const char *aMarker, ProfilerMarkerPayload *aPayload);
-
 static inline
 void profiler_log(const char *str)
 {
   profiler_tracing("log", str, TRACING_EVENT);
 }
 
 static inline
 void profiler_log(const char *fmt, va_list args)
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -77,17 +77,17 @@ public:
     GfxInfoBase::mShutdownOccurred = true;
 
     return NS_OK;
   }
 };
 
 NS_IMPL_ISUPPORTS(ShutdownObserver, nsIObserver)
 
-void InitGfxDriverInfoShutdownObserver()
+static void InitGfxDriverInfoShutdownObserver()
 {
   if (GfxInfoBase::mDriverInfoObserverInitialized)
     return;
 
   GfxInfoBase::mDriverInfoObserverInitialized = true;
 
   nsCOMPtr<nsIObserverService> observerService = services::GetObserverService();
   if (!observerService) {
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -134,8 +134,12 @@ CXXFLAGS += CONFIG['MOZ_STARTUP_NOTIFICA
 
 CFLAGS += CONFIG['TK_CFLAGS']
 CXXFLAGS += CONFIG['TK_CFLAGS']
 
 if CONFIG['MOZ_ENABLE_DBUS']:
     CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
 
 CXXFLAGS += ['-Wno-error=shadow']
+
+if CONFIG['GNU_CC']:
+    CFLAGS += ['-Wno-error=missing-prototypes']
+
--- a/widget/gtk/mozgtk/gtk2/moz.build
+++ b/widget/gtk/mozgtk/gtk2/moz.build
@@ -33,8 +33,14 @@ else:
 
 OS_LIBS += [f for f in CONFIG['MOZ_GTK2_LIBS'] if f.startswith('-L')]
 OS_LIBS += no_as_needed
 OS_LIBS += [
     'gtk-x11-2.0',
     'gdk-x11-2.0',
 ]
 OS_LIBS += as_needed
+if CONFIG['GNU_CC']:
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+    ]
+
+
--- a/widget/gtk/mozgtk/gtk3/moz.build
+++ b/widget/gtk/mozgtk/gtk3/moz.build
@@ -31,8 +31,15 @@ else:
 
 OS_LIBS += [f for f in CONFIG['MOZ_GTK3_LIBS'] if f.startswith('-L')]
 OS_LIBS += no_as_needed
 OS_LIBS += [
     'gtk-3',
     'gdk-3',
 ]
 OS_LIBS += as_needed
+
+if CONFIG['GNU_CC']:
+    CFLAGS += [
+        '-Wno-error=missing-prototypes',
+        '-Wno-error=redundant-decls',
+    ]
+
--- a/widget/gtk/mozgtk/stub/moz.build
+++ b/widget/gtk/mozgtk/stub/moz.build
@@ -9,8 +9,14 @@ SOURCES += [
 ]
 
 for var in ('COMMON_SYMBOLS', 'GTK2_SYMBOLS', 'GTK3_SYMBOLS'):
     DEFINES[var] = True
 
 SharedLibrary('mozgtk_stub')
 
 SONAME = 'mozgtk'
+if CONFIG['GNU_CC']:
+    CFLAGS += [
+        '-Wno-missing-prototypes',
+    ]
+
+
--- a/widget/nsTransferable.cpp
+++ b/widget/nsTransferable.cpp
@@ -37,17 +37,17 @@ Notes to self:
 #include "nsIInputStream.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsIFile.h"
 #include "nsILoadContext.h"
 #include "mozilla/UniquePtr.h"
 
 NS_IMPL_ISUPPORTS(nsTransferable, nsITransferable)
 
-size_t GetDataForFlavor (const nsTArray<DataStruct>& aArray,
+static size_t GetDataForFlavor (const nsTArray<DataStruct>& aArray,
                            const char* aDataFlavor)
 {
   for (size_t i = 0 ; i < aArray.Length () ; ++i) {
     if (aArray[i].GetFlavor().Equals (aDataFlavor))
       return i;
   }
 
   return aArray.NoIndex;
--- a/xpcom/base/NSPRLogModulesParser.h
+++ b/xpcom/base/NSPRLogModulesParser.h
@@ -1,14 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
+#ifndef NSPRLogModulesParser_h
+#define NSPRLogModulesParser_h
+
 #include "mozilla/Logging.h"
 
 #include <functional>
 
 namespace mozilla {
 
 /**
  * Helper function that parses the legacy NSPR_LOG_MODULES env var format
@@ -16,8 +19,10 @@ namespace mozilla {
  *
  * @param aLogModules The log modules configuration string.
  * @param aCallback The callback to invoke for each log module config entry.
  */
 void NSPRLogModulesParser(const char* aLogModules,
                           std::function<void(const char*, LogLevel, int32_t)> aCallback);
 
 } // namespace mozilla
+
+#endif // NSPRLogModulesParser_h
--- a/xpcom/ds/nsStringEnumerator.h
+++ b/xpcom/ds/nsStringEnumerator.h
@@ -1,14 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
+#ifndef mozilla_nsStringEnumerator_h
+#define mozilla_nsStringEnumerator_h
+
 #include "nsIStringEnumerator.h"
 #include "nsStringFwd.h"
 #include "nsTArrayForwardDeclare.h"
 
 // nsIStringEnumerator/nsIUTF8StringEnumerator implementations
 //
 // Currently all implementations support both interfaces. The
 // constructors below provide the most common interface for the given
@@ -84,8 +87,11 @@ NS_NewAdoptingUTF8StringEnumerator(nsIUT
 //     mCategoryList->AppendString("abcd");
 //     return NS_NewStringEnumerator(aResult, mCategoryList, this);
 // }
 //
 MOZ_MUST_USE nsresult
 NS_NewUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult,
                            const nsTArray<nsCString>* aArray,
                            nsISupports* aOwner);
+
+#endif // ifdef mozilla_nsStringEnumerator_h
+
--- a/xpcom/glue/BlockingResourceBase.cpp
+++ b/xpcom/glue/BlockingResourceBase.cpp
@@ -81,17 +81,17 @@ BlockingResourceBase::GetStackTrace(Acqu
  * negative.
  *
  * *NOT* thread safe.  Calls |Print()|.
  *
  * FIXME bug 456272 hack alert: because we can't write call
  * contexts into strings, all info is written to stderr, but only
  * some info is written into |aOut|
  */
-bool
+static bool
 PrintCycle(const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle,
            nsACString& aOut)
 {
   NS_ASSERTION(aCycle->Length() > 1, "need > 1 element for cycle!");
 
   bool maybeImminent = true;
 
   fputs("=== Cyclical dependency starts at\n", stderr);
--- a/xpcom/glue/MainThreadUtils.h
+++ b/xpcom/glue/MainThreadUtils.h
@@ -19,17 +19,17 @@ class nsIThread;
  */
 extern nsresult NS_GetMainThread(nsIThread** aResult);
 
 #ifdef MOZILLA_INTERNAL_API
 // Fast access to the current thread.  Do not release the returned pointer!  If
 // you want to use this pointer from some other thread, then you will need to
 // AddRef it.  Otherwise, you should only consider this pointer valid from code
 // running on the current thread.
-extern nsIThread* NS_GetCurrentThread();
+//extern nsIThread* NS_GetCurrentThread(nsIThread** aResult);
 #endif
 
 #ifdef MOZILLA_INTERNAL_API
 bool NS_IsMainThread();
 #else
 /**
  * Test to see if the current thread is the main thread.
  *
--- a/xpcom/string/nsReadableUtils.h
+++ b/xpcom/string/nsReadableUtils.h
@@ -291,20 +291,16 @@ bool ParseString(const nsACString& aAstr
 
 /**
  * Converts case in place in the argument string.
  */
 void ToUpperCase(nsACString&);
 
 void ToLowerCase(nsACString&);
 
-void ToUpperCase(nsCSubstring&);
-
-void ToLowerCase(nsCSubstring&);
-
 /**
  * Converts case from string aSource to aDest.
  */
 void ToUpperCase(const nsACString& aSource, nsACString& aDest);
 
 void ToLowerCase(const nsACString& aSource, nsACString& aDest);
 
 /**
--- a/xpcom/string/nsStringObsolete.cpp
+++ b/xpcom/string/nsStringObsolete.cpp
@@ -846,16 +846,18 @@ RFind_ComputeSearchRange( uint32_t bigLe
     start = 0;
 
   count = offset + littleLen - start;
   offset = start;
 }
 
 //-----------------------------------------------------------------------------
 
+void ReleaseData(void* aData, uint32_t aFlags);
+
 // define nsString obsolete methods
 #include "string-template-def-unichar.h"
 #include "nsTStringObsolete.cpp"
 #include "string-template-undef.h"
 
 // define nsCString obsolete methods
 #include "string-template-def-char.h"
 #include "nsTStringObsolete.cpp"
--- a/xpcom/string/nsTStringObsolete.cpp
+++ b/xpcom/string/nsTStringObsolete.cpp
@@ -447,18 +447,16 @@ nsTString_CharT::ReplaceChar( const char
       break;
 
     data[i++] = aNewChar;
     data += i;
     lenRemaining -= i;
   }
 }
 
-void ReleaseData(void* aData, uint32_t aFlags);
-
 void
 nsTString_CharT::ReplaceSubstring(const char_type* aTarget,
                                   const char_type* aNewValue)
 {
   ReplaceSubstring(nsTDependentString_CharT(aTarget),
                    nsTDependentString_CharT(aNewValue));
 }