Bug 1204400 - Fix -Wshadow warnings in gfx/thebes and suppress those from Skia headers. r=BenWa
authorChris Peterson <cpeterson@mozilla.com>
Fri, 11 Sep 2015 20:30:14 -0700
changeset 295350 3d0b47f7a37b4e7db22d947ff0e9416a7f5d8b2a
parent 295349 0361ecab9e24486b6e0c1d2ef0bd28c6ba630fa2
child 295351 7335e2816efeba0449cdcdb98909aaf8e27a6090
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)
reviewersBenWa
bugs1204400
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 1204400 - Fix -Wshadow warnings in gfx/thebes and suppress those from Skia headers. r=BenWa
gfx/gl/GLContext.h
gfx/thebes/gfxCoreTextShaper.cpp
gfx/thebes/gfxFT2FontList.cpp
gfx/thebes/gfxFcPlatformFontList.cpp
gfx/thebes/gfxFontconfigFonts.cpp
gfx/thebes/gfxMacPlatformFontList.mm
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxScriptItemizer.cpp
gfx/thebes/gfxScriptItemizer.h
gfx/thebes/gfxTextRun.cpp
gfx/thebes/moz.build
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -1532,25 +1532,25 @@ public:
         mScissorRect[1] = y;
         mScissorRect[2] = width;
         mScissorRect[3] = height;
         BEFORE_GL_CALL;
         mSymbols.fScissor(x, y, width, height);
         AFTER_GL_CALL;
     }
 
-    void fStencilFunc(GLenum func, GLint ref, GLuint mask) {
-        BEFORE_GL_CALL;
-        mSymbols.fStencilFunc(func, ref, mask);
-        AFTER_GL_CALL;
-    }
-
-    void fStencilFuncSeparate(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask) {
-        BEFORE_GL_CALL;
-        mSymbols.fStencilFuncSeparate(frontfunc, backfunc, ref, mask);
+    void fStencilFunc(GLenum func, GLint reference, GLuint mask) {
+        BEFORE_GL_CALL;
+        mSymbols.fStencilFunc(func, reference, mask);
+        AFTER_GL_CALL;
+    }
+
+    void fStencilFuncSeparate(GLenum frontfunc, GLenum backfunc, GLint reference, GLuint mask) {
+        BEFORE_GL_CALL;
+        mSymbols.fStencilFuncSeparate(frontfunc, backfunc, reference, mask);
         AFTER_GL_CALL;
     }
 
     void fStencilMask(GLuint mask) {
         BEFORE_GL_CALL;
         mSymbols.fStencilMask(mask);
         AFTER_GL_CALL;
     }
--- a/gfx/thebes/gfxCoreTextShaper.cpp
+++ b/gfx/thebes/gfxCoreTextShaper.cpp
@@ -294,17 +294,16 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxS
         ::CTRunGetStringIndices(aCTRun, ::CFRangeMake(0, 0), glyphToCharArray.get());
         glyphToChar = glyphToCharArray.get();
     }
 
     double runWidth = ::CTRunGetTypographicBounds(aCTRun, ::CFRangeMake(0, 0),
                                                   nullptr, nullptr, nullptr);
 
     nsAutoTArray<gfxShapedText::DetailedGlyph,1> detailedGlyphs;
-    gfxShapedText::CompressedGlyph g;
     gfxShapedText::CompressedGlyph *charGlyphs =
         aShapedText->GetCharacterGlyphs() + aOffset;
 
     // CoreText gives us the glyphindex-to-charindex mapping, which relates each glyph
     // to a source text character; we also need the charindex-to-glyphindex mapping to
     // find the glyph for a given char. Note that some chars may not map to any glyph
     // (ligature continuations), and some may map to several glyphs (eg Indic split vowels).
     // We set the glyph index to NO_GLYPH for chars that have no associated glyph, and we
@@ -516,29 +515,30 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxS
                 if (glyphStart < numGlyphs-1) {
                     toNextGlyph = positions[glyphStart+1].x - positions[glyphStart].x;
                 } else {
                     toNextGlyph = positions[0].x + runWidth - positions[glyphStart].x;
                 }
                 advance = int32_t(toNextGlyph * appUnitsPerDevUnit);
             }
 
