Closed Bug 820536 Opened 13 years ago Closed 12 years ago

-Wlogical-op-parentheses warning in gfx/2d/DrawTargetCG.cpp

Categories

(Core :: Graphics, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 839384

People

(Reporter: milan, Assigned: milan)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

A compiler warning on something like this: if (a == b && c == d || a == f && c == g) may as well get rid of the warning and make things "safer" to read. /Users/msreckovic/Development/mozilla-central/gfx/2d/DrawTargetCG.cpp:987:41: warning: '&&' within '||' [-Wlogical-op-parentheses] ...aType == NATIVE_SURFACE_CGCONTEXT && GetContextType(mCg) == CG_CONTEXT_TYPE_BITMAP || ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~ /Users/msreckovic/Development/mozilla-central/gfx/2d/DrawTargetCG.cpp:987:41: note: place parentheses around the '&&' expression to silence this warning ...aType == NATIVE_SURFACE_CGCONTEXT && GetContextType(mCg) == CG_CONTEXT_TYPE_BITMAP ... ^ ( ) /Users/msreckovic/Development/mozilla-central/gfx/2d/DrawTargetCG.cpp:988:53: warning: '&&' within '||' [-Wlogical-op-parentheses] ...aType == NATIVE_SURFACE_CGCONTEXT_ACCELERATED && GetContextType(mCg) == CG_CONTEXT_TYPE_IOSURFACE... ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/msreckovic/Development/mozilla-central/gfx/2d/DrawTargetCG.cpp:988:53: note: place parentheses around the '&&' expression to silence this warning ...aType == NATIVE_SURFACE_CGCONTEXT_ACCELERATED && GetContextType(mCg) == CG_CONTEXT_TYPE_IOSURFACE)…
Add the reference to the beta bug to clean all the warnings.
Blocks: buildwarning
Assignee: nobody → milan
C++ operator precedence being what it is, the original: if (a == b && c == d || a == f && c == g) { is the same as: if (((a == b) && (c == d)) || ((a == f) && (c == g))) { But without the compiler warning. No functional/logical change intended.
Attachment #691038 - Flags: review?(bgirard)
Comment on attachment 691038 [details] [diff] [review] Add explicit parentheses in the compound logical statement Review of attachment 691038 [details] [diff] [review]: ----------------------------------------------------------------- Less warning noise masking useful warnings \o/. NIT: I think adding parentheses around (a == b) is a bit to far.
Attachment #691038 - Flags: review?(bgirard) → review+
Attachment #691038 - Attachment is obsolete: true
Attachment #691100 - Flags: checkin?
Comment on attachment 691100 [details] [diff] [review] Updated with code review comments FYI, checkin-needed will get your patches landed much faster in the future
Attachment #691100 - Flags: checkin?
dholbert fixed this in bug 839384 in the mean time :)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: