diff options
Diffstat (limited to 'conform')
-rw-r--r-- | conform/conformtest.pl | 117 | ||||
-rw-r--r-- | conform/data/unistd.h-data | 150 |
2 files changed, 166 insertions, 101 deletions
diff --git a/conform/conformtest.pl b/conform/conformtest.pl index 4353ffc..8dde08c 100644 --- a/conform/conformtest.pl +++ b/conform/conformtest.pl @@ -83,7 +83,7 @@ sub poorfnmatch { sub compiletest { - my($fnamebase, $msg, $errmsg, $skip) = @_; + my($fnamebase, $msg, $errmsg, $skip, $optional) = @_; my($result) = $skip; my($printlog) = 0; @@ -96,13 +96,18 @@ sub compiletest } 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; + if ($optional != 0) { + printf (" $errmsg\n"); + $result = 1; + } else { + printf (" FAIL\n"); + if ($verbose != 0) { + printf (" $errmsg Compiler message:\n"); + $printlog = 1; + } + ++$errors; + $result = 1; } - ++$errors; - $result = 1; } else { printf (" OK\n"); if ($verbose > 1 && -s "$fnamebase.out") { @@ -274,7 +279,7 @@ while ($#headers >= 0) { close (TESTFILE); $missing = compiletest ($fnamebase, "Checking whether <$h> is available", - "Header <$h> not available", 0); + "Header <$h> not available", 0, 0); printf ("\n"); @@ -307,7 +312,7 @@ while ($#headers >= 0) { close (TESTFILE); $res = compiletest ($fnamebase, "Testing for member $member", - "Member \"$member\" not available.", $res); + "Member \"$member\" not available.", $res, 0); # Test the types of the members. @@ -321,6 +326,37 @@ while ($#headers >= 0) { compiletest ($fnamebase, "Testing for type of member $member", "Member \"$member\" does not have the correct type.", $res); + } elsif (/^optional-constant *([a-zA-Z0-9_]*) ([>=<]+) ([A-Za-z0-9_]*)/) { + my($const) = $1; + my($op) = $2; + my($value) = $3; + 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", + "NOT PRESENT", $res, 1); + + 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"; + # Negate the value since 0 means ok + print TESTFILE "int main (void) { return !($const $op $value); }\n"; + close (TESTFILE); + + $res = runtest ($fnamebase, "Testing for value of constant $const", + "Constant \"$const\" has not the right value.", $res); + } } elsif (/^constant *([a-zA-Z0-9_]*) ([>=<]+) ([A-Za-z0-9_]*)/) { my($const) = $1; my($op) = $2; @@ -338,7 +374,7 @@ while ($#headers >= 0) { close (TESTFILE); $res = compiletest ($fnamebase, "Testing for constant $const", - "Constant \"$const\" not available.", $res); + "Constant \"$const\" not available.", $res, 0); if ($value ne "") { # Generate a program to test for the value of this constant. @@ -369,7 +405,7 @@ while ($#headers >= 0) { close (TESTFILE); $res = compiletest ($fnamebase, "Testing for constant $const", - "Constant \"$const\" not available.", $res); + "Constant \"$const\" not available.", $res, 0); # Test the types of the members. open (TESTFILE, ">$fnamebase.c"); @@ -381,7 +417,36 @@ while ($#headers >= 0) { compiletest ($fnamebase, "Testing for type of constant $const", "Constant \"$const\" does not have the correct type.", - $res); + $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-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 "$prepend"; + print TESTFILE "#include <$h>\n"; + print TESTFILE "__typeof__ ($const) a = $const;\n"; + close (TESTFILE); + + $res = compiletest ($fnamebase, "Testing for constant $const", + "NOT PRESENT", $res, 1); if ($value ne "") { # Generate a program to test for the value of this constant. @@ -410,7 +475,7 @@ while ($#headers >= 0) { close (TESTFILE); $res = compiletest ($fnamebase, "Testing for constant $const", - "Constant \"$const\" not available.", $res); + "Constant \"$const\" not available.", $res, 0); if ($value ne "") { # Generate a program to test for the value of this constant. @@ -440,7 +505,7 @@ while ($#headers >= 0) { close (TESTFILE); $res = compiletest ($fnamebase, "Testing for constant $const", - "Constant \"$const\" not available.", $res); + "Constant \"$const\" not available.", $res, 0); # Test the types of the members. open (TESTFILE, ">$fnamebase.c"); @@ -452,7 +517,7 @@ while ($#headers >= 0) { compiletest ($fnamebase, "Testing for type of constant $const", "Constant \"$const\" does not have the correct type.", - $res); + $res, 0); if ($value ne "") { # Generate a program to test for the value of this constant. @@ -488,7 +553,7 @@ while ($#headers >= 0) { close (TESTFILE); compiletest ($fnamebase, "Testing for type $type", - "Type \"$type\" not available.", $missing); + "Type \"$type\" not available.", $missing, 0); } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) [(][*]([a-zA-Z0-9_]*) ([(].*[)])/) { my($rettype) = "$2$3"; my($fname) = "$4"; @@ -507,7 +572,7 @@ while ($#headers >= 0) { close (TESTFILE); $res = compiletest ($fnamebase, "Test availability of function $fname", - "Function \"$fname\" is not available.", $res); + "Function \"$fname\" is not available.", $res, 0); # Generate a program to test for the type of this function. open (TESTFILE, ">$fnamebase.c"); @@ -519,7 +584,7 @@ while ($#headers >= 0) { close (TESTFILE); compiletest ($fnamebase, "Test for type of function $fname", - "Function \"$fname\" has incorrect type.", $res); + "Function \"$fname\" has incorrect type.", $res, 0); } elsif (/^function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) { my($rettype) = "$2$3"; my($fname) = "$4"; @@ -538,7 +603,7 @@ while ($#headers >= 0) { close (TESTFILE); $res = compiletest ($fnamebase, "Test availability of function $fname", - "Function \"$fname\" is not available.", $res); + "Function \"$fname\" is not available.", $res, 0); # Generate a program to test for the type of this function. open (TESTFILE, ">$fnamebase.c"); @@ -550,7 +615,7 @@ while ($#headers >= 0) { close (TESTFILE); compiletest ($fnamebase, "Test for type of function $fname", - "Function \"$fname\" has incorrect type.", $res); + "Function \"$fname\" has incorrect type.", $res, 0); } elsif (/^variable *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*)/) { my($type) = "$2$3"; my($vname) = "$4"; @@ -568,7 +633,7 @@ while ($#headers >= 0) { close (TESTFILE); $res = compiletest ($fnamebase, "Test availability of variable $vname", - "Variable \"$vname\" is not available.", $res); + "Variable \"$vname\" is not available.", $res, 0); # Generate a program to test for the type of this function. open (TESTFILE, ">$fnamebase.c"); @@ -579,7 +644,7 @@ while ($#headers >= 0) { close (TESTFILE); compiletest ($fnamebase, "Test for type of variable $fname", - "Variable \"$vname\" has incorrect type.", $res); + "Variable \"$vname\" has incorrect type.", $res, 0); } elsif (/^macro-function *({([^}]*)}|([a-zA-Z0-9_]*)) ([a-zA-Z0-9_]*) ([(].*[)])/) { my($rettype) = "$2$3"; my($fname) = "$4"; @@ -599,7 +664,7 @@ while ($#headers >= 0) { close (TESTFILE); $res = compiletest ($fnamebase, "Test availability of function $fname", - "Function \"$fname\" is not available.", $res); + "Function \"$fname\" is not available.", $res, 0); # Generate a program to test for the type of this function. open (TESTFILE, ">$fnamebase.c"); @@ -612,7 +677,7 @@ while ($#headers >= 0) { close (TESTFILE); compiletest ($fnamebase, "Test for type of function $fname", - "Function \"$fname\" has incorrect type.", $res); + "Function \"$fname\" has incorrect type.", $res, 0); } elsif (/^macro-str *([^ ]*)\s*(\".*\")/) { # The above regex doesn't handle a \" in a string. my($macro) = "$1"; @@ -632,7 +697,7 @@ while ($#headers >= 0) { close (TESTFILE); compiletest ($fnamebase, "Test availability of macro $macro", - "Macro \"$macro\" is not available.", $missing); + "Macro \"$macro\" is not available.", $missing, 0); # Generate a program to test for the value of this macro. open (TESTFILE, ">$fnamebase.c"); @@ -661,7 +726,7 @@ while ($#headers >= 0) { close (TESTFILE); compiletest ($fnamebase, "Test availability of macro $macro", - "Macro \"$macro\" is not available.", $missing); + "Macro \"$macro\" is not available.", $missing, 0); } elsif (/^allow-header *(.*)/) { my($pattern) = $1; push @allowheader, $pattern; diff --git a/conform/data/unistd.h-data b/conform/data/unistd.h-data index 70f598b..de880d3 100644 --- a/conform/data/unistd.h-data +++ b/conform/data/unistd.h-data @@ -1,92 +1,92 @@ -constant _POSIX_VERSION -constant _POSIX2_C_VERSION -constant _XOPEN_VERSION -constant _XOPEN_XCU_VERSION +optional-constant _POSIX_VERSION +optional-constant _POSIX2_C_VERSION +optional-constant _XOPEN_VERSION +optional-constant _XOPEN_XCU_VERSION -constant _POSIX2_C_BIND -constant _POSIX2_CHAR_TERM -constant _POSIX2_LOCALEDEF -constant _POSIX2_UPE -constant _POSIX2_VERSION +optional-constant _POSIX2_C_BIND +optional-constant _POSIX2_CHAR_TERM +optional-constant _POSIX2_LOCALEDEF +optional-constant _POSIX2_UPE +optional-constant _POSIX2_VERSION -constant _XOPEN_XPG2 -constant _XOPEN_XPG3 -constant _XOPEN_XPG4 -constant _XOPEN_UNIX +optional-constant _XOPEN_XPG2 +optional-constant _XOPEN_XPG3 +optional-constant _XOPEN_XPG4 +optional-constant _XOPEN_UNIX -constant _POSIX_ADVISORY_INFO -constant _POSIX_ASYNCHRONOUS_IO -constant _POSIX_BARRIERS -constant _POSIX_CHOWN_RESTRICTED -constant _POSIX_CLOCK_SELECTION -constant _POSIX_CPUTIME -constant _POSIX_NO_TRUNC -constant _POSIX_VDISABLE -constant _POSIX_SAVED_IDS -constant _POSIX_JOB_CONTROL -constant _POSIX_MONOTONIC_CLOCK -constant _POSIX_READER_WRITER_LOCKS -constant _POSIX_SHELL -constant _POSIX_SPAWN -constant _POSIX_SPIN_LOCKS -constant _POSIX_SPORADIC_SERVER -constant _POSIX_THREAD_CPUTIME -constant _POSIX_TYPED_MEMORY_OBJECTS +optional-constant _POSIX_ADVISORY_INFO +optional-constant _POSIX_ASYNCHRONOUS_IO +optional-constant _POSIX_BARRIERS +optional-constant _POSIX_CHOWN_RESTRICTED +optional-constant _POSIX_CLOCK_SELECTION +optional-constant _POSIX_CPUTIME +optional-constant _POSIX_NO_TRUNC +optional-constant _POSIX_VDISABLE +optional-constant _POSIX_SAVED_IDS +optional-constant _POSIX_JOB_CONTROL +optional-constant _POSIX_MONOTONIC_CLOCK +optional-constant _POSIX_READER_WRITER_LOCKS +optional-constant _POSIX_SHELL +optional-constant _POSIX_SPAWN +optional-constant _POSIX_SPIN_LOCKS +optional-constant _POSIX_SPORADIC_SERVER +optional-constant _POSIX_THREAD_CPUTIME +optional-constant _POSIX_TYPED_MEMORY_OBJECTS -constant _POSIX_THREADS -constant _POSIX_THREAD_ATTR_STACKADDR -constant _POSIX_THREAD_ATTR_STACKSIZE -constant _POSIX_THREAD_PROCESS_SHARED -constant _POSIX_THREAD_SAFE_FUNCTIONS -constant _POSIX_THREAD_SPORADIC_SERVER +optional-constant _POSIX_THREADS +optional-constant _POSIX_THREAD_ATTR_STACKADDR +optional-constant _POSIX_THREAD_ATTR_STACKSIZE +optional-constant _POSIX_THREAD_PROCESS_SHARED +optional-constant _POSIX_THREAD_SAFE_FUNCTIONS +optional-constant _POSIX_THREAD_SPORADIC_SERVER -constant _POSIX2_C_DEV -constant _POSIX2_FORT_DEV -constant _POSIX2_FORT_RUN -constant _POSIX2_SW_DEV -constant _XOPEN_CRYPT -constant _XOPEN_ENH_I18N -constant _XOPEN_LEGACY -constant _XOPEN_REALTIME -constant _XOPEN_REALTIME_THREADS -constant _XOPEN_SHM -constant _XOPEN_STREAMS +optional-constant _POSIX2_C_DEV +optional-constant _POSIX2_FORT_DEV +optional-constant _POSIX2_FORT_RUN +optional-constant _POSIX2_SW_DEV +optional-constant _XOPEN_CRYPT +optional-constant _XOPEN_ENH_I18N +optional-constant _XOPEN_LEGACY +optional-constant _XOPEN_REALTIME +optional-constant _XOPEN_REALTIME_THREADS +optional-constant _XOPEN_SHM +optional-constant _XOPEN_STREAMS allow _XBS5_ILP32_OFF32 allow _XBS5_ILP32_OFBIG allow _XBS5_LP64_OFF64 allow _XBS5_LPBIG_OFFBIG -constant _POSIX_ASYNCHRONOUS_IO -constant _POSIX_MEMLOCK -constant _POSIX_MEMLOCK_RANGE -constant _POSIX_MESSAGE_PASSING -constant _POSIX_PRIORITY_SCHEDULING -constant _POSIX_REALTIME_SIGNALS -constant _POSIX_SEMAPHORES -constant _POSIX_SHARED_MEMORY_OBJECTS -constant _POSIX_SYNCHRONIZED_IO -constant _POSIX_TIMERS -constant _POSIX_TIMEOUTS +optional-constant _POSIX_ASYNCHRONOUS_IO +optional-constant _POSIX_MEMLOCK +optional-constant _POSIX_MEMLOCK_RANGE +optional-constant _POSIX_MESSAGE_PASSING +optional-constant _POSIX_PRIORITY_SCHEDULING +optional-constant _POSIX_REALTIME_SIGNALS +optional-constant _POSIX_SEMAPHORES +optional-constant _POSIX_SHARED_MEMORY_OBJECTS +optional-constant _POSIX_SYNCHRONIZED_IO +optional-constant _POSIX_TIMERS +optional-constant _POSIX_TIMEOUTS -constant _POSIX_FSYNC -constant _POSIX_MAPPED_FILES -constant _POSIX_MEMORY_PROTECTION +optional-constant _POSIX_FSYNC +optional-constant _POSIX_MAPPED_FILES +optional-constant _POSIX_MEMORY_PROTECTION -constant _POSIX_PRIORITIZED_IO +optional-constant _POSIX_PRIORITIZED_IO -constant _POSIX_THREAD_PRIORITY_SCHEDULING -constant _POSIX_THREAD_PRIO_INHERIT -constant _POSIX_THREAD_PRIO_PROTECT +optional-constant _POSIX_THREAD_PRIORITY_SCHEDULING +optional-constant _POSIX_THREAD_PRIO_INHERIT +optional-constant _POSIX_THREAD_PRIO_PROTECT -constant _POSIX_ASYNC_IO -constant _POSIX_PRIO_IO -constant _POSIX_SYNC_IO +optional-constant _POSIX_ASYNC_IO +optional-constant _POSIX_PRIO_IO +optional-constant _POSIX_SYNC_IO -constant _POSIX2_PBS -constant _POSIX2_PBS_ACCOUNTING -constant _POSIX2_PBS_CHECKPOINT -constant _POSIX2_PBS_LOCATE -constant _POSIX2_PBS_MESSAGE -constant _POSIX2_PBS_TRACK +optional-constant _POSIX2_PBS +optional-constant _POSIX2_PBS_ACCOUNTING +optional-constant _POSIX2_PBS_CHECKPOINT +optional-constant _POSIX2_PBS_LOCATE +optional-constant _POSIX2_PBS_MESSAGE +optional-constant _POSIX2_PBS_TRACK constant NULL |