-            gfxTextRun::CompressedGlyph g;
-            g.SetComplex(charGlyphs[baseCharIndex].IsClusterStart(),
-                         true, detailedGlyphs.Length());
-            aShapedText->SetGlyphs(aOffset + baseCharIndex, g, detailedGlyphs.Elements());
+            gfxTextRun::CompressedGlyph textRunGlyph;
+            textRunGlyph.SetComplex(charGlyphs[baseCharIndex].IsClusterStart(),
+                                    true, detailedGlyphs.Length());
+            aShapedText->SetGlyphs(aOffset + baseCharIndex, textRunGlyph,
+                                   detailedGlyphs.Elements());
 
             detailedGlyphs.Clear();
         }
 
         // the rest of the chars in the group are ligature continuations, no associated glyphs
         while (++baseCharIndex != endCharIndex && baseCharIndex < wordLength) {
-            gfxShapedText::CompressedGlyph &g = charGlyphs[baseCharIndex];
-            NS_ASSERTION(!g.IsSimpleGlyph(), "overwriting a simple glyph");
-            g.SetComplex(inOrder && g.IsClusterStart(), false, 0);
+            gfxShapedText::CompressedGlyph &shapedTextGlyph = charGlyphs[baseCharIndex];
+            NS_ASSERTION(!shapedTextGlyph.IsSimpleGlyph(), "overwriting a simple glyph");
+            shapedTextGlyph.SetComplex(inOrder && shapedTextGlyph.IsClusterStart(), false, 0);
         }
 
         glyphStart = glyphEnd;
         charStart = charEnd;
     }
 
     return NS_OK;
 }
