Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / c2x-attr-syntax-5.c
blobb261be067cefb41e14c8d58d15020602074a0da9
1 /* Test C2x attribute syntax. Test unknown standard attributes
2 diagnosed with a pedwarn. */
3 /* { dg-do compile } */
4 /* { dg-options "-std=c2x -pedantic-errors" } */
6 [[unknown_attribute]]; /* { dg-error "attribute ignored" } */
8 [[unknown_attribute]] extern int a; /* { dg-error "attribute ignored" } */
9 extern int [[unknown_attribute(123)]] a; /* { dg-error "attribute ignored" } */
10 extern int a [[unknown_attribute("")]]; /* { dg-error "attribute ignored" } */
12 int f () [[unknown_attribute]]; /* { dg-error "attribute ignored" } */
13 int f (void) [[unknown_attribute(1)]]; /* { dg-error "attribute ignored" } */
14 int g ([[unknown_attribute]] int a); /* { dg-error "attribute ignored" } */
15 int g (int [[unknown_attribute]] a); /* { dg-error "attribute ignored" } */
16 int g (int a [[unknown_attribute]]); /* { dg-error "attribute ignored" } */
17 int g ([[unknown_attribute]] int); /* { dg-error "attribute ignored" } */
18 int g (int [[unknown_attribute]]); /* { dg-error "attribute ignored" } */
19 int g (int) [[unknown_attribute]]; /* { dg-error "attribute ignored" } */
21 int *[[unknown_attribute]] p; /* { dg-error "attribute ignored" } */
22 int b[3] [[unknown_attribute]]; /* { dg-error "attribute ignored" } */
24 int h (int () [[unknown_attribute]]); /* { dg-error "attribute ignored" } */
26 struct [[unknown_attribute]] s; /* { dg-error "attribute ignored" } */
27 union [[unknown_attribute]] u; /* { dg-error "attribute ignored" } */
29 struct [[unknown_attribute]] s2 { int a; }; /* { dg-error "attribute ignored" } */
30 union [[unknown_attribute(x)]] u2 { int a; }; /* { dg-error "attribute ignored" } */
32 struct s3 { [[unknown_attribute]] int a; }; /* { dg-error "attribute ignored" } */
33 struct s4 { int [[unknown_attribute]] a; }; /* { dg-error "attribute ignored" } */
34 union u3 { [[unknown_attribute]] int a; }; /* { dg-error "attribute ignored" } */
35 union u4 { int [[unknown_attribute]] a; }; /* { dg-error "attribute ignored" } */
37 int z = sizeof (int [[unknown_attribute]]); /* { dg-error "attribute ignored" } */
39 enum [[unknown_attribute]] { E1 }; /* { dg-error "attribute ignored" } */
40 enum { E2 [[unknown_attribute]] }; /* { dg-error "attribute ignored" } */
41 enum { E3 [[unknown_attribute]] = 4 }; /* { dg-error "attribute ignored" } */
43 void
44 func (void) [[unknown_attribute]] { /* { dg-error "attribute ignored" } */
45 [[unknown_attribute]] int var; /* { dg-error "attribute ignored" } */
46 [[unknown_attribute]] { } /* { dg-error "attribute ignored" } */
47 [[unknown_attribute(!)]]; /* { dg-error "attribute ignored" } */
48 [[unknown_attribute]] var = 1; /* { dg-error "attribute ignored" } */
49 [[unknown_attribute]] x: var = 2; /* { dg-error "attribute ignored" } */
50 for ([[unknown_attribute]] int zz = 1; zz < 10; zz++) ; /* { dg-error "attribute ignored" } */