gcc/testsuite/c-c++-common/Wimplicit-fallthrough-21.c
raw| 1 | /* PR c/7652 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-Wimplicit-fallthrough" } */ |
| 4 | |
| 5 | int |
| 6 | f (int i) |
| 7 | { |
| 8 | switch (i) |
| 9 | { |
| 10 | case 0: |
| 11 | i++; |
| 12 | __attribute__((fallthrough)); |
| 13 | lab1: |
| 14 | case 1: |
| 15 | i++; |
| 16 | __attribute__((fallthrough)); /* { dg-warning "not preceding" } */ |
| 17 | lab2: |
| 18 | --i; |
| 19 | break; |
| 20 | case 3: |
| 21 | i++; |
| 22 | break; |
| 23 | } |
| 24 | return 0; |
| 25 | } |