[cfe-commits] [Patch] Warn about |= in conditionals

Hans Wennborg hans at chromium.org
Wed Jan 19 07:53:34 PST 2011


Hi,

The attached patch adds a warning for using |= without parentheses in
conditionals, as in:

if (a |= b) {}

and suggests replacing it with != or adding parentheses.

This is for http://llvm.org/bugs/show_bug.cgi?id=9001

Also, I considered whether it would make sense to warn for all
assignment operators in conditionals, and not just common typos (i.e.
= and |=). Do you think that would make sense?

Please review.

Thanks,
Hans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: or_assign_conditionals.patch
Type: text/x-patch
Size: 4099 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110119/b03ac0a4/attachment.bin>


More information about the cfe-commits mailing list