Bug 1204403 - Fix -Wshadow warnings in xpcom. r=mccr8
authorChris Peterson <cpeterson@mozilla.com>
Mon, 07 Sep 2015 23:56:16 -0700
changeset 295349 0361ecab9e24486b6e0c1d2ef0bd28c6ba630fa2
parent 295348 212427250df615ead46d5fe0cea5be1656ad7100
child 295350 3d0b47f7a37b4e7db22d947ff0e9416a7f5d8b2a
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1204403
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1204403 - Fix -Wshadow warnings in xpcom. r=mccr8
xpcom/base/SystemMemoryReporter.cpp
xpcom/base/moz.build
xpcom/base/nsStatusReporterManager.cpp
xpcom/build/moz.build
xpcom/ds/moz.build
xpcom/ds/nsVariant.cpp
xpcom/glue/GenericModule.cpp
xpcom/glue/moz.build
xpcom/glue/nsCRTGlue.cpp
xpcom/glue/nsTArray-inl.h
xpcom/glue/tests/gtest/TestThreadUtils.cpp
xpcom/io/moz.build
xpcom/io/nsEscape.cpp
xpcom/io/nsLocalFileCommon.cpp
xpcom/io/nsMultiplexInputStream.cpp
xpcom/libxpcomrt/moz.build
xpcom/reflect/xptcall/md/unix/moz.build
xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
xpcom/string/moz.build
xpcom/tests/TestHashtables.cpp
xpcom/tests/TestRacingServiceManager.cpp
xpcom/tests/bug656331_component/moz.build
xpcom/tests/gtest/moz.build
xpcom/tests/moz.build
xpcom/tests/nsIFileEnumerator.cpp
xpcom/typelib/xpt/moz.build
--- a/xpcom/base/SystemMemoryReporter.cpp
+++ b/xpcom/base/SystemMemoryReporter.cpp
@@ -139,23 +139,23 @@ class SystemReporter final : public nsIM
 
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
 #define REPORT_WITH_CLEANUP(_path, _units, _amount, _desc, _cleanup)          \
   do {                                                                        \
     size_t amount = _amount;  /* evaluate _amount only once */                \
     if (amount > 0) {                                                         \
-      nsresult rv;                                                            \
-      rv = aHandleReport->Callback(NS_LITERAL_CSTRING("System"), _path,       \
+      nsresult rvReport;                                                      \
+      rvReport = aHandleReport->Callback(NS_LITERAL_CSTRING("System"), _path, \
                                    KIND_NONHEAP, _units, amount, _desc,       \
                                    aData);                                    \
-      if (NS_WARN_IF(NS_FAILED(rv))) {                                        \
+      if (NS_WARN_IF(NS_FAILED(rvReport))) {                                  \
         _cleanup;                                                             \
-        return rv;                                                            \
+        return rvReport;                                                      \
       }                                                                       \
     }                                                                         \
   } while (0)
 
 #define REPORT(_path, _amount, _desc) \
   REPORT_WITH_CLEANUP(_path, UNITS_BYTES, _amount, _desc, (void)0)
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
@@ -368,63 +368,64 @@ private:
     unsigned long long offset;
     // The 2.6 and 3.0 kernels allocate 12 bits for the major device number and
     // 20 bits for the minor device number.  Future kernels might allocate more.
     // 64 bits ought to be enough for anybody.
     char devMajor[17];
     char devMinor[17];
     unsigned int inode;
     char line[1025];
+
     // This variable holds the path of the current entry, or is void
     // if we're scanning for the start of a new entry.
-    nsAutoCString path;
+    nsAutoCString currentPath;
     int pathOffset;
 
-    path.SetIsVoid(true);
+    currentPath.SetIsVoid(true);
     while (fgets(line, sizeof(line), aFile)) {
-      if (path.IsVoid()) {
+      if (currentPath.IsVoid()) {
         int n = sscanf(line,
                        "%llx-%llx %4s %llx "
                        "%16[0-9a-fA-F]:%16[0-9a-fA-F] %u %n",
                        &addrStart, &addrEnd, perms, &offset, devMajor,
                        devMinor, &inode, &pathOffset);
 
         if (n >= argCount - 1) {
-          path.Assign(line + pathOffset);
-          path.StripChars("\n");
+          currentPath.Assign(line + pathOffset);
+          currentPath.StripChars("\n");
         }
         continue;
       }
 
       // Now that we have a name and other metadata, scan for the PSS.
       size_t pss_kb;
       int n = sscanf(line, "Pss: %zu", &pss_kb);
       if (n < 1) {
         continue;
       }
 
       size_t pss = pss_kb * 1024;
       if (pss > 0) {
         nsAutoCString name, description, tag;
-        GetReporterNameAndDescription(path.get(), perms, name, description, tag);
+        GetReporterNameAndDescription(currentPath.get(), perms, name, description, tag);
 
-        nsAutoCString path("mem/processes/");
-        path.Append(aProcessName);
-        path.Append('/');
-        path.Append(name);
+        nsAutoCString processMemPath("mem/processes/");
+        processMemPath.Append(aProcessName);
+        processMemPath.Append('/');
+        processMemPath.Append(name);
 
-        REPORT(path, pss, description);
+        REPORT(processMemPath, pss, description);
 
         // Increment the appropriate aProcessSizes values, and the total.
         aProcessSizes->Add(tag, pss);
         *aTotalPss += pss;
       }
 
       // Now that we've seen the PSS, we're done with this entry.
-      path.SetIsVoid(true);
+      currentPath.SetIsVoid(true);
     }
     return NS_OK;
   }
 
   void GetReporterNameAndDescription(const char* aPath,
                                      const char* aPerms,
                                      nsACString& aName,
                                      nsACString& aDesc,
--- a/xpcom/base/moz.build
+++ b/xpcom/base/moz.build
@@ -147,8 +147,11 @@ FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../build',
     '/xpcom/ds',
 ]
 
 if CONFIG['MOZ_WIDGET_GTK']:
     CXXFLAGS += CONFIG['TK_CFLAGS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
--- a/xpcom/base/nsStatusReporterManager.cpp
+++ b/xpcom/base/nsStatusReporterManager.cpp
@@ -73,19 +73,19 @@ getStatus(nsACString& aDesc)
 }
 
 NS_STATUS_REPORTER_IMPLEMENT(StatusReporter, "StatusReporter State", getStatus)
 
 #define DUMP(o, s) \
   do { \
     const char* s2 = (s); \
     uint32_t dummy; \
-    nsresult rv = (o)->Write((s2), strlen(s2), &dummy); \
-    if (NS_WARN_IF(NS_FAILED(rv))) \
-      return rv; \
+    nsresult rvDump = (o)->Write((s2), strlen(s2), &dummy); \
+    if (NS_WARN_IF(NS_FAILED(rvDump))) \
+      return rvDump; \
   } while (0)
 
 static nsresult
 DumpReport(nsIFileOutputStream* aOStream, const nsCString& aProcess,
            const nsCString& aName, const nsCString& aDescription)
 {
   int pid;
   if (aProcess.IsEmpty()) {
--- a/xpcom/build/moz.build
+++ b/xpcom/build/moz.build
@@ -65,16 +65,17 @@ if CONFIG['OS_ARCH'] != 'WINNT':
 # use plarena.h.
 SOURCES += [
     'FileLocation.cpp',
     'Omnijar.cpp',
 ]
 
 if CONFIG['GNU_CC']:
     CFLAGS += ['-Wshadow']
+    CXXFLAGS += ['-Wshadow']
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 DEFINES['_IMPL_NS_STRINGAPI'] = True
 DEFINES['OMNIJAR_NAME'] = CONFIG['OMNIJAR_NAME']
 
--- a/xpcom/ds/moz.build
+++ b/xpcom/ds/moz.build
@@ -95,8 +95,11 @@ EXTRA_COMPONENTS += [
     'nsINIProcessor.manifest',
 ]
 
 LOCAL_INCLUDES += [
     '../io',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
--- a/xpcom/ds/nsVariant.cpp
+++ b/xpcom/ds/nsVariant.cpp
@@ -1011,19 +1011,19 @@ nsDiscriminatedUnion::ConvertToStringWit
       break;
     case nsIDataType::VTYPE_UTF8STRING: {
       // XXX This is doing 1 extra copy.  Need to fix this
       // when Jag lands UTF8String
       // we want:
       // *aSize = *mUTF8StringValue->Length();
       // *aStr = ToNewCString(*mUTF8StringValue);
       // But this will have to do for now.
-      NS_ConvertUTF8toUTF16 tempString(*u.mUTF8StringValue);
-      *aSize = tempString.Length();
-      *aStr = ToNewCString(tempString);
+      const NS_ConvertUTF8toUTF16 tempString16(*u.mUTF8StringValue);
+      *aSize = tempString16.Length();
+      *aStr = ToNewCString(tempString16);
       break;
     }
     case nsIDataType::VTYPE_CHAR_STR: {
       nsDependentCString cString(u.str.mStringValue);
       *aSize = cString.Length();
       *aStr = ToNewCString(cString);
       break;
     }
--- a/xpcom/glue/GenericModule.cpp
+++ b/xpcom/glue/GenericModule.cpp
@@ -45,40 +45,40 @@ GenericModule::GetClassObject(nsICompone
 }
 
 NS_IMETHODIMP
 GenericModule::RegisterSelf(nsIComponentManager* aCompMgr,
                             nsIFile* aLocation,
                             const char* aLoaderStr,
                             const char* aType)
 {
-  nsCOMPtr<nsIComponentRegistrar> r = do_QueryInterface(aCompMgr);
+  nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(aCompMgr);
   for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e) {
-    r->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation,
-                               aLoaderStr, aType);
+    registrar->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation,
+                                       aLoaderStr, aType);
   }
 
   for (const Module::ContractIDEntry* e = mData->mContractIDs;
        e && e->contractid;
        ++e) {
-    r->RegisterFactoryLocation(*e->cid, "", e->contractid, aLocation,
-                               aLoaderStr, aType);
+    registrar->RegisterFactoryLocation(*e->cid, "", e->contractid, aLocation,
+                                       aLoaderStr, aType);
   }
 
   nsCOMPtr<nsICategoryManager> catman;
   for (const Module::CategoryEntry* e = mData->mCategoryEntries;
        e && e->category;
        ++e) {
     if (!catman) {
       catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
     }
 
-    nsAutoCString r;
+    nsAutoCString prevValue;
     catman->AddCategoryEntry(e->category, e->entry, e->value, true, true,
-                             getter_Copies(r));
+                             getter_Copies(prevValue));
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 GenericModule::UnregisterSelf(nsIComponentManager* aCompMgr,
                               nsIFile* aFile,
                               const char* aLoaderStr)
--- a/xpcom/glue/moz.build
+++ b/xpcom/glue/moz.build
@@ -115,8 +115,11 @@ if CONFIG['ENABLE_TESTS']:
 USE_LIBS += [
     'fallible',
 ]
 
 # Force to build a static library only
 NO_EXPAND_LIBS = True
 
 DIST_INSTALL = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
--- a/xpcom/glue/nsCRTGlue.cpp
+++ b/xpcom/glue/nsCRTGlue.cpp
@@ -273,29 +273,29 @@ NS_IsAsciiWhitespace(char16_t aChar)
 }
 
 bool
 NS_IsAsciiDigit(char16_t aChar)
 {
   return aChar >= '0' && aChar <= '9';
 }
 
-
 #ifndef XPCOM_GLUE_AVOID_NSPR
-#define TABLE_SIZE 36
-static const char table[] = {
-  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
-  'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
-  'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
-  '4', '5', '6', '7', '8', '9'
-};
 
 void
 NS_MakeRandomString(char* aBuf, int32_t aBufLen)
 {
+#define TABLE_SIZE 36
+  static const char table[] = {
+    'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
+    'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
+    'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
+    '4', '5', '6', '7', '8', '9'
+  };
+
   // turn PR_Now() into milliseconds since epoch
   // and salt rand with that.
   static unsigned int seed = 0;
   if (seed == 0) {
     double fpTime = double(PR_Now());
     seed = (unsigned int)(fpTime * 1e-6 + 0.5); // use 1e-6, granularity of PR_Now() on the mac is seconds
     srand(seed);
   }
@@ -430,10 +430,8 @@ fprintf_stderr(FILE* aFile, const char* 
   va_start(args, aFmt);
   if (aFile == stderr) {
     vprintf_stderr(aFmt, args);
   } else {
     vfprintf(aFile, aFmt, args);
   }
   va_end(args);
 }
-
-
--- a/xpcom/glue/nsTArray-inl.h
+++ b/xpcom/glue/nsTArray-inl.h
@@ -262,18 +262,18 @@ nsTArray_base<Alloc, Copy>::ShiftData(in
     // Maybe nothing needs to be shifted
     if (num == 0) {
       return;
     }
     // Perform shift (change units to bytes first)
     aStart *= aElemSize;
     aNewLen *= aElemSize;
     aOldLen *= aElemSize;
-    char* base = reinterpret_cast<char*>(mHdr + 1) + aStart;
-    Copy::MoveElements(base + aNewLen, base + aOldLen, num, aElemSize);
+    char* baseAddr = reinterpret_cast<char*>(mHdr + 1) + aStart;
+    Copy::MoveElements(baseAddr + aNewLen, baseAddr + aOldLen, num, aElemSize);
   }
 }
 
 template<class Alloc, class Copy>
 template<typename ActualAlloc>
 bool
 nsTArray_base<Alloc, Copy>::InsertSlotsAt(index_type aIndex, size_type aCount,
                                           size_type aElemSize,
--- a/xpcom/glue/tests/gtest/TestThreadUtils.cpp
+++ b/xpcom/glue/tests/gtest/TestThreadUtils.cpp
@@ -284,76 +284,76 @@ TEST(ThreadUtils, main)
   static_assert(IsParameterStorageClass<StoreCopyPassByPtr<int>>::value,
                 "StoreCopyPassByPtr<int> should be recognized as Storage Class");
 
   nsRefPtr<ThreadUtilsObject> rpt(new ThreadUtilsObject);
   int count = 0;
 
   // Test legacy functions.
 
-  nsCOMPtr<nsIRunnable> r =
+  nsCOMPtr<nsIRunnable> r1 =
     NS_NewRunnableMethod(rpt, &ThreadUtilsObject::Test0);
-  r->Run();
+  r1->Run();
   EXPECT_EQ(count += 1, rpt->mCount);
 
-  r = NS_NewRunnableMethodWithArg<int>(rpt, &ThreadUtilsObject::Test1i, 11);
-  r->Run();
+  r1 = NS_NewRunnableMethodWithArg<int>(rpt, &ThreadUtilsObject::Test1i, 11);
+  r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(11, rpt->mA0);
 
   // Test variadic function with simple POD arguments.
 
-  r = NS_NewRunnableMethodWithArgs(rpt, &ThreadUtilsObject::Test0);
-  r->Run();
+  r1 = NS_NewRunnableMethodWithArgs(rpt, &ThreadUtilsObject::Test0);
+  r1->Run();
   EXPECT_EQ(count += 1, rpt->mCount);
 
   static_assert(
       mozilla::IsSame< ::detail::ParameterStorage<int>::Type,
                       StoreCopyPassByValue<int>>::value,
       "detail::ParameterStorage<int>::Type should be StoreCopyPassByValue<int>");
   static_assert(
       mozilla::IsSame< ::detail::ParameterStorage<StoreCopyPassByValue<int>>::Type,
                       StoreCopyPassByValue<int>>::value,
       "detail::ParameterStorage<StoreCopyPassByValue<int>>::Type should be StoreCopyPassByValue<int>");
 
-  r = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, 12);
-  r->Run();
+  r1 = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, 12);
+  r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(12, rpt->mA0);
 
-  r = NS_NewRunnableMethodWithArgs<int, int>(
-      rpt, &ThreadUtilsObject::Test2i, 21, 22);
-  r->Run();
+  r1 = NS_NewRunnableMethodWithArgs<int, int>(
+       rpt, &ThreadUtilsObject::Test2i, 21, 22);
+  r1->Run();
   EXPECT_EQ(count += 3, rpt->mCount);
   EXPECT_EQ(21, rpt->mA0);
   EXPECT_EQ(22, rpt->mA1);
 
-  r = NS_NewRunnableMethodWithArgs<int, int, int>(
-      rpt, &ThreadUtilsObject::Test3i, 31, 32, 33);
-  r->Run();
+  r1 = NS_NewRunnableMethodWithArgs<int, int, int>(
+       rpt, &ThreadUtilsObject::Test3i, 31, 32, 33);
+  r1->Run();
   EXPECT_EQ(count += 4, rpt->mCount);
   EXPECT_EQ(31, rpt->mA0);
   EXPECT_EQ(32, rpt->mA1);
   EXPECT_EQ(33, rpt->mA2);
 
-  r = NS_NewRunnableMethodWithArgs<int, int, int, int>(
-      rpt, &ThreadUtilsObject::Test4i, 41, 42, 43, 44);
-  r->Run();
+  r1 = NS_NewRunnableMethodWithArgs<int, int, int, int>(
+       rpt, &ThreadUtilsObject::Test4i, 41, 42, 43, 44);
+  r1->Run();
   EXPECT_EQ(count += 5, rpt->mCount);
   EXPECT_EQ(41, rpt->mA0);
   EXPECT_EQ(42, rpt->mA1);
   EXPECT_EQ(43, rpt->mA2);
   EXPECT_EQ(44, rpt->mA3);
 
   // More interesting types of arguments.
 
   // Passing a short to make sure forwarding works with an inexact type match.
   short int si = 11;
-  r = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, si);
-  r->Run();
+  r1 = NS_NewRunnableMethodWithArgs<int>(rpt, &ThreadUtilsObject::Test1i, si);
+  r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(si, rpt->mA0);
 
   // Raw pointer, possible cv-qualified.
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<int*>::Type,
                                 StorePtrPassByPtr<int>>::value,
                 "detail::ParameterStorage<int*>::Type should be StorePtrPassByPtr<int>");
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<int* const>::Type,
@@ -368,18 +368,18 @@ TEST(ThreadUtils, main)
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<int*>::Type::stored_type,
                                 int*>::value,
                 "detail::ParameterStorage<int*>::Type::stored_type should be int*");
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<int*>::Type::passed_type,
                                 int*>::value,
                 "detail::ParameterStorage<int*>::Type::passed_type should be int*");
   {
     int i = 12;
-    r = NS_NewRunnableMethodWithArgs<int*>(rpt, &ThreadUtilsObject::Test1pi, &i);
-    r->Run();
+    r1 = NS_NewRunnableMethodWithArgs<int*>(rpt, &ThreadUtilsObject::Test1pi, &i);
+    r1->Run();
     EXPECT_EQ(count += 2, rpt->mCount);
     EXPECT_EQ(i, rpt->mA0);
   }
 
   // Raw pointer to const.
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<const int*>::Type,
                                 StoreConstPtrPassByConstPtr<int>>::value,
                 "detail::ParameterStorage<const int*>::Type should be StoreConstPtrPassByConstPtr<int>");
@@ -395,50 +395,50 @@ TEST(ThreadUtils, main)
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<const int*>::Type::stored_type,
                                 const int*>::value,
                 "detail::ParameterStorage<const int*>::Type::stored_type should be const int*");
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<const int*>::Type::passed_type,
                                 const int*>::value,
                 "detail::ParameterStorage<const int*>::Type::passed_type should be const int*");
   {
     int i = 1201;
-    r = NS_NewRunnableMethodWithArgs<const int*>(rpt, &ThreadUtilsObject::Test1pci, &i);
-    r->Run();
+    r1 = NS_NewRunnableMethodWithArgs<const int*>(rpt, &ThreadUtilsObject::Test1pci, &i);
+    r1->Run();
     EXPECT_EQ(count += 2, rpt->mCount);
     EXPECT_EQ(i, rpt->mA0);
   }
 
   // Raw pointer to copy.
   static_assert(mozilla::IsSame<StoreCopyPassByPtr<int>::stored_type,
                                 int>::value,
                 "StoreCopyPassByPtr<int>::stored_type should be int");
   static_assert(mozilla::IsSame<StoreCopyPassByPtr<int>::passed_type,
                                 int*>::value,
                 "StoreCopyPassByPtr<int>::passed_type should be int*");
   {
     int i = 1202;
-    r = NS_NewRunnableMethodWithArgs<StoreCopyPassByPtr<int>>(
-        rpt, &ThreadUtilsObject::Test1pi, i);
-    r->Run();
+    r1 = NS_NewRunnableMethodWithArgs<StoreCopyPassByPtr<int>>(
+         rpt, &ThreadUtilsObject::Test1pi, i);
+    r1->Run();
     EXPECT_EQ(count += 2, rpt->mCount);
     EXPECT_EQ(i, rpt->mA0);
   }
 
   // Raw pointer to const copy.
   static_assert(mozilla::IsSame<StoreCopyPassByConstPtr<int>::stored_type,
                                 int>::value,
                 "StoreCopyPassByConstPtr<int>::stored_type should be int");
   static_assert(mozilla::IsSame<StoreCopyPassByConstPtr<int>::passed_type,
                                 const int*>::value,
                 "StoreCopyPassByConstPtr<int>::passed_type should be const int*");
   {
     int i = 1203;
-    r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstPtr<int>>(
-        rpt, &ThreadUtilsObject::Test1pci, i);
-    r->Run();
+    r1 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstPtr<int>>(
+         rpt, &ThreadUtilsObject::Test1pci, i);
+    r1->Run();
     EXPECT_EQ(count += 2, rpt->mCount);
     EXPECT_EQ(i, rpt->mA0);
   }
 
   // nsRefPtr to pointer.
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<StorensRefPtrPassByPtr<SpyWithISupports>>::Type,
                                 StorensRefPtrPassByPtr<SpyWithISupports>>::value,
                 "ParameterStorage<StorensRefPtrPassByPtr<SpyWithISupports>>::Type should be StorensRefPtrPassByPtr<SpyWithISupports>");
