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. */ 9typeof(double) long x0; /* { dg-error "error: two or more data types in declaration specifiers" } */ 10typeof(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. */ 14typedef double D; 15D _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. */ 20long 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 35long double long x3; /* { dg-error "both 'long long' and 'double' in declaration specifiers" } */ 36short long x4; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */ 37void long x5; /* { dg-error "both 'long' and 'void' in declaration specifiers" } */ 38_Bool long x6; /* { dg-error "both 'long' and '_Bool' in declaration specifiers" } */ 39char long x7; /* { dg-error "both 'long' and 'char' in declaration specifiers" } */ 40float long x8; /* { dg-error "both 'long' and 'float' in declaration specifiers" } */ 41long short x9; /* { dg-error "both 'long' and 'short' in declaration specifiers" } */ 42void short x10; /* { dg-error "both 'short' and 'void' in declaration specifiers" } */ 43_Bool short x11; /* { dg-error "both 'short' and '_Bool' in declaration specifiers" } */ 44char short x12; /* { dg-error "both 'short' and 'char' in declaration specifiers" } */ 45float short x13; /* { dg-error "both 'short' and 'float' in declaration specifiers" } */ 46double short x14; /* { dg-error "both 'short' and 'double' in declaration specifiers" } */ 47unsigned signed x15; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */ 48void signed x16; /* { dg-error "both 'signed' and 'void' in declaration specifiers" } */ 49_Bool signed x17; /* { dg-error "both 'signed' and '_Bool' in declaration specifiers" } */ 50float signed x18; /* { dg-error "both 'signed' and 'float' in declaration specifiers" } */ 51double signed x19; /* { dg-error "both 'signed' and 'double' in declaration specifiers" } */ 52signed unsigned x20; /* { dg-error "both 'signed' and 'unsigned' in declaration specifiers" } */ 53void unsigned x21; /* { dg-error "both 'unsigned' and 'void' in declaration specifiers" } */ 54_Bool unsigned x22; /* { dg-error "both 'unsigned' and '_Bool' in declaration specifiers" } */ 55float unsigned x23; /* { dg-error "both 'unsigned' and 'float' in declaration specifiers" } */ 56double unsigned x24; /* { dg-error "both 'unsigned' and 'double' in declaration specifiers" } */ 57void _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 62long void x27; /* { dg-error "both 'long' and 'void' in declaration specifiers" } */ 63short void x28; /* { dg-error "both 'short' and 'void' in declaration specifiers" } */ 64signed void x29; /* { dg-error "both 'signed' and 'void' in declaration specifiers" } */ 65unsigned 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 } */ 69long _Bool x32; /* { dg-error "both 'long' and '_Bool' in declaration specifiers" } */ 70short _Bool x33; /* { dg-error "both 'short' and '_Bool' in declaration specifiers" } */ 71signed _Bool x34; /* { dg-error "both 'signed' and '_Bool' in declaration specifiers" } */ 72unsigned _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 } */ 76long char x37; /* { dg-error "both 'long' and 'char' in declaration specifiers" } */ 77short char x38; /* { dg-error "both 'short' and 'char' in declaration specifiers" } */ 78long float x39; /* { dg-error "both 'long' and 'float' in declaration specifiers" } */ 79short float x40; /* { dg-error "both 'short' and 'float' in declaration specifiers" } */ 80signed float x41; /* { dg-error "both 'signed' and 'float' in declaration specifiers" } */ 81unsigned float x42; /* { dg-error "both 'unsigned' and 'float' in declaration specifiers" } */ 82long 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 } */ 84short double x44; /* { dg-error "both 'short' and 'double' in declaration specifiers" } */ 85signed double x45; /* { dg-error "both 'signed' and 'double' in declaration specifiers" } */ 86unsigned double x46; /* { dg-error "both 'unsigned' and 'double' in declaration specifiers" } */ 87