summaryrefslogtreecommitdiff
path: root/conform/conformtest.pl
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-02-23 06:02:09 +0000
committerUlrich Drepper <drepper@redhat.com>2000-02-23 06:02:09 +0000
commit8ce9ea0ca67b8eff5f1a708d951d969ac9c0ab2a (patch)
tree4a04cd7c0e3a05987fcf74caa28a0f5d93020b5b /conform/conformtest.pl
parent93a19c64c994e85e1c3e87cefa1d68c15e7acb0d (diff)
Update.
* dlfcn/dlfcn.h (RTLD_DEFAULT): Don't use NULL. * iconv/iconv.h (iconv): Fix prototype. * misc/libgen.h: When using gcc using renaming feature to get XPG definition of basename. * misc/search.h (struct entry): Fix type of element data. * posix/unistd.h (getpagesize): Declare as const function. * sysdeps/unix/sysv/linux/alpha/bits/sigaction.h: Define SA_NOCLDWAIT. * sysdeps/unix/sysv/linux/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/sigaction.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/sigaction.h: Likewise. * signal/signal.h [__USE_XOPEN]: Define uid_t. (sigstack): Correct type of first parameter. * sysdeps/generic/sigstack.c (sigstack): Likewise. * sysdeps/unix/sysv/linux/sigstack.c (sigstack): Likewise. * sysdeps/unix/sysv/linux/alpha/bits/siginfo.h: New file. Copy of old sysdeps/unix/sysv/linux/bits/siginfo.h. * sysdeps/unix/sysv/linux/sparc/sparc64/bits/siginfo.h: Likewise. * sysdeps/unix/sysv/linux/bits/siginfo.h [struct siginfo] (si_band): Change type to `long int'. * signal/signal.h [__USE_XOPEN]: Declare sigpause to redirect to __xpg_sigpause. * sysdeps/generic/sigpause.c: Define __xpg_sigpause. * sysdeps/posix/sigpause.c: Likewise. * conform/conformtest.pl: Correct bugs. Add more functionality. * conform/data/dlfcn.h-data: Correct typos. * conform/data/ftw.h-data: Likewise. * conform/data/iconv.h-data: Likewise. * conform/data/nl_types.h-data: Likewise. * conform/data/search.h-data: Likewise. * conform/data/semaphore.h-data: New file. * conform/data/setjmp.h-data: New file. * conform/data/signal.h-data: New file. * conform/data/stdarg.h-data: New file. * conform/data/stddef.h-data: New file. * conform/data/stdio.h-data: New file.
Diffstat (limited to 'conform/conformtest.pl')
-rw-r--r--conform/conformtest.pl147
1 files changed, 144 insertions, 3 deletions
diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index 41613c67e5..30577c07d6 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -4,7 +4,9 @@ $CC = "gcc";
$CFLAGS = "-I. '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
# List of the headers we are testing.
-@headers = ("search.h", "sched.h", "regex.h", "pwd.h", "pthread.h",
+@headers = ("stdio.h",
+ "stddef.h", "stdarg.h", "signal.h", "setjmp.h", "semaphore.h",
+ "search.h", "sched.h", "regex.h", "pwd.h", "pthread.h",
"poll.h", "nl_types.h", "ndbm.h", "mqueue.h", "monetary.h",
"math.h", "locale.h", "libgen.h", "langinfo.h", "iso646.h",
"inttypes.h", "iconv.h", "grp.h", "glob.h", "ftw.h", "fnmatch.h",
@@ -171,8 +173,12 @@ sub newtoken {
my($token, $nerrors, @allow) = @_;
my($idx);
+ if ($token =~ /^[0-9_]/ || $iskeyword{$token}) {
+ return $nerrors;
+ }
+
for ($idx = 0; $idx <= $#allow; ++$idx) {
- if ($token =~ /^[0-9_]/ || $iskeyword{$token} || poorfnmatch ($allow[$idx], $token)) {
+ if (poorfnmatch ($allow[$idx], $token)) {
return $nerrors;
}
}
@@ -319,6 +325,48 @@ while ($#headers >= 0) {
$res = runtest ($fnamebase, "Testing for value of constant $const",
"Constant \"$const\" has not the right value.", $res);
}
+ } 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);
+
+ # 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);
+
+ 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 (/^type *({([^}]*)|([a-zA-Z0-9_]*))/) {
my($type) = "$2$3";
@@ -343,7 +391,38 @@ while ($#headers >= 0) {
compiletest ($fnamebase, "Testing for type $type",
"Type \"$type\" not available.", $missing);
- } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(][^)]*[)])/) {
+ } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) [(][*]([a-zA-Z0-9_]*) ([(].*[)])/) {
+ my($rettype) = "$2$3";
+ my($fname) = "$4";
+ my($args) = "$5";
+ my($res) = $missing;
+
+ # Remember that this name is allowed.
+ push @allow, $fname;
+
+ # Generate a program to test for availability of this function.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "$prepend";
+ print TESTFILE "#include <$h>\n";
+ # print TESTFILE "#undef $fname\n";
+ print TESTFILE "$rettype (*(*foobarbaz) $args = $fname;\n";
+ close (TESTFILE);
+
+ $res = compiletest ($fnamebase, "Test availability of function $fname",
+ "Function \"$fname\" is not available.", $res);
+
+ # Generate a program to test for the type of this function.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "$prepend";
+ print TESTFILE "#include <$h>\n";
+ # print TESTFILE "#undef $fname\n";
+ print TESTFILE "extern $rettype (*(*foobarbaz) $args;\n";
+ print TESTFILE "extern __typeof__ (&$fname) foobarbaz;\n";
+ close (TESTFILE);
+
+ compiletest ($fnamebase, "Test for type of function $fname",
+ "Function \"$fname\" has incorrect type.", $res);
+ } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
my($rettype) = "$2$3";
my($fname) = "$4";
my($args) = "$5";
@@ -374,6 +453,68 @@ while ($#headers >= 0) {
compiletest ($fnamebase, "Test for type of function $fname",
"Function \"$fname\" has incorrect type.", $res);
+ } elsif (/^variable *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*)/) {
+ my($type) = "$2$3";
+ my($vname) = "$4";
+ my($res) = $missing;
+
+ # Remember that this name is allowed.
+ push @allow, $vname;
+
+ # Generate a program to test for availability of this function.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "$prepend";
+ print TESTFILE "#include <$h>\n";
+ # print TESTFILE "#undef $fname\n";
+ print TESTFILE "$type *foobarbaz = &$vname;\n";
+ close (TESTFILE);
+
+ $res = compiletest ($fnamebase, "Test availability of variable $vname",
+ "Variable \"$vname\" is not available.", $res);
+
+ # Generate a program to test for the type of this function.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "$prepend";
+ print TESTFILE "#include <$h>\n";
+ # print TESTFILE "#undef $fname\n";
+ print TESTFILE "extern $type $vname;\n";
+ close (TESTFILE);
+
+ compiletest ($fnamebase, "Test for type of variable $fname",
+ "Variable \"$vname\" has incorrect type.", $res);
+ } elsif (/^macro-function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) {
+ my($rettype) = "$2$3";
+ my($fname) = "$4";
+ my($args) = "$5";
+ my($res) = $missing;
+
+ # Remember that this name is allowed.
+ push @allow, $fname;
+
+ # Generate a program to test for availability of this function.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "$prepend";
+ print TESTFILE "#include <$h>\n";
+ print TESTFILE "#ifndef $fname\n";
+ print TESTFILE "$rettype (*foobarbaz) $args = $fname;\n";
+ print TESTFILE "#endif\n";
+ close (TESTFILE);
+
+ $res = compiletest ($fnamebase, "Test availability of function $fname",
+ "Function \"$fname\" is not available.", $res);
+
+ # Generate a program to test for the type of this function.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "$prepend";
+ print TESTFILE "#include <$h>\n";
+ print TESTFILE "#ifndef $fname\n";
+ print TESTFILE "extern $rettype (*foobarbaz) $args;\n";
+ print TESTFILE "extern __typeof__ (&$fname) foobarbaz;\n";
+ print TESTFILE "#endif\n";
+ close (TESTFILE);
+
+ compiletest ($fnamebase, "Test for type of function $fname",
+ "Function \"$fname\" has incorrect type.", $res);
} elsif (/^macro *([^ ]*)/) {
my($macro) = "$1";