1 /* Test declaration specifiers.  Test messages for bad type
2    specifiers.  */
3 /* Origin: Joseph Myers <jsm@polyomino.org.uk> */
4 /* { dg-do compile } */
5 /* { dg-options "-std=gnu89 -pedantic" } */
6 
7 /* typeof should act much like typedef, so the following are
8    invalid.  */
9 typeof(double) long x0; /* { dg-error "two or more data types in declaration specifiers" } */
10 typeof(double) _Complex x1; /* { dg-error "two or more data types in declaration specifiers" } */
11 
12 /* The following is erroneous, and used to get a bogus message about
13    complex integer types.  */
14 typedef double D;
15 D _Complex x2; /* { dg-error "two or more data types in declaration specifiers" } */
16 
17 /* The following empty declarations should have problems in their type
18    specifiers diagnosed, not just the general problem that they are
19    empty declarations.  */
20 long short; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */
21 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } .-1 } */
22 _Complex double; /* { dg-warning "ISO C90 does not support complex types" } */
23 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } .-1 } */
24 _Complex; /* { dg-warning "ISO C90 does not support complex types" } */
25 /* { dg-warning "ISO C does not support plain 'complex' meaning 'double complex'" "ISO C" { target *-*-* } .-1 } */
26 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } .-2 } */
27 _Complex int; /* { dg-warning "ISO C90 does not support complex types" } */
28 /* { dg-warning "ISO C does not support complex integer types" "ISO C" { target *-*-* } .-1 } */
29 /* { dg-warning "useless type name in empty declaration" "empty" { target *-*-* } .-2 } */
30 
31 /* Specific messages for each invalid combination.  (That some message
32    is given when appropriate for a larger collection of combinations
33    of type specifiers is tested in *typespec*.c.)  */
34 
35 long double long x3; /* { dg-error "both 'long long' and 'double' in declaration specifiers" } */
36 short long x4; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */
37 void long x5; /* { dg-error "both 'long' and 'void' in declaration specifiers" } */
38 _Bool long x6; /* { dg-error "both 'long' and '_Bool' in declaration specifiers" } */
39 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-1 } */
40 char long x7; /* { dg-error "both 'long' and 'char' in declaration specifiers" } */
41 float long x8; /* { dg-error "both 'long' and 'float' in declaration specifiers" } */
42 long short x9; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */
43 void short x10; /* { dg-error "both 'short' and 'void' in declaration specifiers" } */
44 _Bool short x11; /* { dg-error "both 'short' and '_Bool' in declaration specifiers" } */
45 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-1 } */
46 char short x12; /* { dg-error "both 'short' and 'char' in declaration specifiers" } */
47 float short x13; /* { dg-error "both 'short' and 'float' in declaration specifiers" } */
48 double short x14; /* { dg-error "both 'short' and 'double' in declaration specifiers" } */
49 unsigned signed x15; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */
50 void signed x16; /* { dg-error "both 'signed' and 'void' in declaration specifiers" } */
51 _Bool signed x17; /* { dg-error "both 'signed' and '_Bool' in declaration specifiers" } */
52 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-1 } */
53 float signed x18; /* { dg-error "both 'signed' and 'float' in declaration specifiers" } */
54 double signed x19; /* { dg-error "both 'signed' and 'double' in declaration specifiers" } */
55 signed unsigned x20; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */
56 void unsigned x21; /* { dg-error "both 'unsigned' and 'void' in declaration specifiers" } */
57 _Bool unsigned x22; /* { dg-error "both 'unsigned' and '_Bool' in declaration specifiers" } */
58 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-1 } */
59 float unsigned x23; /* { dg-error "both 'unsigned' and 'float' in declaration specifiers" } */
60 double unsigned x24; /* { dg-error "both 'unsigned' and 'double' in declaration specifiers" } */
61 void _Complex x25; /* { dg-error "both 'complex' and 'void' in declaration specifiers" } */
62 /* { dg-warning "ISO C90 does not support complex types" "C90" { target *-*-* } .-1 } */
63 _Bool _Complex x26; /* { dg-error "both 'complex' and '_Bool' in declaration specifiers" } */
64 /* { dg-warning "ISO C90 does not support complex types" "C90" { target *-*-* } .-1 } */
65 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-2 } */
66 
67 long void x27; /* { dg-error "both 'long' and 'void' in declaration specifiers" } */
68 short void x28; /* { dg-error "both 'short' and 'void' in declaration specifiers" } */
69 signed void x29; /* { dg-error "both 'signed' and 'void' in declaration specifiers" } */
70 unsigned void x30; /* { dg-error "both 'unsigned' and 'void' in declaration specifiers" } */
71 _Complex void x31; /* { dg-error "both 'complex' and 'void' in declaration specifiers" } */
72 /* { dg-warning "ISO C90 does not support complex types" "C90" { target *-*-* } .-1 } */
73 /* { dg-warning "ISO C does not support plain 'complex' meaning 'double complex'" "complex" { target *-*-* } .-2 } */
74 long _Bool x32; /* { dg-error "both 'long' and '_Bool' in declaration specifiers" } */
75 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-1 } */
76 short _Bool x33; /* { dg-error "both 'short' and '_Bool' in declaration specifiers" } */
77 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-1 } */
78 signed _Bool x34; /* { dg-error "both 'signed' and '_Bool' in declaration specifiers" } */
79 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-1 } */
80 unsigned _Bool x35; /* { dg-error "both 'unsigned' and '_Bool' in declaration specifiers" } */
81 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-1 } */
82 _Complex _Bool x36; /* { dg-error "both 'complex' and '_Bool' in declaration specifiers" } */
83 /* { dg-warning "ISO C90 does not support complex types" "C90" { target *-*-* } .-1 } */
84 /* { dg-warning "ISO C90 does not support boolean types" "C90" { target *-*-* } .-2 } */
85 /* { dg-warning "ISO C does not support plain 'complex' meaning 'double complex'" "complex" { target *-*-* } .-3 } */
86 long char x37; /* { dg-error "both 'long' and 'char' in declaration specifiers" } */
87 short char x38; /* { dg-error "both 'short' and 'char' in declaration specifiers" } */
88 long float x39; /* { dg-error "both 'long' and 'float' in declaration specifiers" } */
89 short float x40; /* { dg-error "both 'short' and 'float' in declaration specifiers" } */
90 signed float x41; /* { dg-error "both 'signed' and 'float' in declaration specifiers" } */
91 unsigned float x42; /* { dg-error "both 'unsigned' and 'float' in declaration specifiers" } */
92 long long double x43; /* { dg-error "both 'long long' and 'double' in declaration specifiers" } */
93 /* { dg-warning "ISO C90 does not support 'long long'" "C90" { target *-*-* } .-1 } */
94 short double x44; /* { dg-error "both 'short' and 'double' in declaration specifiers" } */
95 signed double x45; /* { dg-error "both 'signed' and 'double' in declaration specifiers" } */
96 unsigned double x46; /* { dg-error "both 'unsigned' and 'double' in declaration specifiers" } */
97