#!/usr/bin/perl -w @validspecs = ( [ sort qw(void) ], [ sort qw(char) ], [ sort qw(signed char) ], [ sort qw(unsigned char) ], [ sort qw(short) ], [ sort qw(signed short) ], [ sort qw(short int) ], [ sort qw(signed short int) ], [ sort qw(unsigned short) ], [ sort qw(unsigned short int) ], [ sort qw(int) ], [ sort qw(signed) ], [ sort qw(signed int) ], [ sort qw(unsigned) ], [ sort qw(unsigned int) ], [ sort qw(long) ], [ sort qw(signed long) ], [ sort qw(long int) ], [ sort qw(signed long int) ], [ sort qw(unsigned long) ], [ sort qw(unsigned long int) ], [ sort qw(long long) ], [ sort qw(signed long long) ], [ sort qw(long long int) ], [ sort qw(signed long long int) ], [ sort qw(unsigned long long) ], [ sort qw(unsigned long long int) ], [ sort qw(float) ], [ sort qw(double) ], [ sort qw(long double) ], [ sort qw(_Bool) ], [ sort qw(type) ] ); @typespecs = qw(void char short int long float double signed unsigned _Bool); sub validtype ( $ ) { my($typename) = @_; my(@specs) = sort split(/ /, $typename); $typename = join(" ", @specs); if (grep(join(" ", @{$_}) eq $typename, @validspecs)) { return 1; } return 0; } @typenames = (@typespecs, "type"); $c = 0; print < */ /* { dg-do compile } */ /* { dg-options "-std=gnu99" } */ typedef char type; EOF while (@typenames) { @newtypes = (); foreach $t (@typenames) { if (validtype($t)) { print "$t *x$c;\n"; foreach $u (@typespecs) { push(@newtypes, "$t $u"); } } else { print "$t *x$c; /* { dg-error \"error\" \"$t\" } */\n"; } $c++; } @typenames = @newtypes; }