1 |
149 |
jeremybenn |
/* 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 "error: two or more data types in declaration specifiers" } */
|
10 |
|
|
typeof(double) _Complex x1; /* { dg-error "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 "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 "error: both 'long' and 'short' in declaration specifiers" } */
|
21 |
|
|
/* { dg-warning "warning: useless type name in empty declaration" "empty" { target *-*-* } 20 } */
|
22 |
|
|
_Complex double; /* { dg-warning "warning: ISO C90 does not support complex types" } */
|
23 |
|
|
/* { dg-warning "warning: useless type name in empty declaration" "empty" { target *-*-* } 22 } */
|
24 |
|
|
_Complex; /* { dg-warning "warning: ISO C90 does not support complex types" } */
|
25 |
|
|
/* { dg-warning "warning: ISO C does not support plain 'complex' meaning 'double complex'" "ISO C" { target *-*-* } 24 } */
|
26 |
|
|
/* { dg-warning "warning: useless type name in empty declaration" "empty" { target *-*-* } 24 } */
|
27 |
|
|
_Complex int; /* { dg-warning "warning: ISO C90 does not support complex types" } */
|
28 |
|
|
/* { dg-warning "warning: ISO C does not support complex integer types" "ISO C" { target *-*-* } 27 } */
|
29 |
|
|
/* { dg-warning "warning: useless type name in empty declaration" "empty" { target *-*-* } 27 } */
|
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 |
|
|
char long x7; /* { dg-error "both 'long' and 'char' in declaration specifiers" } */
|
40 |
|
|
float long x8; /* { dg-error "both 'long' and 'float' in declaration specifiers" } */
|
41 |
|
|
long short x9; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */
|
42 |
|
|
void short x10; /* { dg-error "both 'short' and 'void' in declaration specifiers" } */
|
43 |
|
|
_Bool short x11; /* { dg-error "both 'short' and '_Bool' in declaration specifiers" } */
|
44 |
|
|
char short x12; /* { dg-error "both 'short' and 'char' in declaration specifiers" } */
|
45 |
|
|
float short x13; /* { dg-error "both 'short' and 'float' in declaration specifiers" } */
|
46 |
|
|
double short x14; /* { dg-error "both 'short' and 'double' in declaration specifiers" } */
|
47 |
|
|
unsigned signed x15; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */
|
48 |
|
|
void signed x16; /* { dg-error "both 'signed' and 'void' in declaration specifiers" } */
|
49 |
|
|
_Bool signed x17; /* { dg-error "both 'signed' and '_Bool' in declaration specifiers" } */
|
50 |
|
|
float signed x18; /* { dg-error "both 'signed' and 'float' in declaration specifiers" } */
|
51 |
|
|
double signed x19; /* { dg-error "both 'signed' and 'double' in declaration specifiers" } */
|
52 |
|
|
signed unsigned x20; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */
|
53 |
|
|
void unsigned x21; /* { dg-error "both 'unsigned' and 'void' in declaration specifiers" } */
|
54 |
|
|
_Bool unsigned x22; /* { dg-error "both 'unsigned' and '_Bool' in declaration specifiers" } */
|
55 |
|
|
float unsigned x23; /* { dg-error "both 'unsigned' and 'float' in declaration specifiers" } */
|
56 |
|
|
double unsigned x24; /* { dg-error "both 'unsigned' and 'double' in declaration specifiers" } */
|
57 |
|
|
void _Complex x25; /* { dg-error "both 'complex' and 'void' in declaration specifiers" } */
|
58 |
|
|
/* { dg-warning "warning: ISO C90 does not support complex types" "C90" { target *-*-* } 57 } */
|
59 |
|
|
_Bool _Complex x26; /* { dg-error "both 'complex' and '_Bool' in declaration specifiers" } */
|
60 |
|
|
/* { dg-warning "warning: ISO C90 does not support complex types" "C90" { target *-*-* } 59 } */
|
61 |
|
|
|
62 |
|
|
long void x27; /* { dg-error "both 'long' and 'void' in declaration specifiers" } */
|
63 |
|
|
short void x28; /* { dg-error "both 'short' and 'void' in declaration specifiers" } */
|
64 |
|
|
signed void x29; /* { dg-error "both 'signed' and 'void' in declaration specifiers" } */
|
65 |
|
|
unsigned void x30; /* { dg-error "both 'unsigned' and 'void' in declaration specifiers" } */
|
66 |
|
|
_Complex void x31; /* { dg-error "both 'complex' and 'void' in declaration specifiers" } */
|
67 |
|
|
/* { dg-warning "warning: ISO C90 does not support complex types" "C90" { target *-*-* } 66 } */
|
68 |
|
|
/* { dg-warning "warning: ISO C does not support plain 'complex' meaning 'double complex'" "complex" { target *-*-* } 66 } */
|
69 |
|
|
long _Bool x32; /* { dg-error "both 'long' and '_Bool' in declaration specifiers" } */
|
70 |
|
|
short _Bool x33; /* { dg-error "both 'short' and '_Bool' in declaration specifiers" } */
|
71 |
|
|
signed _Bool x34; /* { dg-error "both 'signed' and '_Bool' in declaration specifiers" } */
|
72 |
|
|
unsigned _Bool x35; /* { dg-error "both 'unsigned' and '_Bool' in declaration specifiers" } */
|
73 |
|
|
_Complex _Bool x36; /* { dg-error "both 'complex' and '_Bool' in declaration specifiers" } */
|
74 |
|
|
/* { dg-warning "warning: ISO C90 does not support complex types" "C90" { target *-*-* } 73 } */
|
75 |
|
|
/* { dg-warning "warning: ISO C does not support plain 'complex' meaning 'double complex'" "complex" { target *-*-* } 73 } */
|
76 |
|
|
long char x37; /* { dg-error "both 'long' and 'char' in declaration specifiers" } */
|
77 |
|
|
short char x38; /* { dg-error "both 'short' and 'char' in declaration specifiers" } */
|
78 |
|
|
long float x39; /* { dg-error "both 'long' and 'float' in declaration specifiers" } */
|
79 |
|
|
short float x40; /* { dg-error "both 'short' and 'float' in declaration specifiers" } */
|
80 |
|
|
signed float x41; /* { dg-error "both 'signed' and 'float' in declaration specifiers" } */
|
81 |
|
|
unsigned float x42; /* { dg-error "both 'unsigned' and 'float' in declaration specifiers" } */
|
82 |
|
|
long long double x43; /* { dg-error "both 'long long' and 'double' in declaration specifiers" } */
|
83 |
|
|
/* { dg-warning "warning: ISO C90 does not support 'long long'" "C90" { target *-*-* } 82 } */
|
84 |
|
|
short double x44; /* { dg-error "both 'short' and 'double' in declaration specifiers" } */
|
85 |
|
|
signed double x45; /* { dg-error "both 'signed' and 'double' in declaration specifiers" } */
|
86 |
|
|
unsigned double x46; /* { dg-error "both 'unsigned' and 'double' in declaration specifiers" } */
|