Closed Bug 924608 Opened 11 years ago Closed 11 years ago

tautological compare warning in MemoryMetrics.h

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: mccr8, Assigned: terrence)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

I get this in Clang for every file that includes that header:

 5:27.13 Warning: -Wtautological-compare in /home/amccreight/cent/obj-dbg/dist/include/js/MemoryMetrics.h: self-comparison always evaluates to true
 5:27.13 ../../../dist/include/js/MemoryMetrics.h:388:1140: warning: self-comparison always evaluates to true [-Wtautological-compare]
 5:27.13         n += (js::IsLiveGCThing == js::IsLiveGCThing) ? objectsGCHeapOrdinary : 0; n += (js::IsLiveGCThing == js::IsLiveGCThing) ? objectsGCHeapFunction : 0; [and it goes on and on]
Blocks: buildwarning
Blocks: 919889
Terrence suggested this fix. Basically, you just make the enum boolean valued.  Clang seems okay with boolean-constant tautologies.
Comment on attachment 814551 [details] [diff] [review]
use boolean-valued enums to avoid the tauto warning

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

https://tbpl.mozilla.org/?tree=Try&rev=7b30d8e1af26

::: js/public/MemoryMetrics.h
@@ +60,5 @@
>  #define DECL_SIZE(gc, mSize)                      size_t mSize;
>  #define ZERO_SIZE(gc, mSize)                      mSize(0),
>  #define COPY_OTHER_SIZE(gc, mSize)                mSize(other.mSize),
>  #define ADD_OTHER_SIZE(gc, mSize)                 mSize += other.mSize;
> +#define ADD_SIZE_TO_N_IF_LIVE_GC_THING(gc, mSize) n += gc ? mSize : 0;

Keep parens around the (gc) because MACROS.
Attachment #814551 - Flags: review?(n.nethercote)
Thanks Terrence!
Assignee: nobody → terrence
Attachment #814551 - Flags: review?(n.nethercote) → review+
Terrence, is this ready to land?  I can do a Windows try push if that's what's holding this back.
Flags: needinfo?(terrence)
The try push I did above came back with windows orange and red, including some rebuilds later in the day. The errors look spurious, but when I checked the base's push on m-i the windows builds were green. Maybe it was temporary tbpl bustage? A second try run would not be amiss.
Flags: needinfo?(terrence)
Windows try run is totally green.
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/c3d14caa839a
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: