Closed Bug 678845 Opened 13 years ago Closed 13 years ago

testIndexToString.cpp:46:5: warning: this decimal constant is unsigned only in ISO C90

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Filing bug on this GCC build warnings:
{
js/src/jsapi-tests/testIndexToString.cpp:46:5: warning: this decimal constant is unsigned only in ISO C90
js/src/jsapi-tests/testIndexToString.cpp:47:5: warning: this decimal constant is unsigned only in ISO C90
js/src/jsapi-tests/testIndexToString.cpp:48:5: warning: this decimal constant is unsigned only in ISO C90
js/src/jsapi-tests/testIndexToString.cpp:49:5: warning: this decimal constant is unsigned only in ISO C90
}

This is from this chunk:
> static const struct TestPair {
>     uint32 num;
>     const char *expected;
> } tests[] = {
[----------SNIP----------]
>     { 2147483648, "2147483648" },
>     { 2147483649, "2147483649" },
>     { 4294967294, "4294967294" },
>     { 4294967295, "4294967295" },
> };

The compiler is complaining about those integer literals - like all integer literals, they'll be treated as signed values in the compiled code -- but in this case, they're larger than INT_MAX, so they'll end up being represented with negative signed values.

Since we're trying to store them in a uint32 variable, we presumably want to consider them unsigned.  We can address this easily by just adding a "u" suffix and taking the implicit signed-int representation out of the loop.
Assignee: general → dholbert
Status: NEW → ASSIGNED
Attachment #553000 - Flags: review?(jwalden+bmo)
Why not do that with the others as well?
'cause it's not necessary? If Waldo prefers, I'd be happy to make that change.

(Of course, it's technically "not necessary" with the ones touched by the patch, too -- it's only necessary to avoid buildspam. :))
Comment on attachment 553000 [details] [diff] [review]
fix: add 'u' suffix

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

My policy on tests is that it has to be clear what's happening, and the formatting/naming/etc. can't be misleading.  But beyond that I don't care about nitpickeries of absolute consistency, adherence to style guidelines, and so on.  :-)  So this is fine, and to be honest even if I did have reason to care about style I'm not sure I'd find this wrong.
Attachment #553000 - Flags: review?(jwalden+bmo) → review+
http://hg.mozilla.org/mozilla-central/rev/edd7aab15b8b
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla8
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: