- } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_-]*)?/) {
- my($const) = $1;
- my($type) = "$3$4";
- my($value) = $5;
- my($res) = $missing;
-
- # Remember that this name is allowed.
- push @allow, $const;
-
- # Generate a program to test for the availability of this constant.
- open (TESTFILE, ">$fnamebase.c");
- print TESTFILE "$prepend";
- print TESTFILE "#include <$h>\n";
- print TESTFILE "__typeof__ ($const) a = $const;\n";
- close (TESTFILE);
-
- $res = compiletest ($fnamebase, "Testing for constant $const",
- "Constant \"$const\" not available.", $res, 0);
-
- # Test the types of the members.
- open (TESTFILE, ">$fnamebase.c");
- print TESTFILE "$prepend";
- print TESTFILE "#include <$h>\n";
- print TESTFILE "__typeof__ (($type) 0) a;\n";
- print TESTFILE "extern __typeof__ ($const) a;\n";
- close (TESTFILE);
-
- compiletest ($fnamebase, "Testing for type of constant $const",
- "Constant \"$const\" does not have the correct type.",
- $res, 0);
-
- if ($value ne "") {
- # Generate a program to test for the value of this constant.
- open (TESTFILE, ">$fnamebase.c");
- print TESTFILE "$prepend";
- print TESTFILE "#include <$h>\n";
- print TESTFILE "int main (void) { return $const != $value; }\n";
- close (TESTFILE);
-
- $res = runtest ($fnamebase, "Testing for value of constant $const",
- "Constant \"$const\" has not the right value.", $res);
- }
- } elsif (/^optional-type *({([^}]*)|([a-zA-Z0-9_]*))/) {
- my($type) = "$2$3";
- my($maybe_opaque) = 0;
-
- # Remember that this name is allowed.
- if ($type =~ /^struct *(.*)/) {
- push @allow, $1;
- } elsif ($type =~ /^union *(.*)/) {
- push @allow, $1;
- } else {
- push @allow, $type;
- $maybe_opaque = 1;
- }
-
- # Generate a program to test for the availability of this constant.
- open (TESTFILE, ">$fnamebase.c");
- print TESTFILE "$prepend";
- print TESTFILE "#include <$h>\n";
- if ($maybe_opaque == 1) {
- print TESTFILE "$type *a;\n";
- } else {
- print TESTFILE "$type a;\n";
- }
- close (TESTFILE);
-
- compiletest ($fnamebase, "Testing for type $type",
- "NOT AVAILABLE", $missing, 1);