@@ -486,18 +486,18 @@ TEST(ThreadUtils, main)
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<int&>::Type::stored_type,
                                 int&>::value,
                 "ParameterStorage<int&>::Type::stored_type should be int&");
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<int&>::Type::passed_type,
                                 int&>::value,
                 "ParameterStorage<int&>::Type::passed_type should be int&");
   {
     int i = 13;
-    r = NS_NewRunnableMethodWithArgs<int&>(rpt, &ThreadUtilsObject::Test1ri, i);
-    r->Run();
+    r1 = NS_NewRunnableMethodWithArgs<int&>(rpt, &ThreadUtilsObject::Test1ri, i);
+    r1->Run();
     EXPECT_EQ(count += 2, rpt->mCount);
     EXPECT_EQ(i, rpt->mA0);
   }
 
   // Rvalue reference -- Actually storing a copy and then moving it.
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<int&&>::Type,
                                 StoreCopyPassByRRef<int>>::value,
                 "ParameterStorage<int&&>::Type should be StoreCopyPassByRRef<int>");
@@ -507,20 +507,20 @@ TEST(ThreadUtils, main)
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<int&&>::Type::stored_type,
                                 int>::value,
                 "ParameterStorage<int&&>::Type::stored_type should be int");
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<int&&>::Type::passed_type,
                                 int&&>::value,
                 "ParameterStorage<int&&>::Type::passed_type should be int&&");
   {
     int i = 14;
-    r = NS_NewRunnableMethodWithArgs<int&&>(
+    r1 = NS_NewRunnableMethodWithArgs<int&&>(
           rpt, &ThreadUtilsObject::Test1rri, mozilla::Move(i));
   }
-  r->Run();
+  r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(14, rpt->mA0);
 
   // Null unique pointer, by semi-implicit store&move with "T&&" syntax.
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<mozilla::UniquePtr<int>&&>::Type,
                                 StoreCopyPassByRRef<mozilla::UniquePtr<int>>>::value,
                 "ParameterStorage<UniquePtr<int>&&>::Type should be StoreCopyPassByRRef<UniquePtr<int>>");
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<mozilla::UniquePtr<int>&&>::Type::stored_type,
@@ -529,20 +529,20 @@ TEST(ThreadUtils, main)
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<mozilla::UniquePtr<int>&&>::Type::stored_type,
                                 mozilla::UniquePtr<int>>::value,
                 "ParameterStorage<UniquePtr<int>&&>::Type::stored_type should be UniquePtr<int>");
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<mozilla::UniquePtr<int>&&>::Type::passed_type,
                                 mozilla::UniquePtr<int>&&>::value,
                 "ParameterStorage<UniquePtr<int>&&>::Type::passed_type should be UniquePtr<int>&&");
   {
     mozilla::UniquePtr<int> upi;
-    r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
+    r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
           rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
   }
