[PATCH] D63423: [Diagnostics] Diagnose misused xor as pow

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 19 10:41:23 PDT 2019


xbolva00 added a comment.

In D63423#1550697 <https://reviews.llvm.org/D63423#1550697>, @jfb wrote:

> What I meant with macros was that I don't think we should warn on:
>
>   #define LEGIT(a, b) ({ work work work; a ^ b; work work work; })
>  
>   LEGIT(10, 5);
>
>
> If the constants are inline in the macros then sure, warn there. Basically: if you literally wrote `CONSTANT ^ CONSTANT` and it looks fishy, let's warn. If token-pasting wrote it for you and it looks fishy, let's not warn.


Is it worth to pattern match this case? I don't like how this diagnostic is getting more and more complicated.

User can use -Wno-xor-used-as-pow if auto-generated weird code.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63423/new/

https://reviews.llvm.org/D63423





More information about the cfe-commits mailing list