Closed Bug 446320 Opened 12 years ago Closed 12 years ago

SM: fixing -Wformat warnings

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

Details

Attachments

(1 file, 1 obsolete file)

On 64-bit Linux with a debug build when using -Wformat option to GCC (browser build) the compiler generates a few warnings like:

warning: format ‘%3u’ expects type ‘unsigned int’, but argument 3 has type ‘long int’

The warnings are real bugs in the debug code and should be fixed.
Attached patch v1 (obsolete) — Splinter Review
Most of the warnings comes from using ptrdiff_t as the type for the jump offset while using %d as a format specifier. I guess an alternative is to fix the code to use just int, not ptrdiff_t, as the perspective of supporting jumps spanning over 2GB of script bytecode is few years off. But adding casts is a safer alternative.
Attachment #330496 - Flags: review?(brendan)
Attached patch v2Splinter Review
In the version v1 I cast off to uintN, not the proper intN, in js_Disassemble1.
Attachment #330496 - Attachment is obsolete: true
Attachment #330497 - Flags: review?(brendan)
Attachment #330496 - Flags: review?(brendan)
Attachment #330497 - Flags: review?(brendan) → review?(crowder)
Attachment #330497 - Flags: review?(crowder) → review+
landed - http://hg.mozilla.org/index.cgi/mozilla-central/rev/5421667181a0
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Flags: in-testsuite-
Flags: in-litmus-
You need to log in before you can comment on or make changes to this bug.