-  r->Run();
+  r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(-1, rpt->mA0);
   rpt->mA0 = 0;
 
   // Null unique pointer, by explicit store&move with "StoreCopyPassByRRef<T>" syntax.
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>::Type::stored_type,
                                 StoreCopyPassByRRef<mozilla::UniquePtr<int>>::stored_type>::value,
                 "ParameterStorage<StoreCopyPassByRRef<UniquePtr<int>>>::Type::stored_type should be StoreCopyPassByRRef<UniquePtr<int>>::stored_type");
@@ -552,255 +552,255 @@ TEST(ThreadUtils, main)
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>::Type::stored_type,
                                 mozilla::UniquePtr<int>>::value,
                 "ParameterStorage<StoreCopyPassByRRef<UniquePtr<int>>>::Type::stored_type should be UniquePtr<int>");
   static_assert(mozilla::IsSame< ::detail::ParameterStorage<StoreCopyPassByRRef<mozilla::UniquePtr<int>>>::Type::passed_type,
                                 mozilla::UniquePtr<int>&&>::value,
                 "ParameterStorage<StoreCopyPassByRRef<UniquePtr<int>>>::Type::passed_type should be UniquePtr<int>&&");
   {
     mozilla::UniquePtr<int> upi;
-    r = NS_NewRunnableMethodWithArgs
-        <StoreCopyPassByRRef<mozilla::UniquePtr<int>>>(
-          rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
+    r1 = NS_NewRunnableMethodWithArgs
+         <StoreCopyPassByRRef<mozilla::UniquePtr<int>>>(
+           rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
   }
-  r->Run();
+  r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(-1, rpt->mA0);
 
   // Unique pointer as xvalue.
   {
     mozilla::UniquePtr<int> upi = mozilla::MakeUnique<int>(1);
-    r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
-          rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
+    r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
+           rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
   }
-  r->Run();
+  r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(1, rpt->mA0);
 
   {
     mozilla::UniquePtr<int> upi = mozilla::MakeUnique<int>(1);
-    r = NS_NewRunnableMethodWithArgs
-        <StoreCopyPassByRRef<mozilla::UniquePtr<int>>>
-        (rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
+    r1 = NS_NewRunnableMethodWithArgs
+         <StoreCopyPassByRRef<mozilla::UniquePtr<int>>>
+         (rpt, &ThreadUtilsObject::Test1upi, mozilla::Move(upi));
   }
-  r->Run();
+  r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(1, rpt->mA0);
 
   // Unique pointer as prvalue.
-  r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
-        rpt, &ThreadUtilsObject::Test1upi, mozilla::MakeUnique<int>(2));
-  r->Run();
+  r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&&>(
+         rpt, &ThreadUtilsObject::Test1upi, mozilla::MakeUnique<int>(2));
+  r1->Run();
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(2, rpt->mA0);
 
   // Unique pointer as lvalue to lref.
   {
     mozilla::UniquePtr<int> upi;
-    r = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&>(
-          rpt, &ThreadUtilsObject::Test1rupi, upi);
+    r1 = NS_NewRunnableMethodWithArgs<mozilla::UniquePtr<int>&>(
+           rpt, &ThreadUtilsObject::Test1rupi, upi);
     // Passed as lref, so Run() must be called while local upi is still alive!
-    r->Run();
+    r1->Run();
   }
   EXPECT_EQ(count += 2, rpt->mCount);
   EXPECT_EQ(-1, rpt->mA0);
 
   // Verify copy/move assumptions.
 
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store copy from lvalue, pass by value\n", __LINE__); }
   { // Block around nsCOMPtr lifetime.
-    nsCOMPtr<nsIRunnable> r;
+    nsCOMPtr<nsIRunnable> r2;
     { // Block around Spy lifetime.
       if (gDebug) { printf("%d - Spy s(10)\n", __LINE__); }
       Spy s(10);
       EXPECT_EQ(1, gConstructions);
       EXPECT_EQ(1, gAlive);
-      if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, s)\n", __LINE__); }
-      r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
-          rpt, &ThreadUtilsObject::TestByValue, s);
+      if (gDebug) { printf("%d - r2 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, s)\n", __LINE__); }
+      r2 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
+           rpt, &ThreadUtilsObject::TestByValue, s);
       EXPECT_EQ(2, gAlive);
       EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction.
       Spy::ClearActions();
       if (gDebug) { printf("%d - End block with Spy s(10)\n", __LINE__); }
     }
     EXPECT_EQ(1, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r2->Run();
     EXPECT_LE(1, gCopyConstructions); // Another copy-construction in call.
     EXPECT_EQ(10, rpt->mSpy.mID);
     EXPECT_LE(1, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
   if (gDebug) { printf("%d - After end block with r\n", __LINE__); }
   EXPECT_EQ(1, gDestructions);
   EXPECT_EQ(0, gAlive);
 
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by value\n", __LINE__); }
   {
-    if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, Spy(11))\n", __LINE__); }
-    nsCOMPtr<nsIRunnable> r =
+    if (gDebug) { printf("%d - r3 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(&TestByValue, Spy(11))\n", __LINE__); }
+    nsCOMPtr<nsIRunnable> r3 =
       NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
         rpt, &ThreadUtilsObject::TestByValue, Spy(11));
     EXPECT_EQ(1, gAlive);
     EXPECT_EQ(1, gConstructions);
     EXPECT_LE(1, gMoveConstructions);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r3->Run();
     EXPECT_LE(1, gCopyConstructions); // Another copy-construction in call.
     EXPECT_EQ(11, rpt->mSpy.mID);
     EXPECT_LE(1, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
   if (gDebug) { printf("%d - After end block with r\n", __LINE__); }
   EXPECT_EQ(1, gDestructions);
   EXPECT_EQ(0, gAlive);
 
   Spy::ClearAll();
   { // Store copy from xvalue, pass by value.
-    nsCOMPtr<nsIRunnable> r;
+    nsCOMPtr<nsIRunnable> r4;
     {
       Spy s(12);
       EXPECT_EQ(1, gConstructions);
       EXPECT_EQ(1, gAlive);
       Spy::ClearActions();
-      r = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
+      r4 = NS_NewRunnableMethodWithArgs<StoreCopyPassByValue<Spy>>(
           rpt, &ThreadUtilsObject::TestByValue, mozilla::Move(s));
       EXPECT_LE(1, gMoveConstructions);
       EXPECT_EQ(1, gAlive);
       EXPECT_EQ(1, gZombies);
       Spy::ClearActions();
     }
     EXPECT_EQ(1, gDestructions);
     EXPECT_EQ(1, gAlive);
     EXPECT_EQ(0, gZombies);
     Spy::ClearActions();
-    r->Run();
+    r4->Run();
     EXPECT_LE(1, gCopyConstructions); // Another copy-construction in call.
     EXPECT_EQ(12, rpt->mSpy.mID);
     EXPECT_LE(1, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
   }
   EXPECT_EQ(1, gDestructions);
   EXPECT_EQ(0, gAlive);
   // Won't test xvalues anymore, prvalues are enough to verify all rvalues.
 
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store copy from lvalue, pass by const lvalue ref\n", __LINE__); }
   { // Block around nsCOMPtr lifetime.
-    nsCOMPtr<nsIRunnable> r;
+    nsCOMPtr<nsIRunnable> r5;
     { // Block around Spy lifetime.
       if (gDebug) { printf("%d - Spy s(20)\n", __LINE__); }
       Spy s(20);
       EXPECT_EQ(1, gConstructions);
       EXPECT_EQ(1, gAlive);
-      if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, s)\n", __LINE__); }
-      r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(
-          rpt, &ThreadUtilsObject::TestByConstLRef, s);
+      if (gDebug) { printf("%d - r5 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, s)\n", __LINE__); }
+      r5 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(
+           rpt, &ThreadUtilsObject::TestByConstLRef, s);
       EXPECT_EQ(2, gAlive);
       EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction.
       Spy::ClearActions();
       if (gDebug) { printf("%d - End block with Spy s(20)\n", __LINE__); }
     }
     EXPECT_EQ(1, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r5->Run();
     EXPECT_EQ(0, gCopyConstructions); // No copies in call.
     EXPECT_EQ(20, rpt->mSpy.mID);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
   if (gDebug) { printf("%d - After end block with r\n", __LINE__); }
   EXPECT_EQ(1, gDestructions);
   EXPECT_EQ(0, gAlive);
 
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by const lvalue ref\n", __LINE__); }
   {
-    if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, Spy(21))\n", __LINE__); }
-    nsCOMPtr<nsIRunnable> r =
+    if (gDebug) { printf("%d - r6 = NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(&TestByConstLRef, Spy(21))\n", __LINE__); }
+    nsCOMPtr<nsIRunnable> r6 =
       NS_NewRunnableMethodWithArgs<StoreCopyPassByConstLRef<Spy>>(
         rpt, &ThreadUtilsObject::TestByConstLRef, Spy(21));
     EXPECT_EQ(1, gAlive);
     EXPECT_EQ(1, gConstructions);
     EXPECT_LE(1, gMoveConstructions);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r6->Run();
     EXPECT_EQ(0, gCopyConstructions); // No copies in call.
     EXPECT_EQ(21, rpt->mSpy.mID);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
   if (gDebug) { printf("%d - After end block with r\n", __LINE__); }
   EXPECT_EQ(1, gDestructions);
   EXPECT_EQ(0, gAlive);
 
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store copy from lvalue, pass by rvalue ref\n", __LINE__); }
   { // Block around nsCOMPtr lifetime.
-    nsCOMPtr<nsIRunnable> r;
+    nsCOMPtr<nsIRunnable> r7;
     { // Block around Spy lifetime.
       if (gDebug) { printf("%d - Spy s(30)\n", __LINE__); }
       Spy s(30);
       EXPECT_EQ(1, gConstructions);
       EXPECT_EQ(1, gAlive);
-      if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, s)\n", __LINE__); }
-      r = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(
-          rpt, &ThreadUtilsObject::TestByRRef, s);
+      if (gDebug) { printf("%d - r7 = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, s)\n", __LINE__); }
+      r7 = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(
+           rpt, &ThreadUtilsObject::TestByRRef, s);
       EXPECT_EQ(2, gAlive);
       EXPECT_LE(1, gCopyConstructions); // At least 1 copy-construction.
       Spy::ClearActions();
       if (gDebug) { printf("%d - End block with Spy s(30)\n", __LINE__); }
     }
     EXPECT_EQ(1, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r7->Run();
     EXPECT_LE(1, gMoves); // Move in call.
     EXPECT_EQ(30, rpt->mSpy.mID);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(0, gAlive); // Spy inside Test is not counted.
     EXPECT_EQ(1, gZombies); // Our local spy should now be a zombie.
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
   if (gDebug) { printf("%d - After end block with r\n", __LINE__); }
   EXPECT_EQ(1, gDestructions);
   EXPECT_EQ(0, gAlive);
 
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store copy from prvalue, pass by rvalue ref\n", __LINE__); }
   {
-    if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, Spy(31))\n", __LINE__); }
-    nsCOMPtr<nsIRunnable> r =
+    if (gDebug) { printf("%d - r8 = NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(&TestByRRef, Spy(31))\n", __LINE__); }
+    nsCOMPtr<nsIRunnable> r8 =
       NS_NewRunnableMethodWithArgs<StoreCopyPassByRRef<Spy>>(
         rpt, &ThreadUtilsObject::TestByRRef, Spy(31));
     EXPECT_EQ(1, gAlive);
     EXPECT_EQ(1, gConstructions);
     EXPECT_LE(1, gMoveConstructions);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r8->Run();
     EXPECT_LE(1, gMoves); // Move in call.
     EXPECT_EQ(31, rpt->mSpy.mID);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(0, gAlive); // Spy inside Test is not counted.
     EXPECT_EQ(1, gZombies); // Our local spy should now be a zombie.
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
@@ -811,62 +811,62 @@ TEST(ThreadUtils, main)
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store lvalue ref, pass lvalue ref\n", __LINE__); }
   {
     if (gDebug) { printf("%d - Spy s(40)\n", __LINE__); }
     Spy s(40);
     EXPECT_EQ(1, gConstructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
-    if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<Spy&>(&TestByLRef, s)\n", __LINE__); }
-    nsCOMPtr<nsIRunnable> r =
+    if (gDebug) { printf("%d - r9 = NS_NewRunnableMethodWithArgs<Spy&>(&TestByLRef, s)\n", __LINE__); }
+    nsCOMPtr<nsIRunnable> r9 =
       NS_NewRunnableMethodWithArgs<Spy&>(
         rpt, &ThreadUtilsObject::TestByLRef, s);
     EXPECT_EQ(0, gAllConstructions);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r9->Run();
     EXPECT_LE(1, gAssignments); // Assignment from reference in call.
     EXPECT_EQ(40, rpt->mSpy.mID);
     EXPECT_EQ(&s, rpt->mSpyPtr);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive); // Spy inside Test is not counted.
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
   if (gDebug) { printf("%d - After end block with r\n", __LINE__); }
   EXPECT_EQ(1, gDestructions);
   EXPECT_EQ(0, gAlive);
 
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store nsRefPtr, pass by pointer\n", __LINE__); }
   { // Block around nsCOMPtr lifetime.
-    nsCOMPtr<nsIRunnable> r;
+    nsCOMPtr<nsIRunnable> r10;
     SpyWithISupports* ptr = 0;
     { // Block around nsRefPtr<Spy> lifetime.
       if (gDebug) { printf("%d - nsRefPtr<SpyWithISupports> s(new SpyWithISupports(45))\n", __LINE__); }
       nsRefPtr<SpyWithISupports> s(new SpyWithISupports(45));
       ptr = s.get();
       EXPECT_EQ(1, gConstructions);
       EXPECT_EQ(1, gAlive);
-      if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<Spy>>(&TestByRRef, s.get())\n", __LINE__); }
-      r = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<SpyWithISupports>>(
-          rpt, &ThreadUtilsObject::TestByPointer, s.get());
+      if (gDebug) { printf("%d - r10 = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<Spy>>(&TestByRRef, s.get())\n", __LINE__); }
+      r10 = NS_NewRunnableMethodWithArgs<StorensRefPtrPassByPtr<SpyWithISupports>>(
+            rpt, &ThreadUtilsObject::TestByPointer, s.get());
       EXPECT_LE(0, gAllConstructions);
       EXPECT_EQ(1, gAlive);
       Spy::ClearActions();
       if (gDebug) { printf("%d - End block with nsRefPtr<Spy> s\n", __LINE__); }
     }
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r10->Run();
     EXPECT_LE(1, gAssignments); // Assignment from pointee in call.
     EXPECT_EQ(45, rpt->mSpy.mID);
     EXPECT_EQ(ptr, rpt->mSpyPtr);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive); // Spy inside Test is not counted.
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
@@ -877,26 +877,26 @@ TEST(ThreadUtils, main)
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store pointer to lvalue, pass by pointer\n", __LINE__); }
   {
     if (gDebug) { printf("%d - Spy s(55)\n", __LINE__); }
     Spy s(55);
     EXPECT_EQ(1, gConstructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
-    if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
-    nsCOMPtr<nsIRunnable> r =
+    if (gDebug) { printf("%d - r11 = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
+    nsCOMPtr<nsIRunnable> r11 =
       NS_NewRunnableMethodWithArgs<Spy*>(
         rpt, &ThreadUtilsObject::TestByPointer, &s);
     EXPECT_EQ(0, gAllConstructions);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r11->Run();
     EXPECT_LE(1, gAssignments); // Assignment from pointee in call.
     EXPECT_EQ(55, rpt->mSpy.mID);
     EXPECT_EQ(&s, rpt->mSpyPtr);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive); // Spy inside Test is not counted.
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
@@ -907,26 +907,26 @@ TEST(ThreadUtils, main)
   Spy::ClearAll();
   if (gDebug) { printf("%d - Test: Store pointer to const lvalue, pass by pointer\n", __LINE__); }
   {
     if (gDebug) { printf("%d - Spy s(60)\n", __LINE__); }
     Spy s(60);
     EXPECT_EQ(1, gConstructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
-    if (gDebug) { printf("%d - r = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
-    nsCOMPtr<nsIRunnable> r =
+    if (gDebug) { printf("%d - r12 = NS_NewRunnableMethodWithArgs<Spy*>(&TestByPointer, s)\n", __LINE__); }
+    nsCOMPtr<nsIRunnable> r12 =
       NS_NewRunnableMethodWithArgs<const Spy*>(
         rpt, &ThreadUtilsObject::TestByPointerToConst, &s);
     EXPECT_EQ(0, gAllConstructions);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive);
     Spy::ClearActions();
     if (gDebug) { printf("%d - Run()\n", __LINE__); }
-    r->Run();
+    r12->Run();
     EXPECT_LE(1, gAssignments); // Assignment from pointee in call.
     EXPECT_EQ(60, rpt->mSpy.mID);
     EXPECT_EQ(&s, rpt->mSpyPtr);
     EXPECT_EQ(0, gDestructions);
     EXPECT_EQ(1, gAlive); // Spy inside Test is not counted.
     Spy::ClearActions();
     if (gDebug) { printf("%d - End block with r\n", __LINE__); }
   }
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
@@ -120,16 +120,17 @@ UNIFIED_SOURCES += [
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     SOURCES += [
         'CocoaFileUtils.mm',
     ]
 
 if CONFIG['GNU_CC']:
     CFLAGS += ['-Wshadow']
+    CXXFLAGS += ['-Wshadow']
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
     DEFINES['HAVE_USR_LIB64_DIR'] = True
 
--- a/xpcom/io/nsEscape.cpp
+++ b/xpcom/io/nsEscape.cpp
@@ -7,17 +7,18 @@
 #include "nsEscape.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/BinarySearch.h"
 #include "nsTArray.h"
 #include "nsCRT.h"
 #include "plstr.h"
 
-static const char hexChars[] = "0123456789ABCDEF";
+static const char hexCharsUpper[] = "0123456789ABCDEF";
+static const char hexCharsUpperLower[] = "0123456789ABCDEFabcdef";
 
 static const int netCharType[256] =
 /*  Bit 0       xalpha      -- the alphas
 **  Bit 1       xpalpha     -- as xalpha but
 **                             converts spaces to plus and plus to %2B
 **  Bit 3 ...   path        -- as xalphas but doesn't escape '/'
 */
   /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
@@ -46,33 +47,33 @@ static const int netCharType[256] =
 
 static const uint32_t ENCODE_MAX_LEN = 6; // %uABCD
 
 static uint32_t
 AppendPercentHex(char* aBuffer, unsigned char aChar)
 {
   uint32_t i = 0;
   aBuffer[i++] = '%';
-  aBuffer[i++] = hexChars[aChar >> 4]; // high nibble
-  aBuffer[i++] = hexChars[aChar & 0xF]; // low nibble
+  aBuffer[i++] = hexCharsUpper[aChar >> 4]; // high nibble
+  aBuffer[i++] = hexCharsUpper[aChar & 0xF]; // low nibble
   return i;
 }
 
 static uint32_t
 AppendPercentHex(char16_t* aBuffer, char16_t aChar)
 {
   uint32_t i = 0;
   aBuffer[i++] = '%';
   if (aChar & 0xff00) {
     aBuffer[i++] = 'u';
-    aBuffer[i++] = hexChars[aChar >> 12]; // high-byte high nibble
-    aBuffer[i++] = hexChars[(aChar >> 8) & 0xF]; // high-byte low nibble
+    aBuffer[i++] = hexCharsUpper[aChar >> 12]; // high-byte high nibble
+    aBuffer[i++] = hexCharsUpper[(aChar >> 8) & 0xF]; // high-byte low nibble
   }
-  aBuffer[i++] = hexChars[(aChar >> 4) & 0xF]; // low-byte high nibble
-  aBuffer[i++] = hexChars[aChar & 0xF]; // low-byte low nibble
+  aBuffer[i++] = hexCharsUpper[(aChar >> 4) & 0xF]; // low-byte high nibble
+  aBuffer[i++] = hexCharsUpper[aChar & 0xF]; // low-byte low nibble
   return i;
 }
 
 //----------------------------------------------------------------------------------------
 static char*
 nsEscapeCount(const char* aStr, nsEscapeMask aFlags, size_t* aOutLen)
 //----------------------------------------------------------------------------------------
 {
@@ -119,29 +120,29 @@ nsEscapeCount(const char* aStr, nsEscape
     for (size_t i = 0; i < len; ++i) {
       unsigned char c = *src++;
       if (IS_OK(c)) {
         *dst++ = c;
       } else if (c == ' ') {
         *dst++ = '+';  /* convert spaces to pluses */
       } else {
         *dst++ = HEX_ESCAPE;
-        *dst++ = hexChars[c >> 4];  /* high nibble */
-        *dst++ = hexChars[c & 0x0f];  /* low nibble */
+        *dst++ = hexCharsUpper[c >> 4];  /* high nibble */
+        *dst++ = hexCharsUpper[c & 0x0f];  /* low nibble */
       }
     }
   } else {
     for (size_t i = 0; i < len; ++i) {
       unsigned char c = *src++;
       if (IS_OK(c)) {
         *dst++ = c;
       } else {
         *dst++ = HEX_ESCAPE;
-        *dst++ = hexChars[c >> 4];  /* high nibble */
-        *dst++ = hexChars[c & 0x0f];  /* low nibble */
+        *dst++ = hexCharsUpper[c >> 4];  /* high nibble */
+        *dst++ = hexCharsUpper[c & 0x0f];  /* low nibble */
       }
     }
   }
 
   *dst = '\0';     /* tack on eos */
   if (aOutLen) {
     *aOutLen = dst - (unsigned char*)result;
   }
@@ -170,17 +171,16 @@ nsUnescape(char* aStr)
 
 //----------------------------------------------------------------------------------------
 int32_t
 nsUnescapeCount(char* aStr)
 //----------------------------------------------------------------------------------------
 {
   char* src = aStr;
   char* dst = aStr;
-  static const char hexChars[] = "0123456789ABCDEFabcdef";
 
   char c1[] = " ";
   char c2[] = " ";
   char* const pc1 = c1;
   char* const pc2 = c2;
 
   if (!*src) {
     // A null string was passed in.  Nothing to escape.
@@ -192,18 +192,18 @@ nsUnescapeCount(char* aStr)
   while (*src) {
     c1[0] = *(src + 1);
     if (*(src + 1) == '\0') {
       c2[0] = '\0';
     } else {
       c2[0] = *(src + 2);
     }
 
-    if (*src != HEX_ESCAPE || PL_strpbrk(pc1, hexChars) == 0 ||
-        PL_strpbrk(pc2, hexChars) == 0) {
+    if (*src != HEX_ESCAPE || PL_strpbrk(pc1, hexCharsUpperLower) == 0 ||
+        PL_strpbrk(pc2, hexCharsUpperLower) == 0) {
       *dst++ = *src++;
     } else {
       src++; /* walk over escape */
       if (*src) {
         *dst = UNHEX(*src) << 4;
         src++;
       }
       if (*src) {
@@ -493,48 +493,48 @@ FindFirstMatchFrom(const nsAFlatString& 
   return false;
 }
 
 const nsSubstring&
 NS_EscapeURL(const nsAFlatString& aStr, const nsTArray<char16_t>& aForbidden,
              nsSubstring& aResult)
 {
   bool didEscape = false;
-  for (size_t i = 0, len = aStr.Length(); i < len; ) {
+  for (size_t i = 0, strLen = aStr.Length(); i < strLen; ) {
     size_t j;
     if (MOZ_UNLIKELY(FindFirstMatchFrom(aStr, i, aForbidden, &j))) {
       if (i == 0) {
         didEscape = true;
         aResult.Truncate();
         aResult.SetCapacity(aStr.Length());
       }
       if (j != i) {
         // The substring from 'i' up to 'j' that needs no escaping.
         aResult.Append(nsDependentSubstring(aStr, i, j - i));
       }
       char16_t buffer[ENCODE_MAX_LEN];
-      uint32_t len = ::AppendPercentHex(buffer, aStr[j]);
-      MOZ_ASSERT(len <= ENCODE_MAX_LEN, "buffer overflow");
-      aResult.Append(buffer, len);
+      uint32_t bufferLen = ::AppendPercentHex(buffer, aStr[j]);
+      MOZ_ASSERT(bufferLen <= ENCODE_MAX_LEN, "buffer overflow");
+      aResult.Append(buffer, bufferLen);
       i = j + 1;
     } else {
       if (MOZ_UNLIKELY(didEscape)) {
         // The tail of the string that needs no escaping.
-        aResult.Append(nsDependentSubstring(aStr, i, len - i));
+        aResult.Append(nsDependentSubstring(aStr, i, strLen - i));
       }
       break;
     }
   }
   if (MOZ_UNLIKELY(didEscape)) {
     return aResult;
   }
   return aStr;
 }
 
-#define ISHEX(c) memchr(hexChars, c, sizeof(hexChars)-1)
+#define ISHEX(c) memchr(hexCharsUpperLower, c, sizeof(hexCharsUpperLower)-1)
 
 bool
 NS_UnescapeURL(const char* aStr, int32_t aLen, uint32_t aFlags,
                nsACString& aResult)
 {
   if (!aStr) {
     NS_NOTREACHED("null pointer");
     return false;
@@ -544,18 +544,16 @@ NS_UnescapeURL(const char* aStr, int32_t
     aLen = strlen(aStr);
   }
 
   bool ignoreNonAscii = !!(aFlags & esc_OnlyASCII);
   bool ignoreAscii = !!(aFlags & esc_OnlyNonASCII);
   bool writing = !!(aFlags & esc_AlwaysCopy);
   bool skipControl = !!(aFlags & esc_SkipControl);
 
-  static const char hexChars[] = "0123456789ABCDEFabcdef";
-
   const char* last = aStr;
   const char* p = aStr;
 
   for (int i = 0; i < aLen; ++i, ++p) {
     //printf("%c [i=%d of aLen=%d]\n", *p, i, aLen);
     if (*p == HEX_ESCAPE && i < aLen - 2) {
       unsigned char* p1 = (unsigned char*)p + 1;
       unsigned char* p2 = (unsigned char*)p + 2;
--- a/xpcom/io/nsLocalFileCommon.cpp
+++ b/xpcom/io/nsLocalFileCommon.cpp
@@ -133,19 +133,19 @@ nsLocalFile::CreateUnique(uint32_t aType
       if (maxRootLength == 0 && suffix.IsEmpty()) {
         return NS_ERROR_FILE_UNRECOGNIZED_PATH;
       }
     }
 
     rootName.SetLength(maxRootLength);
     SetNativeLeafName(rootName + suffix);
 #endif
-    nsresult rv = Create(aType, aAttributes);
-    if (rv != NS_ERROR_FILE_ALREADY_EXISTS) {
-      return rv;
+    nsresult rvCreate = Create(aType, aAttributes);
+    if (rvCreate != NS_ERROR_FILE_ALREADY_EXISTS) {
+      return rvCreate;
     }
   }
 
   for (int indx = 1; indx < 10000; ++indx) {
     // start with "Picture-1.jpg" after "Picture.jpg" exists
 #ifdef XP_WIN
     SetLeafName(rootName +
                 NS_ConvertASCIItoUTF16(nsPrintfCString("-%d", indx)) +
--- a/xpcom/io/nsMultiplexInputStream.cpp
+++ b/xpcom/io/nsMultiplexInputStream.cpp
@@ -94,36 +94,36 @@ AvailableMaybeSeek(nsIInputStream* aStre
   nsresult rv = aStream->Available(aResult);
   if (rv == NS_BASE_STREAM_CLOSED) {
     // Blindly seek to the current position if Available() returns
     // NS_BASE_STREAM_CLOSED.
     // If nsIFileInputStream is closed in Read() due to CLOSE_ON_EOF flag,
     // Seek() could reopen the file if REOPEN_ON_REWIND flag is set.
     nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(aStream);
     if (seekable) {
-      nsresult rv = seekable->Seek(nsISeekableStream::NS_SEEK_CUR, 0);
-      if (NS_SUCCEEDED(rv)) {
+      nsresult rvSeek = seekable->Seek(nsISeekableStream::NS_SEEK_CUR, 0);
+      if (NS_SUCCEEDED(rvSeek)) {
         rv = aStream->Available(aResult);
       }
     }
   }
   return rv;
 }
 
 static nsresult
 TellMaybeSeek(nsISeekableStream* aSeekable, int64_t* aResult)
 {
   nsresult rv = aSeekable->Tell(aResult);
   if (rv == NS_BASE_STREAM_CLOSED) {
     // Blindly seek to the current position if Tell() returns
     // NS_BASE_STREAM_CLOSED.
     // If nsIFileInputStream is closed in Read() due to CLOSE_ON_EOF flag,
     // Seek() could reopen the file if REOPEN_ON_REWIND flag is set.
-    nsresult rv = aSeekable->Seek(nsISeekableStream::NS_SEEK_CUR, 0);
-    if (NS_SUCCEEDED(rv)) {
+    nsresult rvSeek = aSeekable->Seek(nsISeekableStream::NS_SEEK_CUR, 0);
+    if (NS_SUCCEEDED(rvSeek)) {
       rv = aSeekable->Tell(aResult);
     }
   }
   return rv;
 }
 
 nsMultiplexInputStream::nsMultiplexInputStream()
   : mLock("nsMultiplexInputStream lock"),
@@ -823,9 +823,8 @@ nsMultiplexInputStream::Clone(nsIInputSt
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
 
   clone.forget(aClone);
   return NS_OK;
 }
-
--- a/xpcom/libxpcomrt/moz.build
+++ b/xpcom/libxpcomrt/moz.build
@@ -133,8 +133,11 @@ LOCAL_INCLUDES = [
 
 DEFINES['MOZILLA_INTERNAL_API'] = True
 DEFINES['MOZILLA_XPCOMRT_API'] = True
 DEFINES['MOZILLA_EXTERNAL_LINKAGE'] = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 SPHINX_TREES['libxpcomrt'] = 'docs'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
--- a/xpcom/reflect/xptcall/md/unix/moz.build
+++ b/xpcom/reflect/xptcall/md/unix/moz.build
@@ -320,8 +320,11 @@ if CONFIG['OS_ARCH'] == 'Linux':
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../..',
     '/xpcom/reflect/xptinfo',
 ]
 
 NO_PGO = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
--- a/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
+++ b/xpcom/reflect/xptinfo/xptiInterfaceInfo.cpp
@@ -598,21 +598,21 @@ xptiInterfaceEntry::GetInterfaceIsArgNum
         NS_ERROR("not an iid_is");
         return NS_ERROR_INVALID_ARG;
     }
 
     *argnum = td->argnum;
     return NS_OK;
 }
 
-nsresult 
-xptiInterfaceEntry::IsIID(const nsIID * IID, bool *_retval)
+nsresult
+xptiInterfaceEntry::IsIID(const nsIID * iid, bool *_retval)
 {
     // It is not necessary to Resolve because this info is read from manifest.
-    *_retval = mIID.Equals(*IID);
+    *_retval = mIID.Equals(*iid);
     return NS_OK;
 }
 
 nsresult 
 xptiInterfaceEntry::GetNameShared(const char **name)
 {
     // It is not necessary to Resolve because this info is read from manifest.
     *name = mName;
--- a/xpcom/string/moz.build
+++ b/xpcom/string/moz.build
@@ -52,8 +52,11 @@ UNIFIED_SOURCES += [
 
 # Are we targeting x86 or x86-64?  If so, compile the SSE2 functions for
 # nsUTF8Utils.cpp.
 if CONFIG['INTEL_ARCHITECTURE']:
     SOURCES += ['nsUTF8UtilsSSE2.cpp']
     SOURCES['nsUTF8UtilsSSE2.cpp'].flags += CONFIG['SSE2_FLAGS']
 
 FINAL_LIBRARY = 'xul'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
--- a/xpcom/tests/TestHashtables.cpp
+++ b/xpcom/tests/TestHashtables.cpp
@@ -634,20 +634,20 @@ main(void) {
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Getting entry %s...", gEntities[i].mStr);
     
     nsCOMPtr<IFoo> myEnt;
     if (!UniToEntClass2.Get(gEntities[i].mUnicode, getter_AddRefs(myEnt))) {
       printf("FAILED\n");
       exit (30);
     }
-    
-    nsAutoCString str;
-    myEnt->GetString(str);
-    printf("Found %s\n", str.get());
+
+    nsAutoCString myEntStr;
+    myEnt->GetString(myEntStr);
+    printf("Found %s\n", myEntStr.get());
   }
 
   printf("Testing nonexistent entries...");
   nsCOMPtr<IFoo> myEnt;
   if (UniToEntClass2.Get(9462, getter_AddRefs(myEnt))) {
     printf("FOUND! BAD!\n");
     exit (31);
   }
--- a/xpcom/tests/TestRacingServiceManager.cpp
+++ b/xpcom/tests/TestRacingServiceManager.cpp
@@ -254,56 +254,56 @@ static const mozilla::Module kLocalModul
 int main(int argc, char** argv)
 {
   nsresult rv;
   XRE_AddStaticComponent(&kLocalModule);
 
   ScopedXPCOM xpcom("RacingServiceManager");
   NS_ENSURE_FALSE(xpcom.failed(), 1);
 
-  AutoCreateAndDestroyReentrantMonitor mon(&gReentrantMonitor);
+  AutoCreateAndDestroyReentrantMonitor mon1(&gReentrantMonitor);
 
   nsRefPtr<Runnable> runnable = new Runnable();
   NS_ENSURE_TRUE(runnable, 1);
 
   // Run the classID test
   nsCOMPtr<nsIThread> newThread;
   rv = NS_NewThread(getter_AddRefs(newThread), runnable);
   NS_ENSURE_SUCCESS(rv, 1);
 
   {
-    ReentrantMonitorAutoEnter mon(*gReentrantMonitor);
+    ReentrantMonitorAutoEnter mon2(*gReentrantMonitor);
 
     gMainThreadWaiting = true;
-    mon.Notify();
+    mon2.Notify();
 
     while (!gCreateInstanceCalled) {
-      mon.Wait();
+      mon2.Wait();
     }
   }
 
   nsCOMPtr<nsISupports> component(do_GetService(kFactoryCID1, &rv));
   NS_ENSURE_SUCCESS(rv, 1);
 
   // Reset for the contractID test
   gMainThreadWaiting = gCreateInstanceCalled = false;
   gFactory->mFirstComponentCreated = runnable->mFirstRunnableDone = true;
   component = nullptr;
 
   rv = newThread->Dispatch(runnable, NS_DISPATCH_NORMAL);
   NS_ENSURE_SUCCESS(rv, 1);
 
   {
-    ReentrantMonitorAutoEnter mon(*gReentrantMonitor);
+    ReentrantMonitorAutoEnter mon3(*gReentrantMonitor);
 
     gMainThreadWaiting = true;
-    mon.Notify();
+    mon3.Notify();
 
     while (!gCreateInstanceCalled) {
-      mon.Wait();
+      mon3.Wait();
     }
   }
 
   component = do_GetService(FACTORY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, 1);
 
   NS_RELEASE(gFactory);
 
--- a/xpcom/tests/bug656331_component/moz.build
+++ b/xpcom/tests/bug656331_component/moz.build
@@ -16,8 +16,11 @@ DEFINES['LIBRARY_FILENAME'] = '%s%s%s' %
     CONFIG['DLL_PREFIX'],
     LIBRARY_NAME,
     CONFIG['DLL_SUFFIX']
 )
 
 # Need to link with CoreFoundation on Mac
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
     OS_LIBS += CONFIG['TK_LIBS']
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
--- a/xpcom/tests/gtest/moz.build
+++ b/xpcom/tests/gtest/moz.build
@@ -23,8 +23,11 @@ UNIFIED_SOURCES += [
     'TestThreads.cpp',
     'TestTimeStamp.cpp',
     'TestTokenizer.cpp',
     'TestUTF.cpp',
     'TestXPIDLString.cpp',
 ]
 
 FINAL_LIBRARY = 'xul-gtest'
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
--- a/xpcom/tests/moz.build
+++ b/xpcom/tests/moz.build
@@ -103,8 +103,11 @@ XPIDL_NO_MANIFEST = True
 
 LOCAL_INCLUDES += [
     '../ds',
 ]
 
 RESOURCE_FILES += [
     'test.properties',
 ]
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
--- a/xpcom/tests/nsIFileEnumerator.cpp
+++ b/xpcom/tests/nsIFileEnumerator.cpp
@@ -4,53 +4,53 @@
 #include <stdio.h>
 #include "nsIComponentRegistrar.h"
 #include "nsIComponentManager.h"
 #include "nsIServiceManager.h"
 #include "nsMemory.h"
 #include "nsISimpleEnumerator.h"
 #include "nsCOMPtr.h"
 
-bool LoopInDir(nsIFile* file)
+static bool LoopInDir(nsIFile* aFile)
 {
     nsresult rv;
     nsCOMPtr<nsISimpleEnumerator> entries;
-    rv = file->GetDirectoryEntries(getter_AddRefs(entries));
+    rv = aFile->GetDirectoryEntries(getter_AddRefs(entries));
     if(NS_FAILED(rv) || !entries)
         return false;
     
     bool hasMore;
     while(NS_SUCCEEDED(entries->HasMoreElements(&hasMore)) && hasMore)
     {
         nsCOMPtr<nsISupports> sup;
         entries->GetNext(getter_AddRefs(sup));
         if(!sup)
             return false;
-        
-        nsCOMPtr<nsIFile> file = do_QueryInterface(sup);
-        if(!file)
+
+        nsCOMPtr<nsIFile> nextFile = do_QueryInterface(sup);
+        if (!nextFile)
             return false;
     
         nsAutoCString name;
-        if(NS_FAILED(file->GetNativeLeafName(name)))
+        if(NS_FAILED(nextFile->GetNativeLeafName(name)))
             return false;
         
         bool isDir;
         printf("%s\n", name.get());
-        rv = file->IsDirectory(&isDir);
+        rv = nextFile->IsDirectory(&isDir);
         if (NS_FAILED(rv))
 		{
 			printf("IsDirectory Failed!!!\n");
 				return false;
 		}
 
 		if (isDir)
         {
-           LoopInDir(file);   
-        }        
+           LoopInDir(nextFile);
+        }
     }
     return true;
 }
 
 
 int
 main(int argc, char* argv[])
 {
--- a/xpcom/typelib/xpt/moz.build
+++ b/xpcom/typelib/xpt/moz.build
@@ -31,8 +31,11 @@ if CONFIG['_MSC_VER']:
 # Code with FINAL_LIBRARY = 'xul' shouldn't do this, but the code
 # here doesn't use malloc functions anyways, while not setting
 # MOZ_NO_MOZALLOC makes the code include mozalloc.h, which includes
 # inline operator new definitions that MSVC linker doesn't strip
 # when linking the xpt tests.
 DEFINES['MOZ_NO_MOZALLOC'] = True
 
 DIST_INSTALL = True
+
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']