gcc/testsuite/gcc.dg/Wimplicit-fallthrough-1.c
raw| 1 | /* PR c/7652 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-Wimplicit-fallthrough -Wdeclaration-after-statement" } */ |
| 4 | |
| 5 | /* Test we don't print bogus "mixed declarations and code" warning. */ |
| 6 | |
| 7 | int |
| 8 | f (int b) |
| 9 | { |
| 10 | switch (b) |
| 11 | { |
| 12 | case 0: |
| 13 | b++; |
| 14 | __attribute__((fallthrough)); |
| 15 | case 1: |
| 16 | b--; |
| 17 | __attribute__((unused)) int a; /* { dg-warning "mixed declarations and code" } */ |
| 18 | case 2: |
| 19 | break; |
| 20 | } |
| 21 | return 99; |
| 22 | } |