Closed
Bug 1087488
Opened 10 years ago
Closed 9 years ago
Omnijar.cpp:62:47: warning: self-comparison always evaluates to true [-Wtautological-compare]
Categories
(Core :: General, defect)
Tracking
()
RESOLVED
FIXED
mozilla44
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
1.16 KB,
patch
|
glandium
:
review+
|
Details | Diff | Splinter Review |
Clang 3.5 gives this build warning:
{
$SRC/xpcom/build/Omnijar.cpp:62:47: warning: self-comparison always evaluates to true [-Wtautological-compare]
}
It includes this (preprocessed) source in the warning output:
nsDirectoryService::gService->Get(((GRE == mozilla::Omnijar::GRE) ?
^
This is for this code:
> 26 #define SPROP(Type) ((Type == mozilla::Omnijar::GRE) ? sProp[GRE] : sProp[APP])
[...]
> 62 nsDirectoryService::gService->Get(SPROP(GRE), NS_GET_IID(nsIFile),
> 63 getter_AddRefs(greDir));
http://mxr.mozilla.org/mozilla-central/source/xpcom/build/Omnijar.cpp#62
...which was added here, for bug 620931:
http://hg.mozilla.org/mozilla-central/rev/88caff1a09d0#l12.86
glandium, can we restructure this code such that it doesn't end up expanding to a tautological comparison? (Alternately, we could use #pragmas to disable the warning, in a targeted way, but that'd probably be the messier choice.)
Assignee | ||
Comment 1•9 years ago
|
||
Still seeing this in current builds. glandium, how does this look?
(The patch avoids passing the constant values GRE & APP into this macro, so now we'll only be using the macro when we've actually got a variable with an unknown value.)
Attachment #8663184 -
Flags: review?(mh+mozilla)
Updated•9 years ago
|
Attachment #8663184 -
Flags: review?(mh+mozilla) → review+
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → dholbert
Assignee | ||
Comment 3•9 years ago
|
||
(side note: looks like I don't get this build warning reliably. I suspect it happens when I'm building with distcc (as I normally do), because the file gets preprocessed before being compiled remotely, or something like that. The compiler is probably friendlier about tautologies-hidden-behind-macros when building 100% locally.)
Comment 4•9 years ago
|
||
Yes, building preprocessed files is clearly not helping.
Comment 5•9 years ago
|
||
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in
before you can comment on or make changes to this bug.
Description
•