From fefdf574126726c0a9ed0badd73e187e97dd422a Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 1 May 2012 20:02:19 +0000 Subject: conformtest: Unify "macro" cases. --- ChangeLog | 4 +++ conform/conformtest.pl | 61 +++------------------------------------------- conform/data/stdlib.h-data | 2 +- 3 files changed, 8 insertions(+), 59 deletions(-) diff --git a/ChangeLog b/ChangeLog index 323b45be3e..bb313e1c1e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-05-01 Joseph Myers + * conform/conformtest.pl: Only accept expected macro values with + "==". Parse all "macro" lines in one place. + * conform/data/stdlib.h-data: Use "==" form on "macro" lines. + * conform/conformtest.pl: Handle braced types on "constant" lines instead of handling "typed-constant". * conform/data/signal.h-data: Use "constant" instead of diff --git a/conform/conformtest.pl b/conform/conformtest.pl index 0a1a093990..c38be1dc5b 100644 --- a/conform/conformtest.pl +++ b/conform/conformtest.pl @@ -683,7 +683,7 @@ while ($#headers >= 0) { $res = runtest ($fnamebase, "Testing for value of macro $macro", "Macro \"$macro\" has not the right value.", $res); - } elsif (/^macro *([a-zA-Z0-9_]*) *([>=== 0) { : "Macro \"$macro\" is not available."), $res, $optional); - if ($value ne "" && ($res == 0 || !$optional)) { + if (defined ($op) && ($res == 0 || !$optional)) { # Generate a program to test for the value of this constant. open (TESTFILE, ">$fnamebase.c"); print TESTFILE "$prepend"; @@ -719,61 +719,6 @@ while ($#headers >= 0) { $res = runtest ($fnamebase, "Testing for value of macro $macro", "Macro \"$macro\" has not the right value.", $res); } - } elsif (/^macro *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)/) { - my($macro) = "$1"; - my($value) = $2; - my($res) = $missing; - - # Remember that this name is allowed. - push @allow, $macro; - - # Generate a program to test for availability of this macro. - open (TESTFILE, ">$fnamebase.c"); - print TESTFILE "$prepend"; - print TESTFILE "#include <$h>\n"; - print TESTFILE "#ifndef $macro\n"; - print TESTFILE "# error \"Macro $macro not defined\"\n"; - print TESTFILE "#endif\n"; - close (TESTFILE); - - $res = compiletest ($fnamebase, "Test availability of macro $macro", - ($optional - ? "NOT PRESENT" - : "Macro \"$macro\" is not available."), $res, - $optional); - - if ($value ne "" && ($res == 0 || !$optional)) { - # Generate a program to test for the value of this constant. - open (TESTFILE, ">$fnamebase.c"); - print TESTFILE "$prepend"; - print TESTFILE "#include <$h>\n"; - # Negate the value since 0 means ok - print TESTFILE "int main (void) { return !($macro == $value); }\n"; - close (TESTFILE); - - $res = runtest ($fnamebase, "Testing for value of macro $macro", - "Macro \"$macro\" has not the right value.", $res); - } - } elsif (/^macro *([^ ]*)/) { - my($macro) = "$1"; - - # Remember that this name is allowed. - push @allow, $macro; - - # Generate a program to test for availability of this macro. - open (TESTFILE, ">$fnamebase.c"); - print TESTFILE "$prepend"; - print TESTFILE "#include <$h>\n"; - print TESTFILE "#ifndef $macro\n"; - print TESTFILE "# error \"Macro $macro not defined\"\n"; - print TESTFILE "#endif\n"; - close (TESTFILE); - - compiletest ($fnamebase, "Test availability of macro $macro", - ($optional - ? "NOT PRESENT" - : "Macro \"$macro\" is not available."), $missing, - $optional); } elsif (/^allow-header *(.*)/) { my($pattern) = $1; if ($seenheader{$pattern} != 1) { @@ -827,7 +772,7 @@ while ($#headers >= 0) { push @allow, $4; } elsif (/^macro-function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) { push @allow, $4; - } elsif (/^macro *([^ ]*)/) { + } elsif (/^macro *([a-zA-Z0-9_]*) *(?:([>== 32767 -- cgit v1.2.3