OSDN Git Service

* c-tree.h (enum c_storage_class): New.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / declspec-5.c
1 /* Test declaration specifiers.  Test empty declarations.  Test with
2    -pedantic.  */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "-pedantic" } */
6
7 /* If a declaration does not declare a declarator, it must declare a
8    tag or the members of an enumeration, and must only contain one
9    type specifier.  */
10
11 typedef int T;
12
13 struct s0;
14 union u0;
15 enum e0; /* { dg-warning "warning: ISO C forbids forward references" } */
16 enum { E0 };
17 enum e1 { E1 };
18
19 /* Not declaring anything (pedwarns).  */
20 struct { int a; }; /* { dg-warning "warning: unnamed struct/union that defines no instances" } */
21 int; /* { dg-warning "warning: useless type name in empty declaration" } */
22 long; /* { dg-warning "warning: useless keyword or type name in empty declaration" } */
23 /* { dg-warning "warning: empty declaration" "long" { target *-*-* } 22 } */
24 T; /* { dg-warning "warning: useless type name in empty declaration" } */
25 static const; /* { dg-warning "warning: useless storage class specifier in empty declaration" } */
26 /* { dg-warning "warning: empty declaration" "long" { target *-*-* } 25 } */
27 union { long b; }; /* { dg-warning "warning: unnamed struct/union that defines no instances" } */
28
29 /* Multiple type names (errors).  */
30 struct s1 int; /* { dg-error "error: two or more data types in declaration specifiers" } */
31 char union u1; /* { dg-error "error: two or more data types in declaration specifiers" } */
32 /* { dg-warning "warning: useless type name in empty declaration" "char union" { target *-*-* } 31 } */
33 double enum { E2 }; /* { dg-error "error: two or more data types in declaration specifiers" } */
34 /* { dg-warning "warning: useless type name in empty declaration" "double enum" { target *-*-* } 33 } */
35 T struct s2; /* { dg-error "error: two or more data types in declaration specifiers" } */
36 /* { dg-warning "warning: useless type name in empty declaration" "T struct" { target *-*-* } 35 } */
37 long union u2; /* { dg-error "error: long, short, signed, unsigned or complex used invalidly in empty declaration" } */
38 struct s3 short; /* { dg-error "error: long, short, signed, unsigned or complex used invalidly in empty declaration" } */
39 union u3 signed; /* { dg-error "error: long, short, signed, unsigned or complex used invalidly in empty declaration" } */
40 unsigned struct s4; /* { dg-error "error: long, short, signed, unsigned or complex used invalidly in empty declaration" } */
41 _Complex enum { E3 }; /* { dg-error "error: long, short, signed, unsigned or complex used invalidly in empty declaration" } */