| 1 |
/* Tests for labels before declarations and at ends of compound statements |
| 2 |
* in combination with attributes. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-std=c23 -Wall" } */ |
| 5 |
|
| 6 |
int f(void) |
| 7 |
{ |
| 8 |
goto b; |
| 9 |
a: int i = 0; |
| 10 |
aa: __attribute__((unused)) int u = 0; int v = 0; /* { dg-warning "GNU-style attribute between label and declaration appertains to the label" } */ |
| 11 |
goto c; |
| 12 |
{ c: } |
| 13 |
b: goto a; |
| 14 |
return i + u + v; |
| 15 |
d: __attribute__((unused)) (void)0; |
| 16 |
e: __attribute__((unused)) |
| 17 |
} |
| 18 |
|
| 19 |
int g(void) |
| 20 |
{ |
| 21 |
goto b; |
| 22 |
a: int i = 0; |
| 23 |
[[maybe_unused]] aa: int u = 0; int v = 0; |
| 24 |
goto c; |
| 25 |
{ c: } |
| 26 |
b: goto a; |
| 27 |
return i + u + v; |
| 28 |
[[maybe_unused]] d: (void)0; |
| 29 |
[[maybe_unused]] e: |
| 30 |
} |
| 31 |
|
| 32 |
void h(void) |
| 33 |
{ |
| 34 |
[[maybe_unused]] a: [[maybe_unused]] b: [[maybe_unused]] int x; |
| 35 |
|
| 36 |
if (1) |
| 37 |
[[maybe_unused]] c: [[maybe_unused]] d: (void)0; |
| 38 |
} |