1 /* Test C23 attribute syntax. Test GNU attributes appertain to
2 appropriate constructs. */
3 /* { dg-do compile } */
4 /* { dg-require-alias "" } */
5 /* { dg-options "-std=gnu23" } */
9 [[gnu::alias("f")]] void g (void); /* { dg-error "only weak" "" { target *-*-darwin* } } */
11 void [[gnu::alias("f")]] h (void); /* { dg-warning "does not apply to types" } */
13 struct [[gnu::packed
]] s
{ int a
; char b
; };
14 _Static_assert (sizeof (struct s
) == (sizeof (int) + sizeof (char)));
19 [[gnu::deprecated
]] int a
= 1;
20 return a
; /* { dg-warning "deprecated" } */
26 int a
[[gnu::deprecated
]] = 1;
27 return a
; /* { dg-warning "deprecated" } */
30 struct s2
{ [[gnu::deprecated
]] int a
; int b
[[gnu::deprecated
]]; } x
;
35 return x
.a
; /* { dg-warning "deprecated" } */
41 return x
.b
; /* { dg-warning "deprecated" } */
44 enum e
{ E1
[[gnu::deprecated
]] };
49 return E1
; /* { dg-warning "deprecated" } */
53 f7 ([[gnu::deprecated
]] int y
)
55 return y
; /* { dg-warning "deprecated" } */
58 union [[gnu::deprecated
]] u
{ int x
; };
63 union u var
; /* { dg-warning "deprecated" } */
66 enum [[gnu::deprecated
]] edep
{ E2
};
71 enum edep var
; /* { dg-warning "deprecated" } */