TestAudioEventTimeline.cpp:42:3: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

RESOLVED FIXED in mozilla20

Status

()

defect
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: dholbert, Assigned: dholbert)

Tracking

(Blocks 1 bug)

Trunk
mozilla20
x86_64
Linux
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite -

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Build warning:
{
/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp: In instantiation of ‘void is(const T&, const U&, const char*) [with T = unsigned int; U = int]’:

/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp:198:50:   required from here

Warning: -Wsign-compare in /content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp: comparison between signed and unsigned integer expressions

/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp:42:3: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
}

This is for this line:
> 198   is(timeline.GetEventCount(), 0, "No events yet");
http://mxr.mozilla.org/mozilla-central/source/content/media/webaudio/compiledtest/TestAudioEventTimeline.cpp#198

"0" is being treated as a signed int there, whereas GetEventCount() is unsigned. We should just make it "0u" and then all will be well.
Posted patch fix v1Splinter Review
This happens a bunch of times in this file, but GCC only warns for the first one. (So if I fix the one instance quoted in comment 0, then GCC warns about the next one, etc.)

This fixes all of them, making the directory warning-free (since this is the only CPP file there), and labels it as such.
Attachment #685405 - Flags: review?(ehsan)
Attachment #685405 - Flags: review?(ehsan) → review+
Try run (just debug builds, no tests) to be sure the FAIL_ON_WARNINGS doesn't bust stuff on the other platforms where it's honored: https://tbpl.mozilla.org/?tree=Try&rev=2ba635ffbf3f
Flags: in-testsuite-
https://hg.mozilla.org/mozilla-central/rev/9739aaf09eeb
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.