Closed Bug 900209 Opened 11 years ago Closed 11 years ago

Element.cpp:1969:59 [-Wformat=] format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type 'nsEventStates::InternalType {aka long unsigned int}'

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: dholbert, Assigned: dholbert)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

My debug build spams this warning:
{
content/base/src/Element.cpp:1969:59 [-Wformat=] format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type 'nsEventStates::InternalType {aka long unsigned int}'
}

which, as it turns out, is the only remaining warning that I see for all of /content/base.

The code in question is:
> 1969   fprintf(out, " state=[%llx]", State().GetInternalValue());
 http://mxr.mozilla.org/mozilla-central/source/content/base/src/Element.cpp#1969
where GetInternalValue() returns InternalType, which is typedefed to uint64_t (which, on 64-bit linux, is a typedef for to "unsigned long", not unsigned-long-long, as the warning indicates.

This is pretty easy to fix -- we can just static_cast to unsigned long long, to *force* the arg to match the format string. The minor downside is that on 64-bit architectures, this will do some unnecessary promotion, but that should be harmless, since the promotion is safe and this is in a chunk of debugging code anyway (where perf isn't a factor).
Attached patch fix v1Splinter Review
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
Attachment #784002 - Flags: review?(bugs)
Blocks: buildwarning
(Note: bug 730805 has a better way of doing this, but it seems to have stagnated.)
Attachment #784002 - Flags: review?(bugs) → review+
Depends on: 900274
Keywords: checkin-needed
Flags: in-testsuite-
https://hg.mozilla.org/mozilla-central/rev/8e78d28f3b46
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Blocks: 900274
No longer depends on: 900274
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: