Closed Bug 1272931 Opened 4 years ago Closed 4 years ago

Fix -Wshadow warnings in startupcache directory

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

Comment on attachment 8752530 [details] [diff] [review]
Wshadow_startupcache.patch

startupcache/StartupCacheUtils.cpp:239:27 [-Wshadow] declaration shadows a local variable

There is already an `nsAutoCString spec` variable declared at the top of this function that is reused multiple times and can be safely reused here.

I plan to enable clang and gcc's -Wshadow warnings in bug 1272513. This is the last -Wshadow warning in the startupcache directory.
Attachment #8752530 - Flags: review?(nfroyd)
Comment on attachment 8752530 [details] [diff] [review]
Wshadow_startupcache.patch

Review of attachment 8752530 [details] [diff] [review]:
-----------------------------------------------------------------

Sure.

Wow, are you that close to enabling -Wshadow everywhere?  I thought it was going to be a huge pain, particularly with JS headers and their naming conventions...
Attachment #8752530 - Flags: review?(nfroyd) → review+
(In reply to Nathan Froyd [:froydnj] from comment #2)
> Wow, are you that close to enabling -Wshadow everywhere?  I thought it was
> going to be a huge pain, particularly with JS headers and their naming
> conventions...

Maybe. The caveat is that -Wshadow warnings are selectively disabled in about 160 directories (-Wno-error=shadow in moz.build), but enabled everywhere else (in about 300 directories, I think). -Wshadow had been selectively *enabled* in about 250 directories. The patch in bug 1272513 just flips the logic to opt-out.

The warnings would be completely suppressed (-Wno-shadow) in the js/src code because it's so noisy, as you point out.
https://hg.mozilla.org/mozilla-central/rev/39edbdb2beec
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.