Closed Bug 805552 Opened 7 years ago Closed 7 years ago

g++ 4.7 opt builds w/ --enable-warnings-as-errors hit tons of error: variable ‘rv’ set but not used [-Werror=unused-but-set-variable] in /netwerk

Categories

(Core :: Networking, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Just tried to do an opt build w/ --enable-warnings-as-errors, and I hit a bunch of errors in /netwerk from nsresults whose values are set but not used (only checked in debug builds).

These need to be labeled as DebugOnly. Filing this bug on fixing 'em.
Attached patch fix v1Splinter Review
Attachment #675233 - Flags: review?(jduell.mcbugs)
Comment on attachment 675233 [details] [diff] [review]
fix v1

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

::: netwerk/base/src/nsIOService.cpp
@@ -691,5 @@
>          }
>      }
>  
>      nsIIOService *subject = static_cast<nsIIOService *>(this);
> -    nsresult rv;

any reason not to just make keep this as a DebugOnly rv, instead of declaring 3 separate vars in different subscopes?  Not a big deal--either works.
Attachment #675233 - Flags: review?(jduell.mcbugs) → review+
Just for scoping purposes.

In each usage of "rv" in that function, the variable is set & then immediately checked, inside of a restricted "{...}" block, and that value is never used again.  So, no need to let the value leak outside of that scope.  (Plus, there's no perf impact to redeclaring it, since it's DebugOnly anyway.)
https://hg.mozilla.org/mozilla-central/rev/3dc8241751a9
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in before you can comment on or make changes to this bug.