Closed Bug 851169 Opened 7 years ago Closed 7 years ago

Telemetry.cpp:2096:15: warning: variable ‘recorded’ set but not used [-Wunused-but-set-variable]

Categories

(Toolkit :: Telemetry, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Build warning:
{
toolkit/components/telemetry/Telemetry.cpp:2096:15: warning: variable ‘recorded’ set but not used [-Wunused-but-set-variable]
}

This is a variable that we assert about, but we've (temporarily) disabled the assertion here:
 https://hg.mozilla.org/mozilla-central/rev/2bee7c8730dc

This leaves the variable unused, which makes compilers complain.  We should either comment out the variable declaration, or "use" it with unused << or (void) to silence the compilers.
Attached patch fix v1Splinter Review
I opted to use (void), since "unused <<" requires an additional #include and that'd be one more thing for someone to have to worry about removing once this variable becomes used again.

Happy to switch to unused<< if you'd prefer, though.
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #724983 - Flags: review?(ehsan)
Blocks: 851183
Comment on attachment 724983 [details] [diff] [review]
fix v1

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

I do like unused<< better.  It's more hipster!
Attachment #724983 - Flags: review?(ehsan) → review+
Actually, please just get rid of this variable altogether.
...but there's a bug filed on figuring out why the variable ends up being true when we don't expect it to be true. (bug 832330).  Seems like removing the variable would be counterproductive to solving that bug.

Maybe I should comment out the variable, and whoever ends up working on that bug can uncomment it?
(In reply to comment #4)
> ...but there's a bug filed on figuring out why the variable ends up being true
> when we don't expect it to be true. (bug 832330).  Seems like removing the
> variable would be counterproductive to solving that bug.
> 
> Maybe I should comment out the variable, and whoever ends up working on that
> bug can uncomment it?

Argh, just do the (void) thing then, #including a header there is overkill I suppose.
Cool, my thoughts exactly. :) (per comment 1)  Thanks!
(In reply to comment #6)
> Cool, my thoughts exactly. :) (per comment 1)  Thanks!

What now I'm supposed to actually read the bug completely before reviewing the code?  Such an unreasonable request!  ;-)
Summary: Telemetry.cpp:2096:15: warning: variable ‘recorded’ set but not used [-Wunused-but-set-variable] } → Telemetry.cpp:2096:15: warning: variable ‘recorded’ set but not used [-Wunused-but-set-variable]
https://hg.mozilla.org/mozilla-central/rev/9965ed3759c8
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in before you can comment on or make changes to this bug.