gcc/testsuite/c-c++-common/Wmultistatement-macros-5.c
raw| 1 | /* PR c/80116 */ |
| 2 | /* { dg-options "-Wmultistatement-macros" } */ |
| 3 | /* { dg-do compile } */ |
| 4 | |
| 5 | #define M(N) \ |
| 6 | L ## N: \ |
| 7 | x++; x++ /* { dg-warning "macro expands to multiple statements" } */ |
| 8 | |
| 9 | int x, y, tmp; |
| 10 | |
| 11 | void |
| 12 | fn1 (void) |
| 13 | { |
| 14 | if (x) /* { dg-message "not guarded by this 'if' clause" } */ |
| 15 | M (0); /* { dg-message "in expansion of macro .M." } */ |
| 16 | if (x) /* { dg-message "not guarded by this 'if' clause" } */ |
| 17 | M (1); /* { dg-message "in expansion of macro .M." } */ |
| 18 | } |