[PATCH] D24861: [Sema] extend Wshift-op-parentheses so it warns for multiplicative operators

Daniel Marjamäki via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 27 02:16:42 PDT 2016

danielmarjamaki added a comment.

Compiling 2064 projects resulted in 904 warnings

Here are the results:

The results looks acceptable imho. The code looks intentional in many cases so I believe there are users that will disable this warning. Probably there are true positives where the evaluation order is not really known. There were many warnings about macro arguments where the macro bitshifts the argument - these macros look very shaky to me.

I saw some warnings about such code:

  a * b << c

Maybe we should not warn about this. As far as I see, the result will be the same if (a*b) or (b<<c) is evaluated first - unless there is some overflow or signedness issues. What do you think? I'll keep these warnings for now.



More information about the cfe-commits mailing list