Closed
Bug 516298
Opened 15 years ago
Closed 15 years ago
TM: fix three compiler warnings
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: n.nethercote, Assigned: n.nethercote)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
1.94 KB,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
../jsfun.cpp: In member function ‘int JSFunction::sharpSlotBase(JSContext*)’: ../jsfun.cpp:1802: warning: ‘index’ may be used uninitialised in this function This one seems reasonable -- js_LookupLocal isn't guaranteed to initialise 'i' (hopefully it always does due to some jstracer-specific invariant that GCC doesn't know about). Using -1 as default seems reasonable since that's sharpSlotBase()'s default return value. ../jsnum.cpp:1347: warning: ‘bdr.BinaryDigitReader::digit’ may be used uninitialised in this function Seems like GetNextBinaryDigit() will always initialize 'digit', given the other values in 'bdr'. I used 0 as the default initialization value, seems the most obvious (and should 'digit' truly fail to be initialized, 0 will be correct half the time :) ../jsregexp.cpp:2009: warning: ‘core’ defined but not used Removed this variable.
Attachment #400401 -
Flags: review?(brendan)
Updated•15 years ago
|
Attachment #400401 -
Flags: review?(brendan) → review+
Comment 1•15 years ago
|
||
Comment on attachment 400401 [details] [diff] [review] patch Thanks, /be
Comment 2•15 years ago
|
||
(I hope no compiler warns about initializing unsigned types with -1...)
Assignee | ||
Comment 3•15 years ago
|
||
Good point -- you want me to change it to zero?
Comment 4•15 years ago
|
||
No,the caller (js_Execute) will defend given -1. At most we want uintN(-1) sa the initializer, but I'm not sure you will get a warning with -1. Try it and see? /be
Assignee | ||
Comment 5•15 years ago
|
||
I didn't get a warning with the naked -1, but I thought other compilers might warn, and the (uintN) cast is useful documentation, so I included the cast. http://hg.mozilla.org/tracemonkey/rev/2fde438e64ff
Whiteboard: fixed-in-tracemonkey
Comment 6•15 years ago
|
||
Prefer C++ style casts now (uintN(-1) as I wrote in comment 4, not (uintN)-1). Nit for sure, but rs=me on followup change. I don't see the cast as documentation in any event. The variable's type is the same, and nothing is in a comment, so it's just redundancy. /be
Assignee | ||
Comment 7•15 years ago
|
||
Follow-up that changes the cast syntax: http://hg.mozilla.org/tracemonkey/rev/2a3c66f0a36c
Comment 8•15 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/2fde438e64ff
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment 9•15 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/2a3c66f0a36c
Updated•15 years ago
|
Flags: wanted1.9.2?
Updated•13 years ago
|
Flags: wanted1.9.2?
You need to log in
before you can comment on or make changes to this bug.
Description
•