Higuoxing added a comment.

Sorry, It seems a little bit difficult for me to add a proper fix-it hint for 
expressions in macros, because I cannot find the exact position of the last 
char of the token on right hand side of operator. Any suggestion?

Actually, in gcc, it will emit warning for everything without a fix-it hint, 
let alone expressions in nested macros... I think that our warning note is 
enough for us to diagnose the lacking parentheses, as you see in my inline 
comment

  llvm/tools/clang/test/Sema/parentheses.c:109:15: note: place parentheses 
around the '&&' expression to silence this warning
    VOID_CAST(i && i || i); // expected-warning {{'&&' within '||'}} \
              ~~^~~~
  llvm/tools/clang/test/Sema/parentheses.c:17:34: note: expanded from macro 
'VOID_CAST'
  #define VOID_CAST(cond) ( (void)(cond) )
                                   ^~~~

So, it depends on you whether the parentheses checking in macros should be 
reserved. Both OK for me... Thanks for your reviewing :)


https://reviews.llvm.org/D47687



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to