[cfe-commits] [Patch] Warn about |= in conditionals
Douglas Gregor
dgregor at apple.com
Wed Jan 19 08:54:27 PST 2011
On Jan 19, 2011, at 7:53 AM, Hans Wennborg wrote:
> 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
Looks great, thanks! I've committed it as r123836; please go ahead and close the bug.
> 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?
Personally, I'd rather keep the warning to likely typos.
- Doug
More information about the cfe-commits
mailing list