--- a/gfx/thebes/gfxFT2FontList.cpp
+++ b/gfx/thebes/gfxFT2FontList.cpp
@@ -906,51 +906,51 @@ FT2FontEntry::CheckForBrokenFont(gfxFont
 }
 
 void
 gfxFT2FontList::AppendFacesFromFontFile(const nsCString& aFileName,
                                         FontNameCache *aCache,
                                         StandardFile aStdFile,
                                         FT2FontFamily::Visibility aVisibility)
 {
-    nsCString faceList;
+    nsCString cachedFaceList;
     uint32_t filesize = 0, timestamp = 0;
     if (aCache) {
-        aCache->GetInfoForFile(aFileName, faceList, &timestamp, &filesize);
+        aCache->GetInfoForFile(aFileName, cachedFaceList, &timestamp, &filesize);
     }
 
     struct stat s;
     int statRetval = stat(aFileName.get(), &s);
-    if (!faceList.IsEmpty() && 0 == statRetval &&
+    if (!cachedFaceList.IsEmpty() && 0 == statRetval &&
         s.st_mtime == timestamp && s.st_size == filesize)
     {
         LOG(("using cached font info for %s", aFileName.get()));
-        AppendFacesFromCachedFaceList(aFileName, faceList, aStdFile,
+        AppendFacesFromCachedFaceList(aFileName, cachedFaceList, aStdFile,
                                       aVisibility);
         return;
     }
 
     FT_Library ftLibrary = gfxAndroidPlatform::GetPlatform()->GetFTLibrary();
     FT_Face dummy;
     if (FT_Err_Ok == FT_New_Face(ftLibrary, aFileName.get(), -1, &dummy)) {
         LOG(("reading font info via FreeType for %s", aFileName.get()));
-        nsCString faceList;
+        nsCString newFaceList;
         timestamp = s.st_mtime;
         filesize = s.st_size;
         for (FT_Long i = 0; i < dummy->num_faces; i++) {
             FT_Face face;
             if (FT_Err_Ok != FT_New_Face(ftLibrary, aFileName.get(), i, &face)) {
                 continue;
             }
-            AddFaceToList(aFileName, i, aStdFile, aVisibility, face, faceList);
+            AddFaceToList(aFileName, i, aStdFile, aVisibility, face, newFaceList);
             FT_Done_Face(face);
         }
         FT_Done_Face(dummy);
-        if (aCache && 0 == statRetval && !faceList.IsEmpty()) {
-            aCache->CacheFileInfo(aFileName, faceList, timestamp, filesize);
+        if (aCache && 0 == statRetval && !newFaceList.IsEmpty()) {
+            aCache->CacheFileInfo(aFileName, newFaceList, timestamp, filesize);
         }
     }
 }
 
 #define JAR_LAST_MODIFED_TIME "jar-last-modified-time"
 
 void
 gfxFT2FontList::FindFontsInOmnijar(FontNameCache *aCache)
--- a/gfx/thebes/gfxFcPlatformFontList.cpp
+++ b/gfx/thebes/gfxFcPlatformFontList.cpp
@@ -365,29 +365,29 @@ gfxFontconfigFontEntry::ReadCMAP(FontInf
 {
     // attempt this once, if errors occur leave a blank cmap
     if (mCharacterMap) {
         return NS_OK;
     }
 
     nsRefPtr<gfxCharacterMap> charmap;
     nsresult rv;
-    bool symbolFont;
+    bool symbolFont = false; // currently ignored
 
     if (aFontInfoData && (charmap = GetCMAPFromFontInfo(aFontInfoData,
                                                         mUVSOffset,
                                                         symbolFont))) {
         rv = NS_OK;
     } else {
         uint32_t kCMAP = TRUETYPE_TAG('c','m','a','p');
         charmap = new gfxCharacterMap();
         AutoTable cmapTable(this, kCMAP);
 
         if (cmapTable) {
-            bool unicodeFont = false, symbolFont = false; // currently ignored
+            bool unicodeFont = false; // currently ignored
             uint32_t cmapLen;
             const uint8_t* cmapData =
                 reinterpret_cast<const uint8_t*>(hb_blob_get_data(cmapTable,
                                                                   &cmapLen));
             rv = gfxFontUtils::ReadCMAP(cmapData, cmapLen,
                                         *charmap, mUVSOffset,
                                         unicodeFont, symbolFont);
         } else {
@@ -1504,10 +1504,8 @@ ApplyGdkScreenFontOptions(FcPattern *aPa
 {
     const cairo_font_options_t *options =
         gdk_screen_get_font_options(gdk_screen_get_default());
 
     cairo_ft_font_options_substitute(options, aPattern);
 }
 
 #endif // MOZ_WIDGET_GTK2
-
-
--- a/gfx/thebes/gfxFontconfigFonts.cpp
+++ b/gfx/thebes/gfxFontconfigFonts.cpp
@@ -1000,23 +1000,23 @@ gfxFcFontSet::SortPreferredFonts(bool &a
                 --v;
             }
             continue;
         }
 
         // Aliases seem to often end up occurring more than once, but
         // duplicate families can't be removed from the sort pattern without
         // knowing whether duplicates have the same binding.
-        gfxFontconfigUtils::DepFcStrEntry *entry =
+        gfxFontconfigUtils::DepFcStrEntry *familyEntry =
             existingFamilies.PutEntry(family);
-        if (entry) {
-            if (entry->mKey) // old entry
+        if (familyEntry) {
+            if (familyEntry->mKey) // old entry
                 continue;
 
-            entry->mKey = family; // initialize new entry
+            familyEntry->mKey = family; // initialize new entry
         }
 
         for (uint32_t f = 0; f < familyFonts->Length(); ++f) {
             FcPattern *font = familyFonts->ElementAt(f);
 
             // Fix up the family name of user-font patterns, as the same
             // font entry may be used (via the UserFontCache) for multiple
             // CSS family names
@@ -1027,20 +1027,20 @@ gfxFcFontSet::SortPreferredFonts(bool &a
             }
 
             // User fonts are already filtered by slant (but not size) in
             // mUserFontSet->FindUserFontEntry().
             if (requestedSize != -1.0 && !SizeIsAcceptable(font, requestedSize))
                 continue;
 
             for (uint32_t r = 0; r < requiredLangs.Length(); ++r) {
-                const LangSupportEntry& entry = requiredLangs[r];
+                const LangSupportEntry& langEntry = requiredLangs[r];
                 FcLangResult support =
-                    gfxFontconfigUtils::GetLangSupport(font, entry.mLang);
-                if (support <= entry.mBestSupport) { // lower is better
+                    gfxFontconfigUtils::GetLangSupport(font, langEntry.mLang);
+                if (support <= langEntry.mBestSupport) { // lower is better
                     requiredLangs.RemoveElementAt(r);
                     --r;
                 }
             }
 
             // FcFontSetDestroy will remove a reference but FcFontSetAdd
             // does _not_ take a reference!
             if (FcFontSetAdd(fontSet, font)) {
@@ -2153,9 +2153,8 @@ gfxFcFont::GetGlyphRenderingOptions(cons
   mozilla::gfx::AntialiasMode aaMode =
     mozilla::gfx::CairoAntialiasToGfxAntialias(antialias);
 
   // We don't want to force the use of the autohinter over the font's built in hints
   // The fontconfig AA mode must be passed along because it may override the hinting style.
   return mozilla::gfx::Factory::CreateCairoGlyphRenderingOptions(hinting, false, aaMode);
 }
 #endif
-
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -155,29 +155,29 @@ MacOSFontEntry::ReadCMAP(FontInfoData *a
 {
     // attempt this once, if errors occur leave a blank cmap
     if (mCharacterMap) {
         return NS_OK;
     }
 
     nsRefPtr<gfxCharacterMap> charmap;
     nsresult rv;
-    bool symbolFont;
+    bool symbolFont = false; // currently ignored
 
     if (aFontInfoData && (charmap = GetCMAPFromFontInfo(aFontInfoData,
                                                         mUVSOffset,
                                                         symbolFont))) {
         rv = NS_OK;
     } else {
         uint32_t kCMAP = TRUETYPE_TAG('c','m','a','p');
         charmap = new gfxCharacterMap();
         AutoTable cmapTable(this, kCMAP);
 
         if (cmapTable) {
-            bool unicodeFont = false, symbolFont = false; // currently ignored
+            bool unicodeFont = false; // currently ignored
             uint32_t cmapLen;
             const uint8_t* cmapData =
                 reinterpret_cast<const uint8_t*>(hb_blob_get_data(cmapTable,
                                                                   &cmapLen));
             rv = gfxFontUtils::ReadCMAP(cmapData, cmapLen,
                                         *charmap, mUVSOffset,
                                         unicodeFont, symbolFont);
         } else {
@@ -826,81 +826,81 @@ gfxMacPlatformFontList::GlobalFontFallba
                                                        aRunScript,
                                                        aMatchStyle,
                                                        aCmapCount,
                                                        aMatchedFamily);
     }
 
     CFStringRef str;
     UniChar ch[2];
-    CFIndex len = 1;
+    CFIndex length = 1;
 
     if (IS_IN_BMP(aCh)) {
         ch[0] = aCh;
         str = ::CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, ch, 1,
                                                    kCFAllocatorNull);
     } else {
         ch[0] = H_SURROGATE(aCh);
         ch[1] = L_SURROGATE(aCh);
         str = ::CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, ch, 2,
                                                    kCFAllocatorNull);
         if (!str) {
             return nullptr;
         }
-        len = 2;
+        length = 2;
     }
 
     // use CoreText to find the fallback family
 
     gfxFontEntry *fontEntry = nullptr;
     CTFontRef fallback;
     bool cantUseFallbackFont = false;
 
     if (!mDefaultFont) {
         mDefaultFont = ::CTFontCreateWithName(CFSTR("LucidaGrande"), 12.f,
                                               NULL);
     }
 
     fallback = ::CTFontCreateForString(mDefaultFont, str,
-                                       ::CFRangeMake(0, len));
+                                       ::CFRangeMake(0, length));
 
     if (fallback) {
-        CFStringRef familyName = ::CTFontCopyFamilyName(fallback);
+        CFStringRef familyNameRef = ::CTFontCopyFamilyName(fallback);
         ::CFRelease(fallback);
 
-        if (familyName &&
-            ::CFStringCompare(familyName, CFSTR("LastResort"),
+        if (familyNameRef &&
+            ::CFStringCompare(familyNameRef, CFSTR("LastResort"),
                               kCFCompareCaseInsensitive) != kCFCompareEqualTo)
         {
             nsAutoTArray<UniChar, 1024> buffer;
-            CFIndex len = ::CFStringGetLength(familyName);
-            buffer.SetLength(len+1);
-            ::CFStringGetCharacters(familyName, ::CFRangeMake(0, len),
+            CFIndex familyNameLen = ::CFStringGetLength(familyNameRef);
+            buffer.SetLength(familyNameLen+1);
+            ::CFStringGetCharacters(familyNameRef, ::CFRangeMake(0, familyNameLen),
                                     buffer.Elements());
-            buffer[len] = 0;
-            nsDependentString familyName(reinterpret_cast<char16_t*>(buffer.Elements()), len);
+            buffer[familyNameLen] = 0;
+            nsDependentString familyNameString(reinterpret_cast<char16_t*>(buffer.Elements()), familyNameLen);
 
             bool needsBold;  // ignored in the system fallback case
 
-            gfxFontFamily *family = FindFamily(familyName);
+            gfxFontFamily *family = FindFamily(familyNameString);
             if (family) {
                 fontEntry = family->FindFontForStyle(*aMatchStyle, needsBold);
                 if (fontEntry) {
                     if (fontEntry->HasCharacter(aCh)) {
                         *aMatchedFamily = family;
                     } else {
                         fontEntry = nullptr;
                         cantUseFallbackFont = true;
                     }
                 }
             }
         }
 
-        if (familyName) {
-            ::CFRelease(familyName);
+        if (familyNameRef) {
+            ::CFRelease(familyNameRef);
         }
     }
 
     if (cantUseFallbackFont) {
         Telemetry::Accumulate(Telemetry::BAD_FALLBACK_FONT, cantUseFallbackFont);
     }
 
     ::CFRelease(str);
@@ -1097,22 +1097,23 @@ MacFontInfo::LoadFontFamilyData(const ns
                                   len);
 
             // load the cmap data
             FontFaceData fontData;
             CFDataRef cmapTable = CTFontCopyTable(fontRef, kCTFontTableCmap,
                                                   kCTFontTableOptionNoOptions);
 
             if (cmapTable) {
-                bool unicodeFont = false, symbolFont = false; // ignored
                 const uint8_t *cmapData =
                     (const uint8_t*)CFDataGetBytePtr(cmapTable);
                 uint32_t cmapLen = CFDataGetLength(cmapTable);
                 nsRefPtr<gfxCharacterMap> charmap = new gfxCharacterMap();
                 uint32_t offset;
+                bool unicodeFont = false; // ignored
+                bool symbolFont = false;
                 nsresult rv;
 
                 rv = gfxFontUtils::ReadCMAP(cmapData, cmapLen, *charmap, offset,
                                             unicodeFont, symbolFont);
                 if (NS_SUCCEEDED(rv)) {
                     fontData.mCharacterMap = charmap;
                     fontData.mUVSOffset = offset;
                     fontData.mSymbolFont = symbolFont;
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -85,23 +85,31 @@
 #include "TexturePoolOGL.h"
 #endif
 
 #ifdef MOZ_WIDGET_GONK
 #include "mozilla/layers/GrallocTextureHost.h"
 #endif
 
 #include "mozilla/Hal.h"
+
 #ifdef USE_SKIA
-#include "skia/include/core/SkGraphics.h"
+# ifdef __GNUC__
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wshadow"
+# endif
+# include "skia/include/core/SkGraphics.h"
 # ifdef USE_SKIA_GPU
 #  include "skia/include/gpu/GrContext.h"
 #  include "skia/include/gpu/gl/GrGLInterface.h"
 #  include "SkiaGLGlue.h"
 # endif
+# ifdef __GNUC__
+#  pragma GCC diagnostic pop // -Wshadow
+# endif
 #endif
 
 #if !defined(USE_SKIA) || !defined(USE_SKIA_GPU)
 class mozilla::gl::SkiaGLGlue : public GenericAtomicRefCounted {
 };
 #endif
 
 #include "mozilla/Preferences.h"
--- a/gfx/thebes/gfxScriptItemizer.cpp
+++ b/gfx/thebes/gfxScriptItemizer.cpp
@@ -59,24 +59,24 @@
 #define DEC(sp,count) (MOD((sp) + PAREN_STACK_DEPTH - (count)))
 #define DEC1(sp) (DEC(sp, 1))
 #define STACK_IS_EMPTY() (pushCount <= 0)
 #define STACK_IS_NOT_EMPTY() (! STACK_IS_EMPTY())
 #define TOP() (parenStack[parenSP])
 #define SYNC_FIXUP() (fixupCount = 0)
 
 void
-gfxScriptItemizer::push(uint32_t endPairChar, int32_t scriptCode)
+gfxScriptItemizer::push(uint32_t endPairChar, int32_t newScriptCode)
 {
     pushCount  = LIMIT_INC(pushCount);
     fixupCount = LIMIT_INC(fixupCount);
 
     parenSP = INC1(parenSP);
     parenStack[parenSP].endPairChar = endPairChar;
-    parenStack[parenSP].scriptCode = scriptCode;
+    parenStack[parenSP].scriptCode = newScriptCode;
 }
 
 void
 gfxScriptItemizer::pop()
 {
     if (STACK_IS_EMPTY()) {
         return;
     }
@@ -92,23 +92,23 @@ gfxScriptItemizer::pop()
        pointers to their initial values.
      */
     if (STACK_IS_EMPTY()) {
         parenSP = -1;
     }
 }
 
 void
-gfxScriptItemizer::fixup(int32_t scriptCode)
+gfxScriptItemizer::fixup(int32_t newScriptCode)
 {
     int32_t fixupSP = DEC(parenSP, fixupCount);
 
     while (fixupCount-- > 0) {
         fixupSP = INC1(fixupSP);
-        parenStack[fixupSP].scriptCode = scriptCode;
+        parenStack[fixupSP].scriptCode = newScriptCode;
     }
 }
 
 static inline bool
 SameScript(int32_t runScript, int32_t currCharScript)
 {
     return runScript <= MOZ_SCRIPT_INHERITED ||
            currCharScript <= MOZ_SCRIPT_INHERITED ||
--- a/gfx/thebes/gfxScriptItemizer.h
+++ b/gfx/thebes/gfxScriptItemizer.h
@@ -70,19 +70,19 @@ protected:
         scriptStart = 0;
         scriptLimit = 0;
         scriptCode  = MOZ_SCRIPT_INVALID;
         parenSP     = -1;
         pushCount   =  0;
         fixupCount  =  0;
     }
 
-    void push(uint32_t endPairChar, int32_t scriptCode);
+    void push(uint32_t endPairChar, int32_t newScriptCode);
     void pop();
-    void fixup(int32_t scriptCode);
+    void fixup(int32_t newScriptCode);
 
     struct ParenStackEntry {
         uint32_t endPairChar;
         int32_t  scriptCode;
     };
 
     const char16_t *textPtr;
     uint32_t textLength;
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -1888,22 +1888,22 @@ gfxFontGroup::GetDefaultFont()
 
     uint32_t numFonts = 0;
     if (!mDefaultFont) {
         // Try for a "font of last resort...."
         // Because an empty font list would be Really Bad for later code
         // that assumes it will be able to get valid metrics for layout,
         // just look for the first usable font and put in the list.
         // (see bug 554544)
-        nsAutoTArray<nsRefPtr<gfxFontFamily>,200> families;
-        pfl->GetFontFamilyList(families);
-        uint32_t numFonts = families.Length();
+        nsAutoTArray<nsRefPtr<gfxFontFamily>,200> familyList;
+        pfl->GetFontFamilyList(familyList);
+        numFonts = familyList.Length();
         for (uint32_t i = 0; i < numFonts; ++i) {
-            gfxFontEntry *fe = families[i]->FindFontForStyle(mStyle,
-                                                             needsBold);
+            gfxFontEntry *fe = familyList[i]->FindFontForStyle(mStyle,
+                                                               needsBold);
             if (fe) {
                 mDefaultFont = fe->FindOrMakeFont(&mStyle, needsBold);
                 if (mDefaultFont) {
                     break;
                 }
             }
         }
     }
@@ -1920,27 +1920,26 @@ gfxFontGroup::GetDefaultFont()
         bool dwriteEnabled = gfxWindowsPlatform::GetPlatform()->DWriteEnabled();
         double upTime = (double) GetTickCount();
         fontInitInfo.AppendPrintf(" backend: %s system-uptime: %9.3f sec",
                                   dwriteEnabled ? "directwrite" : "gdi", upTime/1000);
 #endif
         gfxCriticalError() << fontInitInfo.get();
 
         char msg[256]; // CHECK buffer length if revising message below
-        nsAutoString families;
-        mFamilyList.ToString(families);
+        nsAutoString familiesString;
+        mFamilyList.ToString(familiesString);
         snprintf_literal(msg, "unable to find a usable font (%.220s)",
-                         NS_ConvertUTF16toUTF8(families).get());
+                         NS_ConvertUTF16toUTF8(familiesString).get());
         NS_RUNTIMEABORT(msg);
     }
 
     return mDefaultFont.get();
 }
 
-
 gfxFont*
 gfxFontGroup::GetFirstValidFont(uint32_t aCh)
 {
     uint32_t count = mFonts.Length();
     for (uint32_t i = 0; i < count; ++i) {
         FamilyFace& ff = mFonts[i];
         if (ff.IsInvalid()) {
             continue;
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -255,16 +255,19 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
 # available if we're building with the Intl API enabled:
 if CONFIG['ENABLE_INTL_API']:
     CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS']
     CFLAGS += CONFIG['MOZ_ICU_CFLAGS']
     USE_LIBS += [
         'icu',
     ]
 
+if CONFIG['GNU_CXX']:
+    CXXFLAGS += ['-Wshadow']
+
 if CONFIG['_MSC_VER']:
     ALLOW_COMPILER_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 GENERATED_FILES = [