| 1 |
/* Test C23 attribute syntax. Basic tests of valid uses of empty |
| 2 |
attributes. */ |
| 3 |
/* { dg-do compile } */ |
| 4 |
/* { dg-options "-std=c23 -pedantic-errors" } */ |
| 5 |
|
| 6 |
[ [ ] ] [[]]; |
| 7 |
|
| 8 |
[[]] int [[]] a [[]] = 123; |
| 9 |
|
| 10 |
int f([[]] int x [[]], [[]] long [[]], short [[]] *[[]] [3] [[]], |
| 11 |
int [[]] (int)[[]], int (*)(int)[[]]) [[]] [[]]; |
| 12 |
|
| 13 |
int g [[]] [2] [[]] [3] [[]]; |
| 14 |
|
| 15 |
int *[[]] const *[[]] volatile *[[]] *const p; |
| 16 |
|
| 17 |
int *[[]][[]] q = 0; |
| 18 |
|
| 19 |
struct [[]] s; |
| 20 |
union [[]][[]] u; |
| 21 |
|
| 22 |
struct [[]] s2 { [[]] long [[]] *a[[]] [3] [[]] [4], b[[]]; }; |
| 23 |
|
| 24 |
union [[]] u2 { [[]] long [[]] *a[[]] [3] [[]] [4]; }; |
| 25 |
|
| 26 |
int z = sizeof (int [[]]); |
| 27 |
|
| 28 |
enum [[]] { E1 [[]][[]], E2[[]][[]] = 3 }; |
| 29 |
enum [[]] e { E3 = 4, E4 [[]] }; |
| 30 |
|
| 31 |
void |
| 32 |
func (void) [[]] |
| 33 |
{ |
| 34 |
[[]] int var; |
| 35 |
[[]] { } |
| 36 |
[[]] switch (a) { [[]] case 1: [[]] case 2: [[]] default: [[]] var = 3; } |
| 37 |
[[]] x : [[]] y: [[]] var = 1; |
| 38 |
[[]]; |
| 39 |
int [[]] var2; |
| 40 |
[[]] if (a) [[]] (void) 0; else [[]] (void) 1; |
| 41 |
[[]] while (0) [[]] var = 2; |
| 42 |
[[]] do [[]] var = 3; while (0); |
| 43 |
for ([[]] int zz = 1; zz < 10; zz++) |
| 44 |
{ |
| 45 |
[[]] var2 = 8; |
| 46 |
[[]] continue; |
| 47 |
[[]] break; |
| 48 |
} |
| 49 |
if (a) [[]] goto x; |
| 50 |
[[]] return; |
| 51 |
} |
| 52 |
|
| 53 |
void func2 () [[]]; |
| 54 |
|
| 55 |
void func3 () [[]] { } |