annotate gcc/testsuite/gcc.dg/declspec-4.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test declaration specifiers. Test empty declarations. Test with
kono
parents:
diff changeset
2 no special options. */
kono
parents:
diff changeset
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
kono
parents:
diff changeset
4 /* { dg-do compile } */
kono
parents:
diff changeset
5 /* { dg-options "" } */
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 /* If a declaration does not declare a declarator, it must declare a
kono
parents:
diff changeset
8 tag or the members of an enumeration, and must only contain one
kono
parents:
diff changeset
9 type specifier. */
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 typedef int T;
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 struct s0;
kono
parents:
diff changeset
14 union u0;
kono
parents:
diff changeset
15 enum e0; /* A GNU extension. */
kono
parents:
diff changeset
16 enum { E0 };
kono
parents:
diff changeset
17 enum e1 { E1 };
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 /* Not declaring anything (pedwarns). */
kono
parents:
diff changeset
20 struct { int a; }; /* { dg-warning "unnamed struct/union that defines no instances" } */
kono
parents:
diff changeset
21 int; /* { dg-warning "useless type name in empty declaration" } */
kono
parents:
diff changeset
22 long; /* { dg-warning "useless type name in empty declaration" } */
kono
parents:
diff changeset
23 T; /* { dg-warning "useless type name in empty declaration" } */
kono
parents:
diff changeset
24 static const; /* { dg-warning "useless storage class specifier in empty declaration" } */
kono
parents:
diff changeset
25 /* { dg-warning "empty declaration" "static const" { target *-*-* } .-1 } */
kono
parents:
diff changeset
26 union { long b; }; /* { dg-warning "unnamed struct/union that defines no instances" } */
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 /* Multiple type names (errors). */
kono
parents:
diff changeset
29 struct s1 int; /* { dg-error "two or more data types in declaration specifiers" } */
kono
parents:
diff changeset
30 char union u1; /* { dg-error "two or more data types in declaration specifiers" } */
kono
parents:
diff changeset
31 /* { dg-warning "useless type name in empty declaration" "char union" { target *-*-* } .-1 } */
kono
parents:
diff changeset
32 double enum { E2 }; /* { dg-error "two or more data types in declaration specifiers" } */
kono
parents:
diff changeset
33 /* { dg-warning "useless type name in empty declaration" "double enum" { target *-*-* } .-1 } */
kono
parents:
diff changeset
34 T struct s2; /* { dg-error "two or more data types in declaration specifiers" } */
kono
parents:
diff changeset
35 /* { dg-warning "useless type name in empty declaration" "T struct" { target *-*-* } .-1 } */
kono
parents:
diff changeset
36 long union u2; /* { dg-error "two or more data types in declaration specifiers" } */
kono
parents:
diff changeset
37 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } .-1 } */
kono
parents:
diff changeset
38 struct s3 short; /* { dg-error "two or more data types in declaration specifiers" } */
kono
parents:
diff changeset
39 union u3 signed; /* { dg-error "two or more data types in declaration specifiers" } */
kono
parents:
diff changeset
40 unsigned struct s4; /* { dg-error "two or more data types in declaration specifiers" } */
kono
parents:
diff changeset
41 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } .-1 } */
kono
parents:
diff changeset
42 _Complex enum { E3 }; /* { dg-error "two or more data types in declaration specifiers" } */
kono
parents:
diff changeset
43 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } .-1 } */