<signal.h> broken with _POSIX_SOURCE=1 defined
Andreas Jaeger
aj@arthur.rhein-neckar.de
Tue Nov 3 07:28:00 GMT 1998
Upps. My attempt for a fast cleanup of the script broke it. Here's
another try. There're some errors/warning you need to ignore - but
others are worth looking into it. Just give it a try and send me
comments on the script - and Ulrich patches if needed.
Andreas
#!/usr/bin/perl -w
# Written by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
# This script tests most glibc headers in an include tree.
# It tests that the files are self contained and are parseable
# by processing them by the C compiler.
# The following two paramters need to be adjusted:
# Directory where gcc and g++ live:
$PATH_FOR_CC="/opt/egcs/bin/";
# My test installation directory, include is a subdir of it:
$install_dir = "/usr/glibc/glibc-2.1";
# You shouldn't need to change anything below - otherwise send a patch;-)
$includes = "-I${install_dir}/include";
$|=1;
# compile in /tmp
chdir ("/tmp/");
sub test_header {
my ($compiler, $file, $prefix) = @_;
print "Testing: $prefix$file with $compiler\n";
open DATEI, ">/tmp/test.c";
# Some include files need special treatment, e.g. inclusion of other
# headers.
SPECIAL:
{
if ($prefix eq "" && ($file eq "regex.h" || $file eq "re_comp.h" || $file eq "glob.h")) {
print DATEI "#include <sys/types.h>\n";
last SPECIAL;
}
if ($prefix eq "" && $file eq "regexp.h" ) {
print DATEI "#define INIT\n";
print DATEI "#define GETC() 0\n";
print DATEI "#define PEEKC() 0\n";
print DATEI "#define UNGETC(c)\n";
print DATEI "#define ERROR(val)\n";
print DATEI "#define RETURN(val) 0\n";
last SPECIAL;
}
if ($prefix eq "netrose/" && $file eq "rose.h" ) {
print DATEI "#include <netax25/ax25.h>\n";
last SPECIAL;
}
}
print DATEI "#include<$prefix$file>\n";
print DATEI "int main (void) {return 0;}\n";
close DATEI;
open GCC, "$compiler $includes -c test.c 2>&1 |";
while (<GCC>) {
print;
}
close GCC;
}
sub test_isoc {
# iso headers:
# assert, ctype, errno, float, iso646, limits, locale, math, setjmp, signal, stdarg,
# stddef, stdio, stdlib, string, time, wchar, wctype
# ico C9X additionally: complex, fenv, inttypes, stdbool, tgmath
my ($header, @headers);
my ($compiler) = $_[0];
@headers = ("assert", "ctype", "errno", "float", "iso646", "limits",
"locale", "math", "setjmp", "signal", "stdarg", "stddef",
"stdio", "stdlib", "string", "time", "wchar", "wctype",
# ico C9X additionally:
"complex", "fenv", "inttypes", "tgmath" # , "stdbool"
);
foreach $header (@headers) {
test_header ($compiler, "$header.h", "");
}
}
sub test_dir {
my ($compiler, $dir,$prefix) = @_;
my (@allfiles, $datei);
opendir DIRS, $dir;
@allfiles = sort grep /\.h$/, readdir DIRS;
closedir DIRS;
DATEI:
foreach $datei (@allfiles) {
DONT_TEST:
{
if (($prefix eq "rpcsvc/" && $datei eq "nislib.h")) {
print "Skipping: $prefix$datei with $compiler\n";
next DATEI;
}
if (($prefix eq "" && $datei eq "Dpg.h")) {
print "Skipping: $prefix$datei with $compiler\n";
next DATEI;
}
if (($prefix eq "" && $datei eq "liba2ps.h")) {
print "Skipping: $prefix$datei with $compiler\n";
next DATEI;
}
if (($prefix eq "" && $datei eq "gif_lib.h")) {
print "Skipping: $prefix$datei with $compiler\n";
next DATEI;
}
if (($prefix eq "" && $datei eq "FlexLexer.h")) {
print "Skipping: $prefix$datei with $compiler\n";
next DATEI;
}
if (($prefix eq "" && $datei eq "bfdlink.h")) {
print "Skipping: $prefix$datei with $compiler\n";
next DATEI;
}
if (($prefix eq "" && $datei eq "compface.h")) {
print "Skipping: $prefix$datei with $compiler\n";
next DATEI;
}
if (($prefix eq "" && $datei eq "cursesapp.h")) {
print "Skipping: $prefix$datei with $compiler\n";
next DATEI;
}
if ($prefix eq "" &&
($datei eq "cursesapp.h" || $datei eq "cursesw.h" || $datei eq "etip.h" ||
$datei eq "expect_comm.h" || $datei eq "expect_tcl.h" || $datei eq "jpeglib.h" ||
$datei eq "pngconf.h" || $datei eq "png.h" || $datei eq "bfd.h" ||
$datei eq "cursesf.h" || $datei eq "cursesp.h" || $datei eq "cursslk.h" ||
$datei eq "expect.h" || $datei eq "cursesm.h" || $datei eq "gpm.h" ||
$datei eq "tk.h" || $datei eq "Dbg.h"
)) {
print "Skipping: $prefix$datei with $compiler\n";
next DATEI;
}
}
&test_header ($compiler, $datei, $prefix);
}
}
sub test_all_dirs {
my ($compiler) = $_[0];
$add_dir = $install_dir;
&test_dir ($compiler, "$add_dir/include/", "");
&test_dir ($compiler, "$add_dir/include/db1/", "db1/");
&test_dir ($compiler, "$add_dir/include/gnu/", "gnu/");
&test_dir ($compiler, "$add_dir/include/net/", "net/");
&test_dir ($compiler, "$add_dir/include/netash/", "netash/");
&test_dir ($compiler, "$add_dir/include/netatalk/", "netatalk/");
&test_dir ($compiler, "$add_dir/include/netax25/", "netax25/");
&test_dir ($compiler, "$add_dir/include/neteconet/", "neteconet/");
&test_dir ($compiler, "$add_dir/include/netinet/", "netinet/");
&test_dir ($compiler, "$add_dir/include/netipx/", "netipx/");
&test_dir ($compiler, "$add_dir/include/netpacket/", "netpacket/");
&test_dir ($compiler, "$add_dir/include/netrom/", "netrom/");
&test_dir ($compiler, "$add_dir/include/netrose/", "netrose/");
&test_dir ($compiler, "$add_dir/include/nfs/", "nfs/");
&test_dir ($compiler, "$add_dir/include/protocols/", "protocols/");
&test_dir ($compiler, "$add_dir/include/rpc/", "rpc/");
&test_dir ($compiler, "$add_dir/include/rpcsvc/", "rpcsvc/");
&test_dir ($compiler, "$add_dir/include/scsi/", "scsi/");
&test_dir ($compiler, "$add_dir/include/sys/", "sys/");
}
&test_isoc ("${PATH_FOR_CC}gcc -ansi -pedantic -W");
&test_isoc ("${PATH_FOR_CC}g++ -ansi -pedantic -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_POSIX_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_POSIX_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_POSIX_C_SOURCE=1 -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_POSIX_C_SOURCE=1 -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_POSIX_C_SOURCE=2 -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_POSIX_C_SOURCE=2 -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_POSIX_C_SOURCE=199309 -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_POSIX_C_SOURCE=199309 -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_POSIX_C_SOURCE=199506 -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_POSIX_C_SOURCE=199506 -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_XOPEN_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_XOPEN_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_XOPEN_SOURCE=500 -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_XOPEN_SOURCE=500 -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_SVID_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_SVID_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_GNU_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_GNU_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_BSD_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_BSD_SOURCE -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_REENTRANT -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_REENTRANT -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_GNU_SOURCE -D_REENTRANT -W");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_GNU_SOURCE -D_REENTRANT -W");
&test_all_dirs ("${PATH_FOR_CC}gcc -D_GNU_SOURCE -D_REENTRANT -W -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE");
&test_all_dirs ("${PATH_FOR_CC}g++ -D_GNU_SOURCE -D_REENTRANT -W -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE");
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de
More information about the Libc-hacker
mailing list