Closed Bug 422484 Opened 16 years ago Closed 16 years ago

Add parens around macro if conditions

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dmandelin, Assigned: dmandelin)

Details

Attachments

(2 files)

There are 2 places in SVG where if conditions are "missing" parens, like

  if NS_FAILED(rv) { ...

This compiles fine, because of the definition of the macro, but it looks funny. More importantly, it prevents NS_FAILED from being an inline function, which makes static analysis harder. 

So, can we add them, as in the attached patch? mozilla-central is where I really want this, that's the main target for static analysis, but it might be good to have it in CVS trunk as well.
Comment on attachment 308926 [details] [diff] [review]
Patch to add parens to macro if conditions

This is trivially correct. I've already fixed two of these! Reviewers should be catching these :-(
Attachment #308926 - Flags: review+
Attachment #308926 - Flags: approval1.9?
FWIW, here's 2 more of this same type of bug, in Camino code:

http://mxr.mozilla.org/seamonkey/source/camino/src/formfill/wallet.mm#840
 840   if NS_FAILED(rv) {
 854   if NS_FAILED(rv) {
Assignee: nobody → dmandelin
The nsSVGGlyphFrame code will disappear anyway as a side effect of bug 392233
Attachment #308939 - Flags: review?(benjamin) → review?(joshmoz)
Comment on attachment 308926 [details] [diff] [review]
Patch to add parens to macro if conditions

a1.9+=damons
Attachment #308926 - Flags: approval1.9? → approval1.9+
Comment on attachment 308939 [details] [diff] [review]
patch for same issue in camino code

wow, nice
Attachment #308939 - Flags: superreview+
Attachment #308939 - Flags: review?(joshmoz)
Attachment #308939 - Flags: review+
Keywords: checkin-needed
Attachment #308939 - Flags: approval1.9?
Attachment #308939 - Flags: approval1.9?
Both patches checked in.

Checking in svg/base/src/nsSVGGlyphFrame.cpp;
/cvsroot/mozilla/layout/svg/base/src/nsSVGGlyphFrame.cpp,v  <--  nsSVGGlyphFrame.cpp
new revision: 1.119; previous revision: 1.118
done
Checking in xul/base/src/nsXULPopupManager.cpp;
/cvsroot/mozilla/layout/xul/base/src/nsXULPopupManager.cpp,v  <--  nsXULPopupManager.cpp
new revision: 1.54; previous revision: 1.53
done


Checking in wallet.mm;
/cvsroot/mozilla/camino/src/formfill/wallet.mm,v  <--  wallet.mm
new revision: 1.11; previous revision: 1.10
done
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: