aboutsummaryrefslogtreecommitdiff
path: root/conform
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-08-24 17:55:34 +0000
committerUlrich Drepper <drepper@redhat.com>1999-08-24 17:55:34 +0000
commitda1067a9154c3125a4274e1d039dd5b2d3aa953c (patch)
tree30f79028faf33d13954ad9726ca77720be218b63 /conform
parent1b13e783c5fb6da75e5254edcc4726b03a33c373 (diff)
downloadglibc-da1067a9154c3125a4274e1d039dd5b2d3aa953c.tar.xz
glibc-da1067a9154c3125a4274e1d039dd5b2d3aa953c.zip
Update.
1999-08-24 Ulrich Drepper <drepper@cygnus.com> * conform/Makefile: New file. * conform/conformtest.pl: New file. * conform/data/aio.h-data: New file. * conform/data/assert.h-data: New file. * conform/data/cpio.h-data: New file. * conform/data/ctype.h-data: New file. * conform/data/dirent.h-data: New file. * conform/data/dlfcn.h-data: New file. * conform/data/errno.h-data: New file. * conform/data/fcntl.h-data: New file. * conform/data/float.h-data: New file. * conform/data/fmtmsg.h-data: New file. * conform/data/fnmatch.h-data: New file. * conform/data/ftw.h-data: New file. * conform/data/glob.h-data: New file. * conform/data/grp.h-data: New file. * conform/data/iconv.h-data: New file. * conform/data/inttypes.h-data: New file. * conform/data/iso646.h-data: New file. * conform/data/langinfo.h-data: New file. * conform/data/libgen.h-data: New file. * conform/data/locale.h-data: New file. * conform/data/math.h-data: New file.
Diffstat (limited to 'conform')
-rw-r--r--conform/Makefile24
-rw-r--r--conform/conformtest.pl407
-rw-r--r--conform/data/aio.h-data43
-rw-r--r--conform/data/assert.h-data1
-rw-r--r--conform/data/cpio.h-data23
-rw-r--r--conform/data/ctype.h-data25
-rw-r--r--conform/data/dirent.h-data20
-rw-r--r--conform/data/dlfcn.h-data11
-rw-r--r--conform/data/errno.h-data87
-rw-r--r--conform/data/fcntl.h-data55
-rw-r--r--conform/data/float.h-data39
-rw-r--r--conform/data/fmtmsg.h-data60
-rw-r--r--conform/data/fnmatch.h-data9
-rw-r--r--conform/data/ftw.h-data21
-rw-r--r--conform/data/glob.h-data25
-rw-r--r--conform/data/grp.h-data22
-rw-r--r--conform/data/iconv.h-data7
-rw-r--r--conform/data/inttypes.h-data13
-rw-r--r--conform/data/iso646.h-data11
-rw-r--r--conform/data/langinfo.h-data61
-rw-r--r--conform/data/libgen.h-data4
-rw-r--r--conform/data/locale.h-data34
-rw-r--r--conform/data/math.h-data158
23 files changed, 1160 insertions, 0 deletions
diff --git a/conform/Makefile b/conform/Makefile
new file mode 100644
index 0000000000..bfa860b44f
--- /dev/null
+++ b/conform/Makefile
@@ -0,0 +1,24 @@
+# Copyright (C) 1999 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+#
+# Sub-makefile for conform portion of the library.
+#
+subdir := conform
+
+distribute = conformtest.pl $(wildcard data/*.h-data)
diff --git a/conform/conformtest.pl b/conform/conformtest.pl
new file mode 100644
index 0000000000..fc6eb761cf
--- /dev/null
+++ b/conform/conformtest.pl
@@ -0,0 +1,407 @@
+#! /usr/bin/perl
+
+$CC = "gcc";
+$CFLAGS = "-I. -D_XOPEN_SOURCE=500";
+
+# List of the headers we are testing.
+@headers = ("fmtmsg.h", "float.h", "fcntl.h", "errno.h", "dlfcn.h", "dirent.h",
+ "ctype.h", "cpio.h", "assert.h", "aio.h");
+
+# These are the ISO C9x keywords.
+@keywords = ('auto', 'break', 'case', 'char', 'const', 'continue', 'default',
+ 'do', 'double', 'else', 'enum', 'extern', 'float', 'for', 'goto',
+ 'if', 'inline', 'int', 'long', 'register', 'restrict', 'return',
+ 'short', 'signed', 'sizeof', 'static', 'struct', 'switch',
+ 'typedef', 'union', 'unsigned', 'void', 'volatile', 'while');
+
+# Make an hash table from this information.
+while ($#keywords) {
+ $iskeyword{pop (@keywords)} = 1;
+}
+
+$tmpdir = "/tmp";
+
+$verbose = 1;
+
+$total = 0;
+$skipped = 0;
+$errors = 0;
+
+#$dialect = "ISO";
+#$dialect = "POSIX";
+#$dialect = "XPG3";
+#$dialect = "XPG4";
+$dialect = "UNIX98";
+
+
+sub poorfnmatch {
+ my($pattern, $string) = @_;
+ my($strlen) = length ($string);
+ my($res);
+
+ if (substr ($pattern, 0, 1) eq '*') {
+ my($patlen) = length ($pattern) - 1;
+ $res = ($strlen >= $patlen
+ && substr ($pattern, -$patlen, $patlen) eq substr ($string, -$patlen, $patlen));
+ } elsif (substr ($pattern, -1, 1) eq '*') {
+ my($patlen) = length ($pattern) - 1;
+ $res = ($strlen >= $patlen
+ && substr ($pattern, 0, $patlen) eq substr ($string, 0, $patlen));
+ } else {
+ $res = $pattern eq $string;
+ }
+ return $res;
+}
+
+
+sub compiletest
+{
+ my($fnamebase, $msg, $errmsg, $skip) = @_;
+ my($result) = $skip;
+ my($printlog) = 0;
+
+ ++$total;
+ printf (" $msg...");
+
+ if ($skip != 0) {
+ ++$skipped;
+ printf (" SKIP\n");
+ } else {
+ $ret = system "$CC $CFLAGS -c $fnamebase.c -o $fnamebase.o > $fnamebase.out 2>&1";
+ if ($ret != 0) {
+ printf (" FAIL\n");
+ if ($verbose != 0) {
+ printf (" $errmsg Compiler message:\n");
+ $printlog = 1;
+ }
+ ++$errors;
+ $result = 1;
+ } else {
+ printf (" OK\n");
+ if ($verbose > 1 && -s "$fnamebase.out") {
+ # We print all warnings issued.
+ $printlog = 1;
+ }
+ }
+ if ($printlog != 0) {
+ printf (" " . "-" x 71 . "\n");
+ open (MESSAGE, "< $fnamebase.out");
+ while (<MESSAGE>) {
+ printf (" %s", $_);
+ }
+ close (MESSAGE);
+ printf (" " . "-" x 71 . "\n");
+ }
+ }
+ unlink "$fnamebase.c";
+ unlink "$fnamebase.o";
+ unlink "$fnamebase.out";
+
+ $result;
+}
+
+
+sub runtest
+{
+ my($fnamebase, $msg, $errmsg, $skip) = @_;
+ my($result) = $skip;
+ my($printlog) = 0;
+
+ ++$total;
+ printf (" $msg...");
+
+ if ($skip != 0) {
+ ++$skipped;
+ printf (" SKIP\n");
+ } else {
+ $ret = system "$CC $CFLAGS -o $fnamebase $fnamebase.c > $fnamebase.out 2>&1";
+ if ($ret != 0) {
+ printf (" FAIL\n");
+ if ($verbose != 0) {
+ printf (" $errmsg Compiler message:\n");
+ $printlog = 1;
+ }
+ ++$errors;
+ $result = 1;
+ } else {
+ # Now run the program. If the exit code is not zero something is wrong.
+ $result = system "$fnamebase > $fnamebase.out2 2>&1";
+ if ($result == 0) {
+ printf (" OK\n");
+ if ($verbose > 1 && -s "$fnamebase.out") {
+ # We print all warnings issued.
+ $printlog = 1;
+ system "cat $fnamebase.out2 >> $fnamebase.out";
+ }
+ } else {
+ printf (" FAIL\n");
+ $printlog = 1;
+ unlink "$fnamebase.out";
+ rename "$fnamebase.out2", "$fnamebase.out";
+ }
+ }
+ if ($printlog != 0) {
+ printf (" " . "-" x 71 . "\n");
+ open (MESSAGE, "< $fnamebase.out");
+ while (<MESSAGE>) {
+ printf (" %s", $_);
+ }
+ close (MESSAGE);
+ printf (" " . "-" x 71 . "\n");
+ }
+ }
+ unlink "$fnamebase";
+ unlink "$fnamebase.c";
+ unlink "$fnamebase.o";
+ unlink "$fnamebase.out";
+ unlink "$fnamebase.out2";
+
+ $result;
+}
+
+
+sub newtoken {
+ my($token, $nerrors, @allow) = @_;
+ my($idx);
+
+ for ($idx = 0; $idx <= $#allow; ++$idx) {
+ if ($token =~ /^[0-9_]/ || $iskeyword{$token} || poorfnmatch ($allow[$idx], $token)) {
+ return $nerrors;
+ }
+ }
+
+ ++$nerrors;
+ if ($nerrors == 1) {
+ printf ("FAIL\n " . "-" x 72 . "\n");
+ }
+ printf (" Namespace violation: \"%s\"\n", $token);
+ return $nerrors;
+}
+
+
+sub checknamespace {
+ my($h, $fnamebase, @allow) = @_;
+ my($nerrors) = 0;
+
+ ++$total;
+
+ # Generate a program to get the contents of this header.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "#include <$h>\n";
+ close (TESTFILE);
+
+ open (CONTENT, "$CC $CFLAGS -E $fnamebase.c -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |");
+ while (<CONTENT>) {
+ chop;
+ if (/^#define (.*)/) {
+ $nerrors = newtoken ($1, $nerrors, @allow);
+ } else {
+ # We have to tokenize the line.
+ my($str) = $_;
+ my($index) = 0;
+ my($len) = length ($str);
+
+ foreach $token (split(/[^a-zA-Z0-9_]/, $str)) {
+ if ($token ne "") {
+ $nerrors = newtoken ($token, $nerrors, @allow);
+ }
+ }
+ }
+ }
+ close (CONTENT);
+ unlink "$fnamebase.c";
+ if ($nerrors != 0) {
+ printf (" " . "-" x 72 . "\n");
+ ++$errors;
+ } else {
+ printf ("OK\n");
+ }
+}
+
+
+while ($#headers >= 0) {
+ my($h) = pop (@headers);
+ my($fnamebase) = "$tmpdir/$h-test";
+ my($missing);
+ my(@allow) = ();
+
+ printf ("Testing <$h>\n");
+ printf ("----------" . "-" x length ($h) . "\n");
+
+ # Generate a program to test for the availability of this header.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "#include <$h>\n";
+ close (TESTFILE);
+
+ $missing = compiletest ($fnamebase, "Checking whether <$h> is available",
+ "Header <$h> not available", 0);
+
+ printf ("\n");
+
+ open (CONTROL, "$CC -E -D$dialect - < data/$h-data |");
+ control: while (<CONTROL>) {
+ chop;
+ next control if (/^#/);
+ next control if (/^[ ]*$/);
+
+ if (/^element *({([^}]*)}|([^ ]*)) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
+ my($struct) = "$2$3";
+ my($type) = "$5$6";
+ my($member) = "$7";
+ my($rest) = "$8";
+ my($res) = $missing;
+
+ # Remember that this name is allowed.
+ push @allow, $member;
+
+ # Generate a program to test for the availability of this member.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "#include <$h>\n";
+ print TESTFILE "$struct a;\n";
+ print TESTFILE "$struct b;\n";
+ print TESTFILE "extern void xyzzy (__typeof__ (&b.$member), __typeof__ (&a.$member), unsigned);\n";
+ print TESTFILE "void foobarbaz (void) {\n";
+ print TESTFILE " xyzzy (&a.$member, &b.$member, sizeof (a.$member));\n";
+ print TESTFILE "}\n";
+ close (TESTFILE);
+
+ $res = compiletest ($fnamebase, "Testing for member $member",
+ "Member \"$member\" not available.", $res);
+
+
+ # Test the types of the members.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "#include <$h>\n";
+ print TESTFILE "$struct a;\n";
+ print TESTFILE "extern $type b$rest;\n";
+ print TESTFILE "extern __typeof__ (a.$member) b;\n";
+ close (TESTFILE);
+
+ compiletest ($fnamebase, "Testing for type of member $member",
+ "Member \"$member\" does not have the correct type.", $res);
+ } elsif (/^constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) {
+ my($const) = $1;
+ my($value) = $2;
+ 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 "#include <$h>\n";
+ print TESTFILE "__typeof__ ($const) a = $const;\n";
+ close (TESTFILE);
+
+ $res = compiletest ($fnamebase, "Testing for constant $const",
+ "Constant \"$const\" not available.", $res);
+
+ if ($value ne "") {
+ # Generate a program to test for the value of this constant.
+ open (TESTFILE, ">$fnamebase.c");
+ 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";
+
+ # Remember that this name is allowed.
+ if ($type =~ /^struct *(.*)/) {
+ push @allow, $1;
+ } elsif ($type =~ /^union *(.*)/) {
+ push @allow, $1;
+ } else {
+ push @allow, $type;
+ }
+
+ # Remember that this name is allowed.
+ push @allow, $type;
+
+ # Generate a program to test for the availability of this constant.
+ open (TESTFILE, ">$fnamebase.c");
+ print TESTFILE "#include <$h>\n";
+ print TESTFILE "$type *a;\n";
+ close (TESTFILE);
+
+ compiletest ($fnamebase, "Testing for type $type",
+ "Type \"$type\" not available.", $missing);
+ } 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 "#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 "#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 (/^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 "#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",
+ "Macro \"$macro\" is not available.", $missing);
+ } elsif (/^allow *(.*)/) {
+ my($pattern) = $1;
+ push @allow, $pattern;
+ next control;
+ } else {
+ # printf ("line is `%s'\n", $_);
+ next control;
+ }
+
+ printf ("\n");
+ }
+ close (CONTROL);
+
+ # Now check the namespace.
+ printf (" Checking the namespace of \"%s\"... ", $h);
+ if ($missing) {
+ ++$skipped;
+ printf ("SKIP\n");
+ } else {
+ checknamespace ($h, $fnamebase, @allow);
+ }
+
+ printf ("\n\n");
+}
+
+printf "-" x 76 . "\n";
+printf (" Total number of tests : %4d\n", $total);
+printf (" Number of failed tests : %4d (%3d%%)\n", $errors, ($errors * 100) / $total);
+printf (" Number of skipped tests: %4d (%3d%%)\n", $skipped, ($skipped * 100) / $total);
+
+exit $errors != 0;
diff --git a/conform/data/aio.h-data b/conform/data/aio.h-data
new file mode 100644
index 0000000000..75698cb39b
--- /dev/null
+++ b/conform/data/aio.h-data
@@ -0,0 +1,43 @@
+#ifndef ISO
+type {struct aiocb}
+
+// Test elements of the AIO control struct.
+element {struct aiocb} int aio_fildes
+element {struct aiocb} off_t aio_offset
+element {struct aiocb} {volatile void*} aio_buf
+element {struct aiocb} size_t aio_nbytes
+element {struct aiocb} int aio_reqprio
+element {struct aiocb} {struct sigevent} aio_sigevent
+element {struct aiocb} int aio_lio_opcode
+
+constant AIO_CANCELED
+constant AIO_NOTCANCELED
+constant AIO_ALLDONE
+constant LIO_WAIT
+constant LIO_NOWAIT
+constant LIO_READ
+constant LIO_WRITE
+constant LIO_NOP
+
+function int aio_cancel (int, struct aiocb*)
+function int aio_error (const struct aiocb*)
+function int aio_fsync (int, struct aiocb*)
+function int aio_read (struct aiocb*)
+function ssize_t aio_return (struct aiocb*)
+function int aio_suspend (const struct aiocb* const[], int, const struct timespec*)
+function int aio_write (struct aiocb*)
+function int lio_listio (int, struct aiocb *const[], int, struct sigevent*)
+
+# if !defined POSIX
+allow-header fcntl.h
+allow-header signal.h
+allow-header sys/types.h
+allow-header time.h
+# endif
+
+allow aio_*
+allow lio_*
+allow AIO_*
+allow LIO_*
+allow *_t
+#endif
diff --git a/conform/data/assert.h-data b/conform/data/assert.h-data
new file mode 100644
index 0000000000..60a559cb8b
--- /dev/null
+++ b/conform/data/assert.h-data
@@ -0,0 +1 @@
+macro assert
diff --git a/conform/data/cpio.h-data b/conform/data/cpio.h-data
new file mode 100644
index 0000000000..bccbc3057c
--- /dev/null
+++ b/conform/data/cpio.h-data
@@ -0,0 +1,23 @@
+#ifndef ISO
+constant C_IRUSR 0000400
+constant C_IWUSR 0000200
+constant C_IXUSR 0000100
+constant C_IRGRP 0000040
+constant C_IWGRP 0000020
+constant C_IXGRP 0000010
+constant C_IROTH 0000004
+constant C_IWOTH 0000002
+constant C_IXOTH 0000001
+constant C_ISUID 0004000
+constant C_ISGID 0002000
+constant C_ISVTX 0001000
+constant C_ISDIR 0040000
+constant C_ISFIFO 0010000
+constant C_ISREG 0100000
+constant C_ISBLK 0060000
+constant C_ISCHR 0020000
+constant C_ISCTG 0110000
+constant C_ISLNK 0120000
+constant C_ISSOCK 0140000
+constant MAGIC
+#endif
diff --git a/conform/data/ctype.h-data b/conform/data/ctype.h-data
new file mode 100644
index 0000000000..ac0dbb6367
--- /dev/null
+++ b/conform/data/ctype.h-data
@@ -0,0 +1,25 @@
+function int isalnum (int)
+function int isalpha (int)
+function int iscntrl (int)
+function int isdigit (int)
+function int isgraph (int)
+function int islower (int)
+function int isprint (int)
+function int ispunct (int)
+function int isspace (int)
+function int isupper (int)
+function int isxdigit (int)
+function int tolower (int)
+function int toupper (int)
+
+#ifndef ISO
+function int isascii (int)
+function int toascii (int)
+function int _toupper (int)
+function int _tolower (int)
+
+# The following is not entirely correct. It should be is[a-z]* but the
+# replacement fnmatch implementation doesn't grok it.
+allow is*
+allow to*
+#endif
diff --git a/conform/data/dirent.h-data b/conform/data/dirent.h-data
new file mode 100644
index 0000000000..4dbe552c11
--- /dev/null
+++ b/conform/data/dirent.h-data
@@ -0,0 +1,20 @@
+#ifndef ISO
+type DIR
+
+type {struct dirent}