gcc/testsuite/gcc.dg/c23-attr-fallthrough-4.c
raw| 1 | /* Test C23 fallthrough attribute: duplicates (allowed after N2557). */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-std=c23 -pedantic-errors" } */ |
| 4 | |
| 5 | int |
| 6 | f (int a) |
| 7 | { |
| 8 | switch (a) |
| 9 | { |
| 10 | case 1: |
| 11 | a++; |
| 12 | [[fallthrough, __fallthrough__]]; /* { dg-warning "specified multiple times" } */ |
| 13 | case 2: |
| 14 | a++; |
| 15 | [[fallthrough]] [[fallthrough]]; /* { dg-warning "specified multiple times" } */ |
| 16 | case 3: |
| 17 | a++; |
| 18 | } |
| 19 | return a; |
| 20 | } |