Revise -mdisable-fpregs option and add new -msoft-mult option
[official-gcc.git] / gcc / testsuite / gcc.dg / c2x-attr-syntax-3.c
blob2f0d9f60cc00bb063ed473c5b4a421a4a5837048
1 /* Test C2x attribute syntax. Invalid uses of attributes. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c2x -pedantic-errors" } */
5 /* Prefix attributes not allowed on declarations without declarators. */
7 [[]] struct s { int a; }; /* { dg-error "empty declaration" } */
9 [[]] union u { int a; }; /* { dg-error "empty declaration" } */
11 void
12 f1 (void)
14 [[]] struct t { int a; }; /* { dg-error "empty declaration" } */
17 /* Prefix attributes not allowed on _Static_assert. */
19 [[]] _Static_assert (1); /* { dg-error "expected" } */
21 void
22 f2 (void)
24 [[]] _Static_assert (1); /* { dg-error "expected" } */
27 /* Declarations, including attribute declarations, cannot appear after
28 labels when a statement is expected. */
30 void
31 f3 (void)
33 if (1)
34 x: [[]]; /* { dg-error "expected" } */
37 /* Prefix attributes cannot appear on type names. */
39 int z = sizeof ([[]] int); /* { dg-error "expected" } */
41 /* Attributes are not allowed after struct, union or enum, except when
42 the type contents are being defined or the declaration is just
43 "struct-or-union atribute-specifier-sequence identifier;". */
45 const struct [[]] s2; /* { dg-warning "useless type qualifier" } */
46 /* { dg-error "invalid use of attributes in empty declaration" "invalid" { target *-*-* } .-1 } */
48 const union [[]] u2; /* { dg-warning "useless type qualifier" } */
49 /* { dg-error "invalid use of attributes in empty declaration" "invalid" { target *-*-* } .-1 } */
51 struct [[]] s3 *sv; /* { dg-error "expected" } */
53 union [[]] u3 *uv; /* { dg-error "expected" } */
55 enum e { E1 };
57 enum [[]] e *ev; /* { dg-error "expected" } */