dblaikie added a comment.

In D77611#1965824 <https://reviews.llvm.org/D77611#1965824>, @nickdesaulniers 
wrote:

> ah, using this to build a Linux kernel triggers tons of warnings. So the 
> behavior of GCC is even more subtle than captured in the test cases here.


At least one thing I noticed - GCC only warns about the first unused statement 
in a statement expression (whether or not it's in a macro):

  $ g++-tot warn.cpp -Wunused-value -c
  In file included from warn.cpp:1:
  warn.cpp: In function ‘int main()’:
  warn.cpp:2:14: warning: statement has no effect [-Wunused-value]
      2 | #define X ({ y; z; })
        |              ^
  warn.cpp:6:15: note: in expansion of macro ‘X’
      6 |   assert(4 == X);
        |               ^
  warn.cpp:7:3: warning: statement has no effect [-Wunused-value]
      7 |   y;
        |   ^
  warn.cpp:8:3: warning: statement has no effect [-Wunused-value]
      8 |   z;
        |   ^
  warn.cpp:9:4: warning: statement has no effect [-Wunused-value]
      9 | ({ y; z; });
        |    ^


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77611



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

Reply via email to