Closed Bug 661969 Opened 13 years ago Closed 13 years ago

GCC 4.6 build warning: "gfxFontUtils.h:874:18: warning: variable ‘timerInterval’ set but not used [-Wunused-but-set-variable]"

Categories

(Core :: Graphics, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla7

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

(Whiteboard: [build_warning][inbound])

Attachments

(1 file, 1 obsolete file)

When building with GCC 4.6, every file that #includes gfxFontUtils.h spams this warning:

{
gfxFontUtils.h: In member function ‘void gfxFontInfoLoader::StartLoader(PRUint32, PRUint32)’:
gfxFontUtils.h:874:18: warning: variable ‘timerInterval’ set but not used [-Wunused-but-set-variable]
}

From looking at the involved code, it looks like the variable's been unused ever since this code was added, in bug 419744.  Here's the relevant code snippet:
{
874         PRUint32 timerInterval;
875 
876         if (aDelay) {
877             mState = stateTimerOnDelay;
878             timerInterval = aDelay;
879         } else {
880             mState = stateTimerOnInterval;
881             timerInterval = mInterval;
882         }
883 
884         InitLoader();
885 
886         // start timer
887         mTimer->InitWithFuncCallback(LoaderTimerCallback, this, aDelay, 
888                                      nsITimer::TYPE_REPEATING_SLACK);
}
http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxFontUtils.h#873

John, do you know if we should be using this variable somewhere?  Or can it just go away?
Attached patch fix: remove variable (obsolete) — Splinter Review
Here's a patch to just delete the variable, since it's apparently not used.
Attachment #541273 - Flags: review?(jdaggett)
(In reply to comment #0)
> When building with GCC 4.6, every file that #includes gfxFontUtils.h spams
> this warning

To be specific -- we spam this warning at least 75 distinct times during a mozilla-central build (with sometimes 6 or more lines of output per warning, to print the sequence of .h #includes from the .cpp file to gfxFontUtils.h via other headers).

So, fixing this will fix hundreds of lines of gcc-4.6 warning output.
Comment on attachment 541273 [details] [diff] [review]
fix: remove variable

Actually, this is a bug.  The logic is intended to support an initial delay with a separate interval value.  So the right fix is to pass timerInterval instead of aDelay into the call to InitWithFuncCallback.  StartLoader is always called with a delay so the bug doesn't really affect much but best to fix it.
Attached patch fix v2Splinter Review
Ah, makes sense. Here's a patch to do that.
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #541441 - Flags: review?(jdaggett)
Attachment #541273 - Attachment is obsolete: true
Attachment #541273 - Flags: review?(jdaggett)
Attachment #541441 - Flags: review?(jdaggett) → review+
http://hg.mozilla.org/integration/mozilla-inbound/rev/ee78f62ded1c
Whiteboard: [build_warning] → [build_warning][inbound]
http://hg.mozilla.org/mozilla-central/rev/ee78f62ded1c
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Verified the fix in hg.mozilla.org/mozilla-central under gfx/thebes/gfxFontUtils.h: timerInterval variable is set and used.

Changing resolution to VERIFIED-FIXED.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: