Closed Bug 737754 Opened 12 years ago Closed 12 years ago

nsScriptLoader.cpp:1286:50: warning: comparison of unsigned expression >= 0 is always true

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Filing bug on this build warning:
nsScriptLoader.cpp: In member function ‘nsresult nsScriptLoader::PrepareLoadedRequest(nsScriptLoadRequest*, nsIStreamLoader*, nsresult, PRUint32, const PRUint8*)’:
nsScriptLoader.cpp:1286:50: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
nsScriptLoader.cpp:1286:91: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
nsScriptLoader.cpp:1286:157: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
nsScriptLoader.cpp:1286:197: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]

This is for this chunk:
1286   NS_ASSERTION(mDeferRequests.IndexOf(aRequest) >= 0 ||
1287                mAsyncRequests.IndexOf(aRequest) >= 0 ||
1288                mNonAsyncExternalScriptInsertedRequests.IndexOf(aRequest) >= 0 ||
1289                mXSLTRequests.IndexOf(aRequest) >= 0 ||
1290                mPreloads.Contains(aRequest, PreloadRequestComparator()) ||
1291                mParserBlockingRequest,
1292                "aRequest should be pending!");

Those IndexOf functions all return unsigned values now, as of this change:
http://hg.mozilla.org/mozilla-central/diff/aacd84d91b66/content/base/src/nsScriptLoader.h
which switched those arrays from nsCOMArray (which returns a signed value from IndexOf) to nsTArray (which returns an unsigned value from IndexOf)

I think we need to change these IndexOf() calls to Contain() calls.
Attached patch fix v1Splinter Review
Attachment #607864 - Flags: review?(hsivonen)
Attachment #607864 - Flags: review?(hsivonen) → review+
Whiteboard: [autoland-try]
OS: Linux → All
Hardware: x86_64 → All
Whiteboard: [autoland-try] → [autoland-in-queue]
Autoland Patchset:
	Patches: 607864
	Branch: mozilla-central => try
	Destination: http://hg.mozilla.org/try/pushloghtml?changeset=2c6b4f398985
Try run started, revision 2c6b4f398985. To cancel or monitor the job, see: https://tbpl.mozilla.org/?tree=Try&rev=2c6b4f398985
Darn, looks like [autoland-try] just triggers builds & no tests.  I wanted to give this a unittest sanity-check, since this effectively re-enables an assertion that's been nerfed for a little while, and it's possible that we've since added a testcase (or some code) that fails the non-nerfed assertion.

I just pushed to try manually, so as not to confuse autoland with another request while it's waiting for the first run's results:
   https://tbpl.mozilla.org/?tree=Try&rev=160eaa422e12
(In reply to Daniel Holbert [:dholbert] from comment #3)
> Darn, looks like [autoland-try] just triggers builds & no tests.

FWIW, you can instruct it to trigger tests with normal try syntax:

[autoland-try:-b do -p all -u all -t none]
Yup, I know -- I'd just mistakenly assumed that [autoland-try] would trigger all unit tests (instead of no unit tests).
Ah, yeah, it used to and then the behavior flipped a couple of weeks ago.
Try run for 2c6b4f398985 is complete.
Detailed breakdown of the results available here:
    https://tbpl.mozilla.org/?tree=Try&rev=2c6b4f398985
Results (out of 14 total builds):
    success: 14
Builds (or logs if builds failed) available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/autolanduser@mozilla.com-2c6b4f398985
Whiteboard: [autoland-in-queue]
Landed:
 https://hg.mozilla.org/integration/mozilla-inbound/rev/377a8d6327aa
Target Milestone: --- → mozilla14
https://hg.mozilla.org/mozilla-central/rev/377a8d6327aa
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: