about summary refs log tree commit diff
path: root/conform
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2012-02-25 23:18:39 -0500
committerUlrich Drepper <drepper@gmail.com>2012-02-25 23:18:39 -0500
commit3134156779108fe8b46e0f4cd60d837572faaa93 (patch)
treedb3da5a5e28ad6c417c3d942b7ea62013c7b8646 /conform
parent7a270350a9bc3110cd5ba12bbd8c5c8c365e0032 (diff)
downloadglibc-3134156779108fe8b46e0f4cd60d837572faaa93.tar.gz
glibc-3134156779108fe8b46e0f4cd60d837572faaa93.tar.xz
glibc-3134156779108fe8b46e0f4cd60d837572faaa93.zip
First steps to get conformtest fully working
Diffstat (limited to 'conform')
-rw-r--r--conform/Makefile12
-rw-r--r--conform/conformtest.pl220
-rw-r--r--conform/data/aio.h-data2
-rw-r--r--conform/data/arpa/inet.h-data2
-rw-r--r--conform/data/assert.h-data4
-rw-r--r--conform/data/complex.h-data8
-rw-r--r--conform/data/cpio.h-data2
-rw-r--r--conform/data/ctype.h-data2
-rw-r--r--conform/data/dirent.h-data2
-rw-r--r--conform/data/dlfcn.h-data2
-rw-r--r--conform/data/errno.h-data11
-rw-r--r--conform/data/fcntl.h-data2
-rw-r--r--conform/data/float.h-data19
-rw-r--r--conform/data/fmtmsg.h-data2
-rw-r--r--conform/data/fnmatch.h-data4
-rw-r--r--conform/data/ftw.h-data2
-rw-r--r--conform/data/glob.h-data2
-rw-r--r--conform/data/grp.h-data4
-rw-r--r--conform/data/iconv.h-data2
-rw-r--r--conform/data/inttypes.h-data2
-rw-r--r--conform/data/langinfo.h-data2
-rw-r--r--conform/data/libgen.h-data2
-rw-r--r--conform/data/limits.h-data49
-rw-r--r--conform/data/locale.h-data2
-rw-r--r--conform/data/math.h-data41
-rw-r--r--conform/data/monetary.h-data2
-rw-r--r--conform/data/mqueue.h-data2
-rw-r--r--conform/data/ndbm.h-data2
-rw-r--r--conform/data/net/if.h-data2
-rw-r--r--conform/data/netdb.h-data2
-rw-r--r--conform/data/netinet/in.h-data2
-rw-r--r--conform/data/nl_types.h-data2
-rw-r--r--conform/data/poll.h-data2
-rw-r--r--conform/data/pthread.h-data28
-rw-r--r--conform/data/pwd.h-data4
-rw-r--r--conform/data/regex.h-data4
-rw-r--r--conform/data/sched.h-data2
-rw-r--r--conform/data/search.h-data2
-rw-r--r--conform/data/semaphore.h-data4
-rw-r--r--conform/data/setjmp.h-data6
-rw-r--r--conform/data/signal.h-data73
-rw-r--r--conform/data/spawn.h-data2
-rw-r--r--conform/data/stdarg.h-data3
-rw-r--r--conform/data/stdio.h-data56
-rw-r--r--conform/data/stdlib.h-data81
-rw-r--r--conform/data/string.h-data6
-rw-r--r--conform/data/strings.h-data18
-rw-r--r--conform/data/stropts.h-data2
-rw-r--r--conform/data/sys/ipc.h-data2
-rw-r--r--conform/data/sys/mman.h-data2
-rw-r--r--conform/data/sys/msg.h-data2
-rw-r--r--conform/data/sys/resource.h-data2
-rw-r--r--conform/data/sys/select.h-data2
-rw-r--r--conform/data/sys/sem.h-data2
-rw-r--r--conform/data/sys/shm.h-data2
-rw-r--r--conform/data/sys/socket.h-data2
-rw-r--r--conform/data/sys/stat.h-data2
-rw-r--r--conform/data/sys/statvfs.h-data2
-rw-r--r--conform/data/sys/time.h-data2
-rw-r--r--conform/data/sys/timeb.h-data2
-rw-r--r--conform/data/sys/times.h-data2
-rw-r--r--conform/data/sys/types.h-data2
-rw-r--r--conform/data/sys/uio.h-data2
-rw-r--r--conform/data/sys/un.h-data2
-rw-r--r--conform/data/sys/utsname.h-data2
-rw-r--r--conform/data/sys/wait.h-data2
-rw-r--r--conform/data/syslog.h-data2
-rw-r--r--conform/data/tar.h-data2
-rw-r--r--conform/data/termios.h-data8
-rw-r--r--conform/data/time.h-data80
-rw-r--r--conform/data/uchar.h-data12
-rw-r--r--conform/data/ucontext.h-data2
-rw-r--r--conform/data/ulimit.h-data2
-rw-r--r--conform/data/unistd.h-data2
-rw-r--r--conform/data/utime.h-data2
-rw-r--r--conform/data/utmpx.h-data2
-rw-r--r--conform/data/varargs.h-data2
-rw-r--r--conform/data/wchar.h-data70
-rw-r--r--conform/data/wctype.h-data10
-rw-r--r--conform/data/wordexp.h-data6
-rw-r--r--conform/run-conformtest.sh30
81 files changed, 644 insertions, 333 deletions
diff --git a/conform/Makefile b/conform/Makefile
index ee5c540cfd..5d88732e30 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2012 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
@@ -24,3 +24,13 @@ distribute = conformtest.pl $(wildcard data/*.h-data) \
 	   $(wildcard data/*/*.h-data)
 
 include ../Rules
+
+tests: $(objpfx)run-conformtest.out
+
+$(objpfx)run-conformtest.out: run-conformtest.sh conformtest.pl \
+			      $(wildcard data/*.h-data) \
+			      $(wildcard data/*/*.h-data)
+	$(SHELL) -e $< $(objpfx) $(PERL) '$(CC)' \
+	  '-I../include $(+sysdep-includes) $(sysincludes) -I..'
+
+generated = $(wildcard $(objpfx)conform-*.out)
diff --git a/conform/conformtest.pl b/conform/conformtest.pl
index d324d81c53..f90a4182b3 100644
--- a/conform/conformtest.pl
+++ b/conform/conformtest.pl
@@ -5,47 +5,40 @@ use POSIX;
 
 $CC = "gcc";
 
-$dialect="XOPEN2K";
-GetOptions ('headers=s' => \@headers, 'dialect=s' => \$dialect);
+$standard="XOPEN2K8";
+GetOptions ('headers=s' => \@headers, 'standard=s' => \$standard,
+	    'flags=s' => \$flags, 'cc=s' => \$CC);
 @headers = split(/,/,join(',',@headers));
 
 # List of the headers we are testing.
 if (@headers == ()) {
   @headers = ("wordexp.h", "wctype.h", "wchar.h", "varargs.h", "utmpx.h",
-	      "utime.h", "unistd.h", "ulimit.h", "ucontext.h", "time.h",
-	      "tgmath.h", "termios.h", "tar.h", "sys/wait.h", "sys/utsname.h",
-	      "sys/un.h", "sys/uio.h", "sys/types.h", "sys/times.h",
-	      "sys/timeb.h", "sys/time.h", "sys/statvfs.h", "sys/stat.h",
-	      "sys/socket.h", "sys/shm.h", "sys/sem.h", "sys/select.h",
-	      "sys/resource.h", "sys/msg.h", "sys/mman.h", "sys/ipc.h",
-	      "syslog.h", "stropts.h", "strings.h", "string.h", "stdlib.h",
-	      "stdio.h", "stdint.h", "stddef.h", "stdarg.h", "spawn.h",
-	      "signal.h", "setjmp.h", "semaphore.h", "search.h", "sched.h",
-	      "regex.h", "pwd.h", "pthread.h", "poll.h", "nl_types.h",
-	      "netinet/tcp.h", "netinet/in.h", "net/if.h", "netdb.h", "ndbm.h",
-	      "mqueue.h", "monetary.h", "math.h", "locale.h", "libgen.h",
-	      "limits.h", "langinfo.h", "iso646.h", "inttypes.h", "iconv.h",
-	      "grp.h", "glob.h", "ftw.h", "fnmatch.h", "fmtmsg.h", "float.h",
-	      "fcntl.h", "errno.h", "dlfcn.h", "dirent.h", "ctype.h", "cpio.h",
-	      "complex.h", "assert.h", "arpa/inet.h", "aio.h");
+	      "utime.h", "unistd.h", "ulimit.h", "ucontext.h", "uchar.h",
+	      "time.h", "tgmath.h", "termios.h", "tar.h", "sys/wait.h",
+	      "sys/utsname.h", "sys/un.h", "sys/uio.h", "sys/types.h",
+	      "sys/times.h", "sys/timeb.h", "sys/time.h", "sys/statvfs.h",
+	      "sys/stat.h", "sys/socket.h", "sys/shm.h", "sys/sem.h",
+	      "sys/select.h", "sys/resource.h", "sys/msg.h", "sys/mman.h",
+	      "sys/ipc.h", "syslog.h", "stropts.h", "strings.h", "string.h",
+	      "stdlib.h", "stdio.h", "stdint.h", "stddef.h", "stdarg.h",
+	      "spawn.h", "signal.h", "setjmp.h", "semaphore.h", "search.h",
+	      "sched.h", "regex.h", "pwd.h", "pthread.h", "poll.h",
+	      "nl_types.h", "netinet/tcp.h", "netinet/in.h", "net/if.h",
+	      "netdb.h", "ndbm.h", "mqueue.h", "monetary.h", "math.h",
+	      "locale.h", "libgen.h", "limits.h", "langinfo.h", "iso646.h",
+	      "inttypes.h", "iconv.h", "grp.h", "glob.h", "ftw.h", "fnmatch.h",
+	      "fmtmsg.h", "float.h", "fcntl.h", "errno.h", "dlfcn.h",
+	      "dirent.h", "ctype.h", "cpio.h", "complex.h", "assert.h",
+	      "arpa/inet.h", "aio.h");
 }
 
-if ($dialect ne "ISO" && $dialect ne "POSIX" && $dialect ne "XPG3"
-    && $dialect ne "XPG4" && $dialect ne "UNIX98" && $dialect ne "XOPEN2K"
-    && $dialect ne "XOPEN2K8" && $dialect ne "POSIX2008") {
-  die "unknown dialect \"$dialect\"";
+if ($standard ne "ISO" && $standard ne "ISO99" && $standard ne "ISO11"
+    && $standard ne "POSIX" && $standard ne "XPG3" && $standard ne "XPG4"
+    && $standard ne "UNIX98" && $standard ne "XOPEN2K" && $standard ne "XOPEN2K8"
+    && $standard ne "POSIX2008") {
+  die "unknown standard \"$standard\"";
 }
 
-$CFLAGS{"ISO"} = "-I. -fno-builtin '-D__attribute__(x)=' -ansi";
-$CFLAGS{"POSIX"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_POSIX_C_SOURCE=199912";
-$CFLAGS{"XPG3"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE";
-$CFLAGS{"XPG4"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE_EXTENDED";
-$CFLAGS{"UNIX98"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
-$CFLAGS{"XOPEN2K"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=600";
-$CFLAGS{"XOPEN2K8"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=700";
-$CFLAGS{"POSIX2008"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_POSIX_C_SOURCE=200809L";
-
-
 # These are the ISO C99 keywords.
 @keywords = ('auto', 'break', 'case', 'char', 'const', 'continue', 'default',
 	     'do', 'double', 'else', 'enum', 'extern', 'float', 'for', 'goto',
@@ -56,14 +49,31 @@ $CFLAGS{"POSIX2008"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_POSIX_C_SOURCE
 # These are symbols which are known to pollute the namespace.
 @knownproblems = ('unix', 'linux', 'i386');
 
-if ($dialect ne "XOPEN2K8" && $dialect ne "POSIX2008") {
+$CFLAGS{"ISO"} = "-ansi";
+$CFLAGS{"ISO99"} = "-std=c99";
+$CFLAGS{"ISO11"} = "-std=c1x -D_ISOC11_SOURCE";
+$CFLAGS{"POSIX"} = "-D_POSIX_C_SOURCE=199912";
+$CFLAGS{"XPG3"} = "-D_XOPEN_SOURCE";
+$CFLAGS{"XPG4"} = "-D_XOPEN_SOURCE_EXTENDED";
+$CFLAGS{"UNIX98"} = "-D_XOPEN_SOURCE=500";
+$CFLAGS{"XOPEN2K"} = "-D_XOPEN_SOURCE=600";
+$CFLAGS{"XOPEN2K8"} = "-D_XOPEN_SOURCE=700";
+$CFLAGS{"POSIX2008"} = "-D_POSIX_C_SOURCE=200809L";
+
+$CFLAGS = "$flags -fno-builtin '-D__attribute__(x)=' $CFLAGS{$standard} -D_ISOMAC";
+
+if ($standard ne "XOPEN2K8" && $standard ne "POSIX2008") {
   # Some headers need a bit more attention.  At least with XPG7
   # all headers should be self-contained.
   $mustprepend{'inttypes.h'} = "#include <stddef.h>\n";
+  $mustprepend{'glob.h'} = "#include <sys/types.h>\n";
+  $mustprepend{'grp.h'} = "#include <sys/types.h>\n";
   $mustprepend{'regex.h'} = "#include <sys/types.h>\n";
+  $mustprepend{'pwd.h'} = "#include <sys/types.h>\n";
   $mustprepend{'sched.h'} = "#include <sys/types.h>\n";
-  $mustprepend{'signal.h'} = "#include <pthread.h>\n";
+  $mustprepend{'signal.h'} = "#include <pthread.h>\n#include <sys/types.h>\n";
   $mustprepend{'stdio.h'} = "#include <sys/types.h>\n";
+  $mustprepend{'sys/stat.h'} = "#include <sys/types.h>\n";
   $mustprepend{'wchar.h'} = "#include <stdarg.h>\n";
   $mustprepend{'wordexp.h'} = "#include <stddef.h>\n";
 }
@@ -100,9 +110,17 @@ sub poorfnmatch {
     $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));
+    if (substr ($pattern, -2, 1) eq ']') {
+      my($patlen) = index ($pattern, '[');
+      my($range) = substr ($pattern, $patlen + 1, -2);
+      $res = ($strlen > $patlen
+	      && substr ($pattern, 0, $patlen) eq substr ($string, 0, $patlen)
+	      && index ($range, substr ($string, $patlen, 1)) != -1);
+    } else {
+      my($patlen) = length ($pattern) - 1;
+      $res = ($strlen >= $patlen
+	      && substr ($pattern, 0, $patlen) eq substr ($string, 0, $patlen));
+    }
   } else {
     $res = $pattern eq $string;
   }
@@ -123,7 +141,7 @@ sub compiletest
     ++$skipped;
     printf (" SKIP\n");
   } else {
-    $ret = system "$CC $CFLAGS{$dialect} -c $fnamebase.c -o $fnamebase.o > $fnamebase.out 2>&1";
+    $ret = system "$CC $CFLAGS -c $fnamebase.c -o $fnamebase.o > $fnamebase.out 2>&1";
     if ($ret != 0) {
       if ($optional != 0) {
 	printf (" $errmsg\n");
@@ -175,7 +193,7 @@ sub runtest
     ++$skipped;
     printf (" SKIP\n");
   } else {
-    $ret = system "$CC $CFLAGS{$dialect} -o $fnamebase $fnamebase.c > $fnamebase.out 2>&1";
+    $ret = system "$CC $CFLAGS -o $fnamebase $fnamebase.c > $fnamebase.out 2>&1";
     if ($ret != 0) {
       printf (" FAIL\n");
       if ($verbose != 0) {
@@ -232,9 +250,7 @@ sub newtoken {
     return if (poorfnmatch ($allow[$idx], $token));
   }
 
-  if ($isknown{$token}) {
-    ++$nknown;
-  } else {
+  unless ($isknown{$token}) {
     $errors{$token} = 1;
   }
 }
@@ -264,7 +280,7 @@ sub checknamespace {
 
   undef %errors;
   $nknown = 0;
-  open (CONTENT, "$CC $CFLAGS{$dialect} -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |");
+  open (CONTENT, "$CC $CFLAGS -E $fnamebase.c -P -Wp,-dN | sed -e '/^# [1-9]/d' -e '/^[[:space:]]*\$/d' |");
   loop: while (<CONTENT>) {
     chop;
     if (/^#define (.*)/) {
@@ -303,12 +319,7 @@ sub checknamespace {
   }
 
   if ($realerror == 0) {
-    if ($nknown > 0) {
-      printf ("EXPECTED FAILURES\n");
-      ++$known;
-    } else {
-      printf ("OK\n");
-    }
+    printf ("OK\n");
   }
 }
 
@@ -318,32 +329,36 @@ while ($#headers >= 0) {
   my($hf) = $h;
   $hf =~ s|/|-|;
   my($fnamebase) = "$tmpdir/$hf-test";
-  my($missing);
+  my($missing) = 1;
   my(@allow) = ();
   my(@allowheader) = ();
   my(%seenheader) = ();
   my($prepend) = $mustprepend{$h};
+  my($test_exist) = 1;
 
   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 "$prepend";
-  print TESTFILE "#include <$h>\n";
-  close (TESTFILE);
-
-  $missing = compiletest ($fnamebase, "Checking whether <$h> is available",
-			  "Header <$h> not available", 0, 0);
-
-  printf ("\n");
-
-  open (CONTROL, "$CC -E -D$dialect - < data/$h-data |");
+  open (CONTROL, "$CC -E -D$standard -x c data/$h-data |");
   control: while (<CONTROL>) {
     chop;
     next control if (/^#/);
     next control if (/^[	]*$/);
 
+    if ($test_exist) {
+      $test_exist = 0;
+      # Generate a program to test for the availability of this header.
+      open (TESTFILE, ">$fnamebase.c");
+      print TESTFILE "$prepend";
+      print TESTFILE "#include <$h>\n";
+      close (TESTFILE);
+
+      $missing = compiletest ($fnamebase, "Checking whether <$h> is available",
+			      "Header <$h> not available", 0, 0);
+      printf ("\n");
+      last control if ($missing);
+    }
+
     if (/^element *({([^}]*)}|([^{ ]*)) *({([^}]*)}|([^{ ]*)) *([A-Za-z0-9_]*) *(.*)/) {
       my($struct) = "$2$3";
       my($type) = "$5$6";
@@ -421,7 +436,7 @@ while ($#headers >= 0) {
 		     "Member \"$member\" does not have the correct type.",
 		     $res, 0);
       }
-    } elsif (/^optional-constant *([a-zA-Z0-9_]*) ([>=<]+) ([A-Za-z0-9_]*)/) {
+    } elsif (/^optional-constant *([a-zA-Z0-9_]*) ([>=<]+) ([A-Za-z0-9_-]*)/) {
       my($const) = $1;
       my($op) = $2;
       my($value) = $3;
@@ -452,7 +467,7 @@ while ($#headers >= 0) {
 	$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_]*)/) {
+    } elsif (/^constant *([a-zA-Z0-9_]*) *([>=<]+) ([A-Za-z0-9_-]*)/) {
       my($const) = $1;
       my($op) = $2;
       my($value) = $3;
@@ -483,7 +498,7 @@ 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_]*)?/) {
+    } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_-]*)?/) {
       my($const) = $1;
       my($type) = "$3$4";
       my($value) = $5;
@@ -525,7 +540,7 @@ while ($#headers >= 0) {
 	$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_]*)?/) {
+    } elsif (/^optional-constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_-]*)?/) {
       my($const) = $1;
       my($value) = $2;
       my($res) = $missing;
@@ -554,7 +569,7 @@ while ($#headers >= 0) {
 	$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_]*)?/) {
+    } elsif (/^constant *([a-zA-Z0-9_]*) *([A-Za-z0-9_-]*)?/) {
       my($const) = $1;
       my($value) = $2;
       my($res) = $missing;
@@ -583,7 +598,7 @@ while ($#headers >= 0) {
 	$res = runtest ($fnamebase, "Testing for value of constant $const",
 			"Constant \"$const\" has not the right value.", $res);
       }
-    } elsif (/^symbol *([a-zA-Z0-9_]*) *([A-Za-z0-9_]*)?/) {
+    } elsif (/^symbol *([a-zA-Z0-9_]*) *([A-Za-z0-9_-]*)?/) {
       my($symbol) = $1;
       my($value) = $2;
       my($res) = $missing;
@@ -614,7 +629,7 @@ while ($#headers >= 0) {
 	$res = runtest ($fnamebase, "Testing for value of symbol $symbol",
 			"Symbol \"$symbol\" has not the right value.", $res);
       }
-    } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_]*)?/) {
+    } elsif (/^typed-constant *([a-zA-Z0-9_]*) *({([^}]*)}|([^ ]*)) *([A-Za-z0-9_-]*)?/) {
       my($const) = $1;
       my($type) = "$3$4";
       my($value) = $5;
@@ -908,7 +923,7 @@ while ($#headers >= 0) {
       print TESTFILE "#endif\n";
       close (TESTFILE);
 
-      $res = compiletest ($fnamebase, "Test availability of function $fname",
+      $res = compiletest ($fnamebase, "Test availability of macro $fname",
 			  "Function \"$fname\" is not available.", $res, 0);
 
       # Generate a program to test for the type of this function.
@@ -921,7 +936,7 @@ while ($#headers >= 0) {
       print TESTFILE "#endif\n";
       close (TESTFILE);
 
-      compiletest ($fnamebase, "Test for type of function $fname",
+      compiletest ($fnamebase, "Test for type of macro $fname",
 		   "Function \"$fname\" has incorrect type.", $res, 0);
     } elsif (/^macro-str *([^	 ]*) *(\".*\")/) {
       # The above regex doesn't handle a \" in a string.
@@ -1002,7 +1017,39 @@ while ($#headers >= 0) {
 	print TESTFILE "int main (void) { return !($macro $op $value); }\n";
 	close (TESTFILE);
 
-	$res = runtest ($fnamebase, "Testing for value of constant $macro",
+	$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",
+			  "Macro \"$macro\" is not available.", $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";
+	# 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 *([^	]*)/) {
@@ -1046,7 +1093,7 @@ while ($#headers >= 0) {
   while ($#allowheader >= 0) {
     my($ah) = pop @allowheader;
 
-    open (ALLOW, "$CC -E -D$dialect - < data/$ah-data |");
+    open (ALLOW, "$CC -E -D$standard - < data/$ah-data |");
     acontrol: while (<ALLOW>) {
       chop;
       next acontrol if (/^#/);
@@ -1091,13 +1138,17 @@ while ($#headers >= 0) {
     close (ALLOW);
   }
 
-  # Now check the namespace.
-  printf ("  Checking the namespace of \"%s\"... ", $h);
-  if ($missing) {
-    ++$skipped;
-    printf ("SKIP\n");
+  if ($test_exist) {
+    printf ("  Not defined\n");
   } else {
-    checknamespace ($h, $fnamebase, @allow);
+    # 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");
@@ -1106,14 +1157,6 @@ while ($#headers >= 0) {
 printf "-" x 76 . "\n";
 printf ("  Total number of tests   : %4d\n", $total);
 
-printf ("  Number of known failures: %4d (", $known);
-$percent = ($known * 100) / $total;
-if ($known > 0 && $percent < 1.0) {
-  printf (" <1%%)\n");
-} else {
-  printf ("%3d%%)\n", $percent);
-}
-
 printf ("  Number of failed tests  : %4d (", $errors);
 $percent = ($errors * 100) / $total;
 if ($errors > 0 && $percent < 1.0) {
@@ -1131,3 +1174,6 @@ if ($skipped > 0 && $percent < 1.0) {
 }
 
 exit $errors != 0;
+# Local Variables:
+#  perl-indent-level: 2
+# End:
diff --git a/conform/data/aio.h-data b/conform/data/aio.h-data
index 75698cb39b..b810014b3f 100644
--- a/conform/data/aio.h-data
+++ b/conform/data/aio.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type {struct aiocb}
 
 // Test elements of the AIO control struct.
diff --git a/conform/data/arpa/inet.h-data b/conform/data/arpa/inet.h-data
index 98f5e0ecaf..becee2fd1e 100644
--- a/conform/data/arpa/inet.h-data
+++ b/conform/data/arpa/inet.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 // in_port_t should have exactly 16 bits
 type in_port_t
 // in_addr_t should have exactly 32 bits
diff --git a/conform/data/assert.h-data b/conform/data/assert.h-data
index 1b1180838a..9c3cc046c6 100644
--- a/conform/data/assert.h-data
+++ b/conform/data/assert.h-data
@@ -1,3 +1,7 @@
 macro assert
 
+#ifdef ISO11
+macro static_assert
+#endif
+
 allow *_t
diff --git a/conform/data/complex.h-data b/conform/data/complex.h-data
index 006d6e4de7..8f31d22057 100644
--- a/conform/data/complex.h-data
+++ b/conform/data/complex.h-data
@@ -1,4 +1,4 @@
-#if defined XOPEN2K || defined POSIX2008
+#if defined ISO99 || defined ISO11 || defined XOPEN2K || defined POSIX2008
 macro complex
 macro _Complex_I
 optional-macro imaginary
@@ -73,4 +73,10 @@ function {long double complex} csinl (long double complex)
 function {long double complex} csqrtl (long double complex)
 function {long double complex} ctanhl (long double complex)
 function {long double complex} ctanl (long double complex)
+
+# if defined ISO11
+macro-function {double complex} CMPLX (double, double)
+macro-function {float complex} CMPLXF (float, float)
+macro-function {long double complex} CMPLXL (long double, long double)
+# endif
 #endif
diff --git a/conform/data/cpio.h-data b/conform/data/cpio.h-data
index c6f4d8909c..6e71319274 100644
--- a/conform/data/cpio.h-data
+++ b/conform/data/cpio.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 constant C_IRUSR 0000400
 constant C_IWUSR 0000200
 constant C_IXUSR 0000100
diff --git a/conform/data/ctype.h-data b/conform/data/ctype.h-data
index 091d377bec..e2c6019d50 100644
--- a/conform/data/ctype.h-data
+++ b/conform/data/ctype.h-data
@@ -12,7 +12,7 @@ function int isxdigit (int)
 function int tolower (int)
 function int toupper (int)
 
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function int isascii (int)
 function int toascii (int)
 
diff --git a/conform/data/dirent.h-data b/conform/data/dirent.h-data
index f1cd59cdaf..be7ad06fd8 100644
--- a/conform/data/dirent.h-data
+++ b/conform/data/dirent.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type DIR
 
 type {struct dirent}
diff --git a/conform/data/dlfcn.h-data b/conform/data/dlfcn.h-data
index 93e3354635..59dd028911 100644
--- a/conform/data/dlfcn.h-data
+++ b/conform/data/dlfcn.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 macro RTLD_LAZY
 macro RTLD_NOW
 macro RTLD_GLOBAL
diff --git a/conform/data/errno.h-data b/conform/data/errno.h-data
index ffdf6b5c4d..328687f8dc 100644
--- a/conform/data/errno.h-data
+++ b/conform/data/errno.h-data
@@ -2,7 +2,10 @@ constant EDOM
 constant EILSEQ
 constant ERANGE
 
-#ifndef ISO
+// variable int errno
+allow errno
+
+#if !defined ISO && !defined ISO99 && !defined ISO11
 constant E2BIG
 constant EACCES
 constant EADDRINUSE
@@ -84,9 +87,9 @@ constant ENOTRECOVERABLE
 constant EOWNERDEAD
 # endif
 
-// variable int errno
-allow errno
-
 allow E*
 allow *_t
 #endif
+
+allow E[0123456789]*
+allow E[ABCDEFGHIJKLMNOPQRSTUVWXYZ]*
diff --git a/conform/data/fcntl.h-data b/conform/data/fcntl.h-data
index 7769a446dd..54eed417e7 100644
--- a/conform/data/fcntl.h-data
+++ b/conform/data/fcntl.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 constant F_DUPFD
 constant F_GETFD
 constant F_SETFD
diff --git a/conform/data/float.h-data b/conform/data/float.h-data
index 71a429b0bf..49d953aa6d 100644
--- a/conform/data/float.h-data
+++ b/conform/data/float.h-data
@@ -38,4 +38,23 @@ macro FLT_MIN
 macro DBL_MIN
 macro LDBL_MIN
 
+#if !defined ISO && !defined XPG3 && !defined XPG4 && !defined POSIX && !defined UNIX98
+constant DECIMAL_DIG >= 10
+constant FLT_EVAL_METHOD
+#endif
+
+#if defined ISO11
+constant DBL_HAS_SUBNORM
+constant FLT_HAS_SUBNORM
+constant LDBL_HAS_SUBNORM
+
+constant DBL_DECIMAL_DIG >= 10
+constant FLT_DECIMAL_DIG >= 6
+constant LDBL_DECIMAL_DIG >= 10
+
+constant DBL_TRUE_MIN <= 1E-37
+constant FLT_TRUE_MIN <= 1E-37
+constant LDBL_TRUE_MIN <= 1E-37
+#endif
+
 allow *_t
diff --git a/conform/data/fmtmsg.h-data b/conform/data/fmtmsg.h-data
index 67c35c1c93..d6d0ff1e2d 100644
--- a/conform/data/fmtmsg.h-data
+++ b/conform/data/fmtmsg.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 macro MM_HARD
 constant MM_HARD
 
diff --git a/conform/data/fnmatch.h-data b/conform/data/fnmatch.h-data
index 96591d6d43..12a9a4ac2e 100644
--- a/conform/data/fnmatch.h-data
+++ b/conform/data/fnmatch.h-data
@@ -1,9 +1,9 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 constant FNM_NOMATCH
 constant FNM_PATHNAME
 constant FNM_PERIOD
 constant FNM_NOESCAPE
-#if !defined XOPEN2K8 && !defined POSIX2008
+#if !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
 constant FNM_NOSYS
 #endif
 
diff --git a/conform/data/ftw.h-data b/conform/data/ftw.h-data
index eb499243a5..0fa586a6fc 100644
--- a/conform/data/ftw.h-data
+++ b/conform/data/ftw.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 type {struct FTW}
 element {struct FTW} int base
 element {struct FTW} int level
diff --git a/conform/data/glob.h-data b/conform/data/glob.h-data
index 9f90f8b84b..23a5077950 100644
--- a/conform/data/glob.h-data
+++ b/conform/data/glob.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type glob_t
 element glob_t size_t gl_pathc
 element glob_t {char**} gl_pathv
diff --git a/conform/data/grp.h-data b/conform/data/grp.h-data
index 16519506e5..384e1ad5ba 100644
--- a/conform/data/grp.h-data
+++ b/conform/data/grp.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type {struct group}
 element {struct group} {char*} gr_name
 element {struct group} gid_t gr_gid
@@ -13,9 +13,9 @@ type size_t
 
 function {struct group*} getgrgid (gid_t)
 function {struct group*} getgrnam (const char*)
-# ifndef POSIX
 function int getgrgid_r (gid_t, struct group*, char *, size_t, struct group**)
 function int getgrnam_r (const char *, struct group *, char *, size_t, struct group**)
+# ifndef POSIX
 function {struct group*} getgrent (void)
 function void endgrent (void)
 #  ifndef POSIX2008
diff --git a/conform/data/iconv.h-data b/conform/data/iconv.h-data
index 7071d90f60..79fb2d6def 100644
--- a/conform/data/iconv.h-data
+++ b/conform/data/iconv.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type iconv_t
 # if defined XOPEN2K8 || defined POSIX2008
 type size_t
diff --git a/conform/data/inttypes.h-data b/conform/data/inttypes.h-data
index 17d2b9717a..d308a52255 100644
--- a/conform/data/inttypes.h-data
+++ b/conform/data/inttypes.h-data
@@ -1,3 +1,4 @@
+#if defined ISO99 || defined ISO11 || defined XOPEN2K || defined POSIX2008
 type int8_t
 type int16_t
 type int32_t
@@ -141,3 +142,4 @@ allow INT*
 allow UINT*
 allow PRI[Xa-z]*
 allow SCN[Xa-z]*
+#endif
diff --git a/conform/data/langinfo.h-data b/conform/data/langinfo.h-data
index 95bc3f934e..51dd925a8a 100644
--- a/conform/data/langinfo.h-data
+++ b/conform/data/langinfo.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 constant CODESET
 constant D_T_FMT
 constant D_FMT
diff --git a/conform/data/libgen.h-data b/conform/data/libgen.h-data
index b749b8dcde..f59bbb0007 100644
--- a/conform/data/libgen.h-data
+++ b/conform/data/libgen.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function {char*} basename (char*)
 function {char*} dirname (char*)
 
diff --git a/conform/data/limits.h-data b/conform/data/limits.h-data
index 2e720a9b78..27ae77af8d 100644
--- a/conform/data/limits.h-data
+++ b/conform/data/limits.h-data
@@ -1,3 +1,31 @@
+constant CHAR_BIT >= 8
+constant SCHAR_MIN <= -127
+constant SCHAR_MAX >= 127
+constant UCHAR_MAX >= 255
+#ifdef __CHAR_UNSIGNED__
+constant CHAR_MIN 0
+constant CHAR_MAX UCHAR_MAX
+#else
+constant CHAR_MIN SCHAR_MIN
+constant CHAR_MAX SCHAR_MAX
+#endif
+constant MB_LEN_MAX >= 1
+constant SHRT_MIN <= -32767
+constant SHRT_MAX >= 32767
+constant USHRT_MAX >= 65535
+constant INT_MAX >= 2147483647
+constant INT_MIN <= 2147483647
+constant UINT_MAX >= 4294967295
+constant LONG_MAX >= 2147483647
+constant LONG_MIN <= 2147483647
+constant ULONG_MAX >= 4294967295
+#if defined ISO99 || defined ISO11 || defined XOPEN2K8 || defined POSIX2008
+constant LLONG_MIN <= -9223372036854775807ll
+constant LLONG_MAX >= 9223372036854775807ll
+constant ULLONG_MAX >= 18446744073709551615ull
+#endif
+
+#if !defined ISO && !defined ISO99 && !defined ISO11
 // if these values exist, we should check the minimal value
 allow AIO_LIST_MAX
 allow AIO_MAX
@@ -111,25 +139,11 @@ optional-constant _POSIX2_LINE_MAX 2048
 optional-constant _POSIX2_RE_DUP_MAX 255
 optional-constant _XOPEN_IOV_MAX 16
 
-constant CHAR_BIT >= 8
-constant CHAR_MAX
-constant INT_MAX >= 2147483647
+#if !defined POSIX && !defined POSIX2008
+constant WORD_BIT >= 16
 constant LONG_BIT >= 32
-constant MB_LEN_MAX >= 1
-constant LONG_MAX >= 2147483647
-constant SCHAR_MAX >= 127
-constant SHRT_MAX >= 32767
+#endif
 constant SSIZE_MAX
-constant UCHAR_MAX >= 255
-constant UINT_MAX >= 4294967295
-constant ULONG_MAX >= 4294967295
-constant USHRT_MAX >= 65535
-constant WORD_BIT >= 16
-constant CHAR_MIN
-constant INT_MIN <= 2147483647
-constant LONG_MIN <= 2147483647
-constant SCHAR_MIN <= -127
-constant SHRT_MIN <= -32767
 
 optional-constant CHARCLASS_NAME_MAX >= 14
 optional-constant NL_ARGMAX >= 9
@@ -149,3 +163,4 @@ optional-constant TMP_MAX >= 10000
 
 allow *_MAX
 allow *_MIN
+#endif
diff --git a/conform/data/locale.h-data b/conform/data/locale.h-data
index f6e6c22c80..8897ee08a1 100644
--- a/conform/data/locale.h-data
+++ b/conform/data/locale.h-data
@@ -17,7 +17,7 @@ element {struct lconv} char p_cs_precedes
 element {struct lconv} char p_sep_by_space
 element {struct lconv} char p_sign_posn
 element {struct lconv} {char*} thousands_sep
-#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
+#if !defined ISO && !defined POSIX && !defined XPG3 && !defined XPG4 && !defined UNIX98
 element {struct lconv} char int_n_cs_precedes
 element {struct lconv} char int_n_sep_by_space
 element {struct lconv} char int_n_sign_posn
diff --git a/conform/data/math.h-data b/conform/data/math.h-data
index f55e63298c..5f1f11d64c 100644
--- a/conform/data/math.h-data
+++ b/conform/data/math.h-data
@@ -1,3 +1,5 @@
+constant HUGE_VAL
+
 #if !defined ISO && !defined POSIX
 macro fpclassify
 macro isfinite
@@ -12,7 +14,7 @@ macro islessequal
 macro islessgreater
 macro isunordered
 
-# ifndef POSIX2008
+# if !defined ISO99 && !defined ISO11 && !defined POSIX2008
 constant M_E
 constant M_LOG2E
 constant M_LOG10E
@@ -29,7 +31,6 @@ constant M_SQRT1_2
 
 constant MAXFLOAT
 # endif
-constant HUGE_VAL
 constant HUGE_VALF
 constant HUGE_VALL
 constant INFINITY
@@ -48,22 +49,28 @@ optional-macro FP_FAST_FMAL
 constant FP_ILOGB0
 constant FP_ILOGBNAN
 
+# if !defined XPG3 && !defined XPG4 && !defined UNIX98
 macro MATH_ERRNO == 1
 macro MATH_ERREXCEPT == 2
-#endif
 
 macro math_errhandling
+# endif
+#endif
 
 function double acos (double)
 function double asin (double)
 function double atan (double)
 function double atan2 (double, double)
 function double ceil (double)
+#if !defined ISO && !defined POSIX
 function double copysign (double, double)
+#endif
 function double cos (double)
 function double cosh (double)
 function double exp (double)
+#if !defined ISO && !defined POSIX
 function double exp2 (double)
+#endif
 function double fabs (double)
 function double floor (double)
 function double fmod (double, double)
@@ -71,7 +78,9 @@ function double frexp (double, int*)
 function double ldexp (double, int)
 function double log (double)
 function double log10 (double)
+#if !defined ISO && !defined POSIX
 function double log2 (double)
+#endif
 function double modf (double, double*)
 function double pow (double, double)
 function double sin (double)
@@ -79,24 +88,27 @@ function double sinh (double)
 function double sqrt (double)
 function double tan (double)
 function double tanh (double)
+#if !defined ISO && !defined POSIX
 function double erf (double)
 function double erfc (double)
+#endif
 #if defined XPG3 || defined XPG4 || defined UNIX98
 function double gamma (double)
 #endif
+#if !defined ISO && !defined POSIX
 function double hypot (double, double)
-#if !defined POSIX && !defined POSIX2008
+# if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function double j0 (double)
 function double j1 (double)
 function double jn (int, double)
-#endif
+# endif
 function double lgamma (double)
 function double tgamma (double)
-#if !defined POSIX && !defined POSIX2008
+# if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function double y0 (double)
 function double y1 (double)
 function double yn (int, double)
-#endif
+# endif
 function double acosh (double)
 function double asinh (double)
 function double atanh (double)
@@ -117,9 +129,9 @@ function {long long} llrint (double)
 function long lround (double)
 function {long long} llround (double)
 function double remquo (double, double, int*)
-#if defined XPG3 && defined XPG4 && defined UNIX98 && defined XOPEN2K
+# if defined XPG3 && defined XPG4 && defined UNIX98 && defined XOPEN2K
 function double scalb (double, double)
-#endif
+# endif
 function double scalbn (double, int)
 function double scalbln (double, long)
 function double fdim (double, double)
@@ -128,9 +140,10 @@ function double fmin (double, double)
 function double fma (double, double, double)
 function double nan (const char*)
 
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 // variable signgam
 allow signgam
+# endif
 #endif
 
 #if !defined ISO && !defined POSIX
@@ -165,14 +178,14 @@ function float erfcf (float)
 function float gammaf (float)
 #endif
 function float hypotf (float, float)
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function float j0f (float)
 function float j1f (float)
 function float jnf (int, float)
 #endif
 function float lgammaf (float)
 function float tgammaf (float)
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function float y0f (float)
 function float y1f (float)
 function float ynf (int, float)
@@ -239,14 +252,14 @@ function {long double} erfcl (long double)
 function {long double} gammal (long double)
 #endif
 function {long double} hypotl (long double, long double)
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function {long double} j0l (long double)
 function {long double} j1l (long double)
 function {long double} jnl (int, long double)
 #endif
 function {long double} lgammal (long double)
 function {long double} tgammal (long double)
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function {long double} y0l (long double)
 function {long double} y1l (long double)
 function {long double} ynl (int, long double)
diff --git a/conform/data/monetary.h-data b/conform/data/monetary.h-data
index 7935f2ab85..4f0cb9b681 100644
--- a/conform/data/monetary.h-data
+++ b/conform/data/monetary.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type size_t
 type ssize_t
 # if defined XOPEN2K8 || defined POSIX2008
diff --git a/conform/data/mqueue.h-data b/conform/data/mqueue.h-data
index 16335a556f..d6313b3c56 100644
--- a/conform/data/mqueue.h-data
+++ b/conform/data/mqueue.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 // should test for not an array type.
 type mqd_t
 
diff --git a/conform/data/ndbm.h-data b/conform/data/ndbm.h-data
index af091de0fd..5d1fc6a3c1 100644
--- a/conform/data/ndbm.h-data
+++ b/conform/data/ndbm.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 type datum
 element datum {void*} dptr
 element datum size_t dsize
diff --git a/conform/data/net/if.h-data b/conform/data/net/if.h-data
index d019978ab5..2c3eb4d9d5 100644
--- a/conform/data/net/if.h-data
+++ b/conform/data/net/if.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type {struct if_nameindex}
 
 element {struct if_nameindex} {unsigned int} if_index
diff --git a/conform/data/netdb.h-data b/conform/data/netdb.h-data
index 95afed81f6..a73004c615 100644
--- a/conform/data/netdb.h-data
+++ b/conform/data/netdb.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 optional-type in_port_t
 optional-type in_addr_t
 
diff --git a/conform/data/netinet/in.h-data b/conform/data/netinet/in.h-data
index 391e1a551c..020a97eeae 100644
--- a/conform/data/netinet/in.h-data
+++ b/conform/data/netinet/in.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type in_port_t
 type in_addr_t
 
diff --git a/conform/data/nl_types.h-data b/conform/data/nl_types.h-data
index ec2c18bc3e..67a0d7a198 100644
--- a/conform/data/nl_types.h-data
+++ b/conform/data/nl_types.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type nl_catd
 type nl_item
 
diff --git a/conform/data/poll.h-data b/conform/data/poll.h-data
index 69fd724a3e..395e4b5011 100644
--- a/conform/data/poll.h-data
+++ b/conform/data/poll.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type {struct pollfd}
 element {struct pollfd} int fd
 element {struct pollfd} {short int} events
diff --git a/conform/data/pthread.h-data b/conform/data/pthread.h-data
index 70486cc1ed..bf25902127 100644
--- a/conform/data/pthread.h-data
+++ b/conform/data/pthread.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 constant PTHREAD_CANCEL_ASYNCHRONOUS
 constant PTHREAD_CANCEL_ENABLE
 constant PTHREAD_CANCEL_DEFERRED
@@ -31,19 +31,27 @@ constant PTHREAD_MUTEX_STALLED
 # endif
 
 type pthread_attr_t
+# if !defined POSIX
 type pthread_barrier_t
 type pthread_barrierattr_t
+# endif
 type pthread_cond_t
 type pthread_condattr_t
 type pthread_key_t
 type pthread_mutex_t
 type pthread_mutexattr_t
 type pthread_once_t
+# if !defined POSIX
 type pthread_rwlock_t
 type pthread_rwlockattr_t
 type pthread_spinlock_t
+# endif
 type pthread_t
 
+#ifdef POSIX
+# define sigset_t __sigset_t
+#endif
+
 function int pthread_attr_destroy (pthread_attr_t*)
 function int pthread_attr_getdetachstate (const pthread_attr_t*, int*)
 # ifndef POSIX
@@ -66,6 +74,7 @@ function int pthread_attr_setschedpolicy (pthread_attr_t*, int)
 function int pthread_attr_setscope (pthread_attr_t*, int)
 function int pthread_attr_setstackaddr (pthread_attr_t*, void*)
 function int pthread_attr_setstacksize (pthread_attr_t*, size_t)
+# if !defined POSIX
 function int pthread_barrier_destroy (pthread_barrier_t*)
 function int pthread_barrier_init (pthread_barrier_t*, const pthread_barrierattr_t*, unsigned int)
 function int pthread_barrier_wait (pthread_barrier_t*)
@@ -73,6 +82,7 @@ function int pthread_barrierattr_destroy (pthread_barrierattr_t*)
 function int pthread_barrierattr_getpshared (const pthread_barrierattr_t*, int*)
 function int pthread_barrierattr_init (pthread_barrierattr_t*)
 function int pthread_barrierattr_setpshared (pthread_barrierattr_t*, int)
+# endif
 function int pthread_cancel (pthread_t)
 // function int pthread_cleanup_push (void (*) (void*), void*)
 macro pthread_cleanup_push
@@ -97,7 +107,9 @@ function void pthread_exit (void*)
 # if !defined POSIX && !defined POSIX2008
 function int pthread_getconcurrency (void)
 # endif
+# if !defined POSIX
 function int pthread_getcpuclockid (pthread_t, clockid_t*)
+# endif
 function int pthread_getschedparam (pthread_t, int*, struct sched_param*)
 function {void*} pthread_getspecific (pthread_key_t)
 function int pthread_join (pthread_t, void**)
@@ -108,21 +120,27 @@ optional-function int pthread_mutex_getprioceiling (const pthread_mutex_t*, int*
 function int pthread_mutex_init (pthread_mutex_t*, const pthread_mutexattr_t*)
 function int pthread_mutex_lock (pthread_mutex_t*)
 optional-function int pthread_mutex_setprioceiling (pthread_mutex_t*, int, int*)
+# if !defined POSIX
 function int pthread_mutex_timedlock (pthread_mutex_t*, const struct timespec*)
+# endif
 function int pthread_mutex_trylock (pthread_mutex_t*)
 function int pthread_mutex_unlock (pthread_mutex_t*)
 function int pthread_mutexattr_destroy (pthread_mutexattr_t*)
 optional-function int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t*, int*)
 optional-function int pthread_mutexattr_getprotocol (const pthread_mutexattr_t*, int*)
 function int pthread_mutexattr_getpshared (const pthread_mutexattr_t*, int*)
+# if !defined POSIX
 function int pthread_mutexattr_gettype (const pthread_mutexattr_t*, int*)
+# endif
 function int pthread_mutexattr_init (pthread_mutexattr_t*)
 optional-function int pthread_mutexattr_setprioceiling (pthread_mutexattr_t*, int)
 optional-function int pthread_mutexattr_setprotocol (pthread_mutexattr_t*, int)
 function int pthread_mutexattr_setpshared (pthread_mutexattr_t*, int)
+# if !defined POSIX
 function int pthread_mutexattr_settype (pthread_mutexattr_t*, int)
+# endif
 function int pthread_once (pthread_once_t*, void (*) (void))
-# ifndef POSIX
+# if !defined POSIX
 function int pthread_rwlock_init (pthread_rwlock_t*, const pthread_rwlockattr_t*)
 function int pthread_rwlock_rdlock (pthread_rwlock_t*)
 function int pthread_rwlock_timedrdlock (pthread_rwlock_t*, const struct timespec*)
@@ -144,14 +162,16 @@ function int pthread_setconcurrency (int)
 # endif
 function int pthread_setschedparam (pthread_t, int, const struct sched_param*)
 function int pthread_setspecific (pthread_key_t, const void*)
-#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
+# if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
 function int pthread_sigmask (int, const sigset_t*, sigset_t*)
-#endif
+# endif
+# if !defined POSIX
 function int pthread_spin_destroy (pthread_spinlock_t*)
 function int pthread_spin_init (pthread_spinlock_t*, int)
 function int pthread_spin_lock (pthread_spinlock_t*)
 function int pthread_spin_trylock (pthread_spinlock_t*)
 function int pthread_spin_unlock (pthread_spinlock_t*)
+# endif
 function void pthread_testcancel (void)
 # if defined XOPEN2K8 || defined POSIX2008
 function int pthread_mutex_consistent (pthread_mutex_t *)
diff --git a/conform/data/pwd.h-data b/conform/data/pwd.h-data
index a8edf27730..f779a697b3 100644
--- a/conform/data/pwd.h-data
+++ b/conform/data/pwd.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type {struct passwd}
 element {struct passwd} {char*} pw_name
 element {struct passwd} uid_t pw_uid
@@ -18,7 +18,7 @@ function {struct passwd*} getpwnam (const char*)
 function {struct passwd*} getpwuid (uid_t)
 function int getpwnam_r (const char*, struct passwd*, char*, size_t, struct passwd**)
 function int getpwuid_r (uid_t, struct passwd*, char*, size_t, struct passwd**)
-# ifndef POSIX2008
+# if !defined POSIX && !defined POSIX2008
 function void endpwent (void)
 function {struct passwd*} getpwent (void)
 function void setpwent (void)
diff --git a/conform/data/regex.h-data b/conform/data/regex.h-data
index 73e06a8266..2822f0b398 100644
--- a/conform/data/regex.h-data
+++ b/conform/data/regex.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type regex_t
 element regex_t size_t re_nsub
 
@@ -28,7 +28,7 @@ constant REG_EBRACE
 constant REG_BADBR
 constant REG_ESPACE
 constant REG_BADRPT
-# if !defined XOPEN2K8 && !defined POSIX2008
+# if !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
 constant REG_ENOSYS
 # endif
 
diff --git a/conform/data/sched.h-data b/conform/data/sched.h-data
index 585145011a..78eb2e4d78 100644
--- a/conform/data/sched.h-data
+++ b/conform/data/sched.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type {struct sched_param}
 element {struct sched_param} int sched_priority
 optional-element {struct sched_param} int sched_ss_low_priority
diff --git a/conform/data/search.h-data b/conform/data/search.h-data
index dadb1ff71c..3abbc6690f 100644
--- a/conform/data/search.h-data
+++ b/conform/data/search.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 type ENTRY
 type {struct entry}
 element {struct entry} {char*} key
diff --git a/conform/data/semaphore.h-data b/conform/data/semaphore.h-data
index 5484884fff..9bb3d44d94 100644
--- a/conform/data/semaphore.h-data
+++ b/conform/data/semaphore.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type sem_t
 
 constant SEM_FAILED
@@ -9,7 +9,9 @@ function int sem_getvalue (sem_t*, int*)
 function int sem_init (sem_t*, int, unsigned int)
 function {sem_t*} sem_open (const char*, int, ...)
 function int sem_post (sem_t*)
+# if !defined POSIX
 function int sem_timedwait (sem_t*, const struct timespec*)
+# endif
 function int sem_trywait (sem_t*)
 function int sem_unlink (const char*)
 function int sem_wait (sem_t*)
diff --git a/conform/data/setjmp.h-data b/conform/data/setjmp.h-data
index a89a33fa73..310105b2a9 100644
--- a/conform/data/setjmp.h-data
+++ b/conform/data/setjmp.h-data
@@ -1,10 +1,10 @@
 type jmp_buf
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type sigjmp_buf
 #endif
 
 function void longjmp (jmp_buf, int)
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 function void siglongjmp (sigjmp_buf, int)
 # if !defined POSIX && !defined POSIX2008
 function void _longjmp (jmp_buf, int)
@@ -12,7 +12,7 @@ function void _longjmp (jmp_buf, int)
 #endif
 
 macro-function int setjmp (jmp_buf)
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 macro-function int sigsetjmp (sigjmp_buf, int)
 # if !defined POSIX && !defined POSIX2008
 macro-function int _setjmp (jmp_buf)
diff --git a/conform/data/signal.h-data b/conform/data/signal.h-data
index 6dbf1fb847..927211b28a 100644
--- a/conform/data/signal.h-data
+++ b/conform/data/signal.h-data
@@ -1,13 +1,15 @@
 typed-constant SIG_DFL {void(*)(int)}
 typed-constant SIG_ERR {void(*)(int)}
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 typed-constant SIG_HOLD {void(*)(int)}
 #endif
 typed-constant SIG_IGN {void(*)(int)}
 
 type sig_atomic_t
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type sigset_t
 type pid_t
+#endif
 #if defined XOPEN2K8 || defined POSIX2008
 type size_t
 type pthread_t
@@ -26,6 +28,7 @@ element {struct timespec} __time_t tv_sec
 element {struct timespec} long tv_nsec
 #endif
 
+#if defined UNIX98 || defined XOPEN2K8 || defined POSIX2008
 element {union sigval} int sival_int
 element {union sigval} {void*} sival_ptr
 
@@ -46,19 +49,25 @@ type {union sigval}
 
 macro SIGRTMIN
 macro SIGRTMAX
+#endif
 
 constant SIGABRT
-constant SIGALRM
 constant SIGFPE
-constant SIGHUP
 constant SIGILL
 constant SIGINT
+constant SIGSEGV
+constant SIGTERM
+
+function void (*signal (int, void(*)(int)))(int)
+function int raise (int)
+
+#if !defined ISO && !defined ISO99 && !defined ISO11
+constant SIGALRM
+constant SIGHUP
 constant SIGIO
 constant SIGKILL
 constant SIGPIPE
 constant SIGQUIT
-constant SIGSEGV
-constant SIGTERM
 constant SIGUSR1
 constant SIGUSR2
 constant SIGCHLD
@@ -71,9 +80,9 @@ constant SIGBUS
 constant SIGPOLL
 constant SIGPROF
 constant SIGSYS
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 constant SIGTRAP
-#endif
+# endif
 constant SIGURG
 constant SIGVTALRM
 constant SIGXCPU
@@ -90,21 +99,24 @@ constant SA_NOCLDSTOP
 constant SIG_BLOCK
 constant SIG_UNBLOCK
 constant SIG_SETMASK
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 constant SA_ONSTACK
-#endif
+# endif
+# if !defined POSIX
 constant SA_RESETHAND
 constant SA_RESTART
 constant SA_SIGINFO
 constant SA_NOCLDWAIT
 constant SA_NODEFER
-#if !defined POSIX && !defined POSIX2008
+# endif
+# if !defined POSIX && !defined POSIX2008
 constant SS_ONSTACK
 constant SS_DISABLE
 constant MINSIGSTKSZ
 constant SIGSTKSZ
-#endif
+# endif
 
+# if !defined POSIX
 type ucontext_t
 
 element ucontext_t {ucontext_t*} uc_link
@@ -122,13 +134,14 @@ type {struct sigstack}
 
 element {struct sigstack} int ss_onstack
 element {struct sigstack} {void*} ss_sp
+# endif
 
 type siginfo_t
 
 element siginfo_t int si_signo
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 element siginfo_t int si_errno
-#endif
+# endif
 element siginfo_t int si_code
 element siginfo_t pid_t si_pid
 element siginfo_t uid_t si_uid
@@ -178,50 +191,50 @@ constant SI_TIMER
 constant SI_ASYNCIO
 constant SI_MESGQ
 
-#if !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
+# if !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
 function void (*bsd_signal (int, void(*)(int)))(int)
-#endif
+# endif
 function int kill (pid_t, int)
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 function int killpg (pid_t, int)
-#endif
+# endif
 function int pthread_kill (pthread_t, int)
 function int pthread_sigmask (int, const sigset_t*, sigset_t*)
-function int raise (int)
 function int sigaction (int, const struct sigaction*, struct sigaction*)
 function int sigaddset (sigset_t*, int)
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 function int sigaltstack (const stack_t*, stack_t*)
-#endif
+# endif
 function int sigdelset (sigset_t*, int)
 function int sigemptyset (sigset_t*)
 function int sigfillset (sigset_t*)
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 function int sighold (int)
 function int sigignore (int)
 function int siginterrupt (int, int)
-#endif
+# endif
 function int sigismember (const sigset_t*, int)
-function void (*signal (int, void(*)(int)))(int)
 #if !defined POSIX && !defined POSIX2008
 function int sigpause (int)
-#endif
+# endif
 function int sigpending (sigset_t*)
 function int sigprocmask (int, const sigset_t*, sigset_t*)
 function int sigqueue (pid_t, int, const union sigval)
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 function int sigrelse (int)
 function void (*sigset (int, void(*)(int)))(int)
-#endif
+# endif
+# if !defined POSIX
 function int sigstack (struct sigstack*, struct sigstack*)
+# endif
 function int sigsuspend (const sigset_t*)
 function int sigtimedwait (const sigset_t*, siginfo_t*, const struct timespec*)
 function int sigwait (const sigset_t*, int*)
 function int sigwaitinfo (const sigset_t*, siginfo_t*)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function void psiginfo (const siginfo_t*, const char*)
 function void psignal (int, const char*)
-#endif
+# endif
 
 // The following expressions are not entirely correct but the current
 // poorfnmatch implementation doesn't grok the right form.
@@ -248,3 +261,7 @@ allow TRAP_*
 allow *_t
 
 allow-header time.h
+#endif
+
+allow SIG[ABCDEFGHIJKLMNOPQRSTUVWXYZ]*
+allow SIG_*
diff --git a/conform/data/spawn.h-data b/conform/data/spawn.h-data
index 81f32d0308..889b5bc7db 100644
--- a/conform/data/spawn.h-data
+++ b/conform/data/spawn.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type posix_spawnattr_t
 type posix_spawn_file_actions_t
 # if defined XOPEN2K8 || defined POSIX2008
diff --git a/conform/data/stdarg.h-data b/conform/data/stdarg.h-data
index ee228d0cd0..a9b5d6532b 100644
--- a/conform/data/stdarg.h-data
+++ b/conform/data/stdarg.h-data
@@ -4,6 +4,9 @@ type va_list
 macro va_start
 macro va_arg
 macro va_end
+
+#if defined ISO99 || defined ISO11 || defined POSIX2008 || defined XOPEN2K8
 macro va_copy
+#endif
 
 allow *_t
diff --git a/conform/data/stdio.h-data b/conform/data/stdio.h-data
index cba7721d9a..ac2dfc4215 100644
--- a/conform/data/stdio.h-data
+++ b/conform/data/stdio.h-data
@@ -6,9 +6,11 @@ constant _IOFBF
 constant _IOLBF
 constant _IONBF
 
+#if !defined ISO && !defined ISO99 && !defined ISO11
 constant L_ctermid
-#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
+# if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
 constant L_cuserid
+# endif
 #endif
 constant L_tmpnam
 
@@ -22,7 +24,7 @@ constant EOF
 
 constant NULL
 
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 constant P_tmpdir
 #endif
 
@@ -32,7 +34,11 @@ macro stderr
 
 type FILE
 type fpos_t
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type va_list
+#else
+#define va_list _G_va_list
+#endif
 type size_t
 #if defined XOPEN2K8 || defined POSIX2008
 type off_t
@@ -40,23 +46,31 @@ type ssize_t
 #endif
 
 function void clearerr (FILE*)
+#if !defined ISO && !defined ISO99 && !defined ISO11
 function {char*} ctermid (char*)
-#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
+# if defined XPG3 || defined XPG4 || defined UNIX98
 function {char*} cuserid (char*)
+# endif
 #endif
 #if defined XOPEN2K8 || defined POSIX2008
 function int dprintf (int, const char*, ...)
 #endif
 function int fclose (FILE*)
+#if defined XOPEN2K8 || defined POSIX2008
 function {FILE*} fdopen (int, const char*)
+#endif
 function int feof (FILE*)
 function int ferror (FILE*)
 function int fflush (FILE*)
 function int fgetc (FILE*)
 function int fgetpos (FILE*, fpos_t*)
 function {char*} fgets (char*, int, FILE*)
+#if !defined ISO && !defined ISO99 && !defined ISO11
 function int fileno (FILE*)
+#endif
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function void flockfile (FILE*)
+#endif
 #if defined XOPEN2K8 || defined POSIX2008
 function {FILE*} fmemopen (void*, size_t, const char*)
 #endif
@@ -68,41 +82,57 @@ function size_t fread (void*, size_t, size_t, FILE*)
 function {FILE*} freopen (const char*, const char*, FILE*)
 function int fscanf (FILE*, const char*, ...)
 function int fseek (FILE*, long int, int)
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function int fseeko (FILE*, off_t, int)
+#endif
 function int fsetpos (FILE*, const fpos_t*)
 function {long int} ftell (FILE*)
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function off_t ftello (FILE*)
+#endif
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function int ftrylockfile (FILE*)
 function void funlockfile (FILE*)
+#endif
 function size_t fwrite (const void*, size_t, size_t, FILE*)
 function int getc (FILE*)
 function int getchar (void)
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function int getc_unlocked (FILE*)
 function int getchar_unlocked ()
+#endif
 #if defined XOPEN2K8 || defined POSIX2008
 function ssize_t getdelim (char**, size_t*, int, FILE*)
 function ssize_t getline (char**, size_t*, FILE*)
 #endif
-#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
+#if defined XPG3 || defined XPG4 || defined UNIX98
 function int getopt (int, char *const[], const char *)
 #endif
+#if !defined ISO11
 function {char*} gets (char*)
-#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
+#endif
+#if defined XPG3 || defined XPG4 || defined UNIX98
 function int getw (FILE*)
 #endif
 #if defined XOPEN2K8 || defined POSIX2008
 function {FILE*} open_memstream (char**, size_t*)
 #endif
+#if !defined ISO && !defined ISO99 && !defined ISO11
 function int pclose (FILE*)
+#endif
 function void perror (const char*)
+#if !defined ISO && !defined ISO99 && !defined ISO11
 function {FILE*} popen (const char*, const char*)
+#endif
 function int printf (const char*, ...)
 function int putc (int, FILE*)
 function int putchar (int)
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function int putc_unlocked (int, FILE*)
 function int putchar_unlocked (int)
+#endif
 function int puts (const char*)
-#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
+#if defined XPG3 || defined XPG4 || defined UNIX98
 function int putw (int, FILE*)
 #endif
 function int remove (const char*)
@@ -114,10 +144,12 @@ function void rewind (FILE*)
 function int scanf (const char*, ...)
 function void setbuf (FILE*, char*)
 function int setvbuf (FILE*, char*, int, size_t)
+#if !defined ISO && !defined POSIX
 function int snprintf (char*, size_t, const char*, ...)
+#endif
 function int sprintf (char *, const char *, ...)
 function int sscanf (const char*, const char*, ...)
-#if !defined POSIX && !defined POSIX2008
+#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K || defined XOPEN2K8
 function {char*} tempnam (const char*, const char*)
 #endif
 function {FILE*} tmpfile (void)
@@ -127,20 +159,22 @@ function int ungetc (int, FILE*)
 function int vdprintf (int, const char*, va_list)
 #endif
 function int vfprintf (FILE*, const char*, va_list)
-#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
+#if !defined ISO && !defined XPG3 && !defined XPG4 && !defined UNIX98
 function int vfscanf (FILE*, const char*, va_list)
 #endif
 function int vprintf (const char*, va_list)
-#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
+#if !defined ISO && !defined XPG3 && !defined XPG4 && !defined UNIX98
 function int vscanf (const char*, va_list)
 #endif
+#ifndef ISO
 function int vsnprintf (char*, size_t, const char*, va_list)
+#endif
 function int vsprintf (char*, const char*, va_list)
-#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
+#if !defined ISO && !defined XPG3 && !defined XPG4 && !defined UNIX98
 function int vsscanf (const char*, const char*, va_list)
 #endif
 
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 #if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
 variable {char*} optarg
 variable int opterr
diff --git a/conform/data/stdlib.h-data b/conform/data/stdlib.h-data
index 760b5b3b4c..e6abfed3e3 100644
--- a/conform/data/stdlib.h-data
+++ b/conform/data/stdlib.h-data
@@ -1,15 +1,17 @@
-macro EXIT_FAILURE
-constant EXIT_SUCCESS 0
-macro NULL
-constant RAND_MAX >= 32767
-macro MB_CUR_MAX
-
 type div_t
 element div_t int quot
 element div_t int rem
 type ldiv_t
 element ldiv_t long quot
 element ldiv_t long rem
+
+macro EXIT_FAILURE
+macro EXIT_SUCCESS 0
+
+macro NULL
+constant RAND_MAX >= 32767
+macro MB_CUR_MAX
+
 #if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 type lldiv_t
 element lldiv_t {long long} quot
@@ -18,6 +20,7 @@ element lldiv_t {long long} rem
 type size_t
 type wchar_t
 
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 constant WNOHANG
 constant WUNTRACED
 
@@ -27,58 +30,69 @@ macro WIFSIGNALED
 macro WIFSTOPPED
 macro WSTOPSIG
 macro WTERMSIG
+#endif
 
+#if !defined ISO && !defined XPG3 && !defined XPG4 && !defined UNIX98 && !defined POSIX
 function void _Exit (int)
-#if !defined POSIX && !defined POSIX2008
+#endif
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function long a64l (const char*)
 #endif
 function void abort (void)
 function int abs (int)
+#if defined ISO11
+function {void *} aligned_alloc (size_t, size_t)
+#endif
 function int atexit (void(*)(void))
+#if defined ISO11
+function int at_quick_exit (void (*) (void))
+#endif
 function double atof (const char*)
 function int atoi (const char*)
 function {long int} atol (const char*)
-#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
+#if !defined ISO && !defined POSIX && !defined XPG3 && !defined XPG4 && !defined UNIX98
 function {long long} atoll (const char*)
 #endif
 function {void*} bsearch (const void*, const void*, size_t, size_t, int(*)(const void*, const void*))
 function {void*} calloc (size_t, size_t)
 function div_t div (int, int)
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function double drand48 (void)
 #endif
-#if !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
+#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K
 function {char*} ecvt (double, int, int*, int*)
 #endif
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function double erand48 (unsigned short int[3])
 #endif
 function void exit (int)
-#if !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
+#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K
 function {char*} fcvt (double, int, int*, int*)
 #endif
 function void free (void*)
-#if !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
+#if defined XPG3 || defined XPG4 || defined UNIX98 || defined XOPEN2K
 function {char*} gcvt (double, int, char*)
 #endif
 function {char*} getenv (const char*)
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 function int getsubopt (char**, char *const*, char**)
-#if !defined POSIX && !defined POSIX2008
+#endif
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function int grantpt (int)
 function {char*} initstate (unsigned int, char*, size_t)
 function {long int} jrand48 (unsigned short int[3])
 function {char*} l64a (long)
 #endif
 function {long int} labs (long int)
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function void lcong48 (unsigned short int[7])
 #endif
 function ldiv_t ldiv (long int, long int)
-#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
+#if !defined ISO && !defined POSIX && !defined XPG3 && !defined XPG4 && !defined UNIX98
 function {long long} llabs (long long)
 function lldiv_t lldiv (long long, long long)
 #endif
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function {long int} lrand48 (void)
 #endif
 function {void*} malloc (size_t)
@@ -88,40 +102,51 @@ function int mbtowc (wchar_t*, const char*, size_t)
 #if defined XOPEN2K8 || defined POSIX2008
 function {char*} mkdtemp (char*)
 #endif
-#if !defined XOPEN2K8 && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
 function {char*} mktemp (char*)
 #endif
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 function int mkstemp (char*)
-#if !defined POSIX && !defined POSIX2008
+#endif
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function {long int} mrand48 (void)
 function {long int} nrand48 (unsigned short int[3])
 #endif
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function int posix_memalign (void**, size_t, size_t)
+#endif
 #if defined XOPEN2K || defined XOPEN2K8
 function int posix_openpt (int)
 #endif
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function {char*} ptsname (int)
 function int putenv (char*)
 #endif
 function void qsort (void*, size_t, size_t, int(*)(const void*, const void*))
+#if defined ISO11
+function void quick_exit (int)
+#endif
 function int rand (void)
+#if defined POSIX || defined UNIX98 || defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function int rand_r (unsigned int*)
-#if !defined POSIX && !defined POSIX2008
+#endif
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function long random (void)
 #endif
 function {void*} realloc (void*, size_t)
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function {char*} realpath (const char*, char*)
 function {unsigned short int*} seed48 (unsigned short int[3])
 #endif
+#if !defined ISO && !defined ISO99 && !defined ISO11
 function int setenv (const char*, const char*, int)
-#if !defined POSIX && !defined POSIX2008
+#endif
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function void setkey (const char*)
 function {char*} setstate (char*)
 #endif
 function void srand (unsigned int)
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function void srand48 (long int)
 function void srandom (unsigned)
 #endif
@@ -129,14 +154,16 @@ function double strtod (const char*, char**)
 function {long int} strtol (const char*, char**, int)
 function {unsigned long int} strtoul (const char*, char**, int)
 function int system (const char*)
-#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
+#if defined XPG3 || defined XPG4 || defined UNIX98
 function int ttyslot (void)
 #endif
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function int unlockpt (int)
 #endif
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 function int unsetenv (const char*)
-#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX && !defined POSIX2008
+#endif
+#if defined XPG3 || defined XPG4 || defined UNIX98
 function {void*} valloc (size_t)
 #endif
 function size_t wcstombs (char*, const wchar_t*, size_t)
diff --git a/conform/data/string.h-data b/conform/data/string.h-data
index 1c4ae0814e..0403c2e328 100644
--- a/conform/data/string.h-data
+++ b/conform/data/string.h-data
@@ -5,7 +5,7 @@ type size_t
 type locale_t
 #endif
 
-#if !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 & !defined ISO11 && !defined POSIX && !defined POSIX2008
 function {void*} memccpy (void*, const void*, int, size_t)
 #endif
 function {void*} memchr (const void*, int, size_t)
@@ -27,7 +27,9 @@ function int strcoll_l (const char*, const char*, locale_t)
 #endif
 function {char*} strcpy (char*, const char*)
 function size_t strcspn (const char*, const char*)
+#if !defined ISO && !defined ISO99 & !defined ISO11 && !defined POSIX && !defined POSIX2008
 function {char*} strdup (const char*)
+#endif
 function {char*} strerror (int)
 #if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function int strerror_r (int, char*, size_t)
@@ -51,7 +53,9 @@ function {char*} strsignal (int)
 function size_t strspn (const char*, const char*)
 function {char*} strstr (const char*, const char*)
 function {char*} strtok (char*, const char*)
+#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
 function {char*} strtok_r (char*, const char*, char**)
+#endif
 function size_t strxfrm (char*, const char*, size_t)
 #if defined XOPEN2K8 || defined POSIX2008
 function size_t strxfrm_l (char*, const char*, size_t, locale_t)
diff --git a/conform/data/strings.h-data b/conform/data/strings.h-data
index 01cd867426..b61ac50e6f 100644
--- a/conform/data/strings.h-data
+++ b/conform/data/strings.h-data
@@ -1,23 +1,25 @@
-#if !defined XOPEN2K8 && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
+# if !defined XOPEN2K8 && !defined POSIX2008
 function int bcmp (const void*, const void*, size_t)
 function void bcopy (const void*, void*, size_t)
 function void bzero (void*, size_t)
 function {char*} index (const char*, int)
 function {char*} rindex (const char*, int)
-#endif
-#if !defined POSIX && !defined POSIX2008
+# endif
+# if !defined POSIX2008
 function int ffs (int)
-#endif
+# endif
 function int strcasecmp (const char*, const char*)
 function int strncasecmp (const char*, const char*, size_t)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function int strcasecmp_l (const char*, const char*, locale_t)
 function int strncasecmp_l (const char*, const char*, size_t, locale_t)
-#endif
+# endif
 
 type size_t
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 type locale_t
-#endif
+# endif
 
 allow *_t
+#endif
diff --git a/conform/data/stropts.h-data b/conform/data/stropts.h-data
index c760282046..882f916cc3 100644
--- a/conform/data/stropts.h-data
+++ b/conform/data/stropts.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type {struct bandinfo}
 
 element {struct bandinfo} {unsigned char} bi_pri
@@ -135,3 +136,4 @@ allow S_*
 allow SND*
 allow STR*
 allow *_t
+#endif
diff --git a/conform/data/sys/ipc.h-data b/conform/data/sys/ipc.h-data
index 28918c196d..8f06d2ba0a 100644
--- a/conform/data/sys/ipc.h-data
+++ b/conform/data/sys/ipc.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 type {struct ipc_perm}
 
 element {struct ipc_perm} uid_t uid
diff --git a/conform/data/sys/mman.h-data b/conform/data/sys/mman.h-data
index c737efbc23..3392ad1324 100644
--- a/conform/data/sys/mman.h-data
+++ b/conform/data/sys/mman.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined ISO99 && !defined ISO11
 constant PROT_READ
 constant PROT_WRITE
 constant PROT_EXEC
@@ -54,3 +55,4 @@ allow MCL_*
 allow MS_*
 allow PROT_*
 allow *_t
+#endif
diff --git a/conform/data/sys/msg.h-data b/conform/data/sys/msg.h-data
index ae83356b54..a8290cab52 100644
--- a/conform/data/sys/msg.h-data
+++ b/conform/data/sys/msg.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 type {struct msqid_ds}
 
 type msgqnum_t
diff --git a/conform/data/sys/resource.h-data b/conform/data/sys/resource.h-data
index 52f83f523b..67517adeda 100644
--- a/conform/data/sys/resource.h-data
+++ b/conform/data/sys/resource.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 constant PRIO_PROCESS
 constant PRIO_PGRP
 constant PRIO_USER
diff --git a/conform/data/sys/select.h-data b/conform/data/sys/select.h-data
index ea890d6ae9..84e07e9729 100644
--- a/conform/data/sys/select.h-data
+++ b/conform/data/sys/select.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type time_t
 type suseconds_t
 
diff --git a/conform/data/sys/sem.h-data b/conform/data/sys/sem.h-data
index 665b397c58..61eecf2951 100644
--- a/conform/data/sys/sem.h-data
+++ b/conform/data/sys/sem.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 constant SEM_UNDO
 
 constant GETNCNT
diff --git a/conform/data/sys/shm.h-data b/conform/data/sys/shm.h-data
index 39df8944ab..a006cdbb92 100644
--- a/conform/data/sys/shm.h-data
+++ b/conform/data/sys/shm.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 constant SHM_RDONLY
 symbol SHMLBA
 constant SHM_RND
diff --git a/conform/data/sys/socket.h-data b/conform/data/sys/socket.h-data
index 5fdd6cf6bf..60d8b00a74 100644
--- a/conform/data/sys/socket.h-data
+++ b/conform/data/sys/socket.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type socklen_t
 
 type sa_family_t
diff --git a/conform/data/sys/stat.h-data b/conform/data/sys/stat.h-data
index b0e10a4c7f..547f607b1f 100644
--- a/conform/data/sys/stat.h-data
+++ b/conform/data/sys/stat.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 
 type {struct stat}
 
diff --git a/conform/data/sys/statvfs.h-data b/conform/data/sys/statvfs.h-data
index d7312cdb87..750f22b4e1 100644
--- a/conform/data/sys/statvfs.h-data
+++ b/conform/data/sys/statvfs.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type {struct statvfs}
 
 element {struct statvfs} {unsigned long} f_bsize
@@ -24,3 +25,4 @@ function int fstatvfs (int, struct statvfs*)
 allow f_*
 allow ST_*
 allow *_t
+#endif
diff --git a/conform/data/sys/time.h-data b/conform/data/sys/time.h-data
index 7e3407ab07..98e590989c 100644
--- a/conform/data/sys/time.h-data
+++ b/conform/data/sys/time.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 type {struct timeval}
 
 element {struct timeval} time_t tv_sec
diff --git a/conform/data/sys/timeb.h-data b/conform/data/sys/timeb.h-data
index d012f5d69a..460da6ee8c 100644
--- a/conform/data/sys/timeb.h-data
+++ b/conform/data/sys/timeb.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type {struct timeb}
 
 element {struct timeb} time_t time
@@ -10,3 +11,4 @@ type time_t
 function int ftime (struct timeb*)
 
 allow *_t
+#endif
diff --git a/conform/data/sys/times.h-data b/conform/data/sys/times.h-data
index 9c3237eb83..d10444d359 100644
--- a/conform/data/sys/times.h-data
+++ b/conform/data/sys/times.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type {struct tms}
 
 element {struct tms} clock_t tms_utime
@@ -11,3 +12,4 @@ function clock_t times (struct tms*)
 
 allow tms_*
 allow *_t
+#endif
diff --git a/conform/data/sys/types.h-data b/conform/data/sys/types.h-data
index 4070be5c59..2befff56a1 100644
--- a/conform/data/sys/types.h-data
+++ b/conform/data/sys/types.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type blkcnt_t
 type blksize_t
 type clock_t
diff --git a/conform/data/sys/uio.h-data b/conform/data/sys/uio.h-data
index 03d0a3bf3a..3352695104 100644
--- a/conform/data/sys/uio.h-data
+++ b/conform/data/sys/uio.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type {struct iovec}
 
 element {struct iovec} {void*} iov_base
diff --git a/conform/data/sys/un.h-data b/conform/data/sys/un.h-data
index bb976f2b0b..ee157ed5f8 100644
--- a/conform/data/sys/un.h-data
+++ b/conform/data/sys/un.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type {struct sockaddr_un}
 
 element {struct sockaddr_un} sa_family_t sun_family
diff --git a/conform/data/sys/utsname.h-data b/conform/data/sys/utsname.h-data
index 680b666b1d..3564627394 100644
--- a/conform/data/sys/utsname.h-data
+++ b/conform/data/sys/utsname.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type {struct utsname}
 
 element {struct utsname} char sysname []
diff --git a/conform/data/sys/wait.h-data b/conform/data/sys/wait.h-data
index 2fd4c8decf..56dea06cfd 100644
--- a/conform/data/sys/wait.h-data
+++ b/conform/data/sys/wait.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 constant WNOHANG
 constant WUNTRACED
 
diff --git a/conform/data/syslog.h-data b/conform/data/syslog.h-data
index f0aa65c693..26fef76ac1 100644
--- a/conform/data/syslog.h-data
+++ b/conform/data/syslog.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 constant LOG_PID
 constant LOG_CONS
 constant LOG_NDELAY
diff --git a/conform/data/tar.h-data b/conform/data/tar.h-data
index fcbfb127b4..aa0cebc3f1 100644
--- a/conform/data/tar.h-data
+++ b/conform/data/tar.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 macro-str TMAGIC "ustar"
 constant TMAGLEN 6
 macro-str TVERSION "00"
diff --git a/conform/data/termios.h-data b/conform/data/termios.h-data
index d32bd6bf3c..3f7ab4b321 100644
--- a/conform/data/termios.h-data
+++ b/conform/data/termios.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type cc_t
 type speed_t
 type tcflag_t
@@ -39,7 +39,7 @@ constant INPCK
 constant ISTRIP
 # if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
 constant IUCLC
-# <endif
+# endif
 constant IXANY
 constant IXOFF
 constant IXON
@@ -118,7 +118,7 @@ constant IEXTEN
 constant ISIG
 constant NOFLSH
 constant TOSTOP
-# if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
+# if !defined POSIX && !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
 constant XCASE
 # endif
 
@@ -142,7 +142,9 @@ function int tcdrain (int)
 function int tcflow (int, int)
 function int tcflush (int, int)
 function int tcgetattr (int, struct termios*)
+#ifndef POSIX
 function pid_t tcgetsid (int)
+#endif
 function int tcsendbreak (int, int)
 function int tcsetattr (int, int, const struct termios*)
 
diff --git a/conform/data/time.h-data b/conform/data/time.h-data
index e2ff298ea7..1e089d07f1 100644
--- a/conform/data/time.h-data
+++ b/conform/data/time.h-data
@@ -1,3 +1,21 @@
+constant NULL
+constant CLOCKS_PER_SEC
+
+#ifdef ISO11
+macro TIME_UTC
+#endif
+
+#if !defined ISO && !defined ISO99
+type {struct timespec}
+
+element {struct timespec} time_t tv_sec
+element {struct timespec} long tv_nsec
+#endif
+
+type size_t
+type clock_t
+type time_t
+
 type {struct tm}
 
 element {struct tm} int tm_sec
@@ -10,19 +28,26 @@ element {struct tm} int tm_wday
 element {struct tm} int tm_yday
 element {struct tm} int tm_isdst
 
-constant NULL
-#if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008
-constant CLK_TCK
+function clock_t clock (void)
+function double difftime (time_t, time_t)
+function time_t mktime (struct tm*)
+function time_t time (time_t*)
+function {char*} asctime (const struct tm*)
+function {char*} ctime (const time_t*)
+function {struct tm*} gmtime (const time_t*)
+function {struct tm*} localtime (const time_t*)
+function size_t strftime (char*, size_t, const char*, const struct tm*)
+#if defined ISO11
+function int timespec_get (struct timespec *, int)
 #endif
-constant CLOCKS_PER_SEC
+
+#if !defined ISO && !defined ISO99 && !defined ISO11
+# if !defined XOPEN21K && !defined XOPEN2K8 && !defined POSIX2008
+constant CLK_TCK
+# endif
 constant CLOCK_PROCESS_CPUTIME_ID
 constant CLOCK_THREAD_CPUTIME_ID
 
-type {struct timespec}
-
-element {struct timespec} time_t tv_sec
-element {struct timespec} long tv_nsec
-
 type {struct itimerspec}
 
 element {struct itimerspec} {struct timespec} it_interval
@@ -32,50 +57,38 @@ constant CLOCK_REALTIME
 constant TIMER_ABSTIME
 constant CLOCK_MONOTONIC
 
-type clock_t
 type clockid_t
-type size_t
-type time_t
 type timer_t
 
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 type pid_t
 type locale_t
 tag {struct sigevent}
-#endif
+# endif
 
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 variable int getdate_err
-#endif
+# endif
 
-function {char*} asctime (const struct tm*)
 function {char*} asctime_r (const struct tm*, char*)
-function clock_t clock (void)
 function int clock_getcpuclockid (pid_t, clockid_t*)
 function int clock_getres (clockid_t, struct timespec*)
 function int clock_gettime (clockid_t, struct timespec*)
 function int clock_nanosleep (clockid_t, int, const struct timespec*, struct timespec*)
 function int clock_settime (clockid_t, const struct timespec*)
-function {char*} ctime (const time_t*)
 function {char*} ctime_r (const time_t*, char*)
-function double difftime (time_t, time_t)
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 function {struct tm*} getdate (const char*)
-#endif
-function {struct tm*} gmtime (const time_t*)
+# endif
 function {struct tm*} gmtime_r (const time_t*, struct tm*)
-function {struct tm*} localtime (const time_t*)
 function {struct tm*} localtime_r (const time_t*, struct tm*)
-function time_t mktime (struct tm*)
 function int nanosleep (const struct timespec*, struct timespec*)
-function size_t strftime (char*, size_t, const char*, const struct tm*)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function size_t strftime_l (char*, size_t, const char*, const struct tm*, locale_t)
-#endif
-#if !defined POSIX && !defined POSIX2008
+# endif
+# if !defined POSIX && !defined POSIX2008
 function {char*} strptime (const char*, const char*, struct tm*)
-#endif
-function time_t time (time_t*)
+# endif
 function int timer_create (clockid_t, struct sigevent*, timer_t*)
 function int timer_delete (timer_t)
 function int timer_gettime (timer_t, struct itimerspec*)
@@ -83,10 +96,10 @@ function int timer_getoverrun (timer_t)
 function int timer_settime (timer_t, int, const struct itimerspec*, struct itimerspec*)
 function void tzset (void)
 
-#if !defined POSIX && !defined POSIX2008
+# if !defined POSIX && !defined POSIX2008
 variable int daylight
 variable {long int} timezone
-#endif
+# endif
 variable {char*} tzname [2]
 
 allow tm_*
@@ -98,3 +111,4 @@ allow CLOCK_*
 allow TIMER_*
 allow *_t
 allow sigevent
+#endif
diff --git a/conform/data/uchar.h-data b/conform/data/uchar.h-data
new file mode 100644
index 0000000000..487d755fdb
--- /dev/null
+++ b/conform/data/uchar.h-data
@@ -0,0 +1,12 @@
+#if defined ISO11
+type mbstate_t
+type size_t
+type char16_t
+type char32_t
+
+function size_t mbrtoc16 (char16_t *, const char *, size_t, mbstate_t *)
+function size_t c16rtomb (char *, char16_t, mbstate_t *)16
+function size_t mbrtoc32 (char32_t *, const char *, size_t, mbstate_t *)
+function size_t c32rtomb (char *, char32_t, mbstate_t *)
+
+#endif
diff --git a/conform/data/ucontext.h-data b/conform/data/ucontext.h-data
index 3540fdd27f..2b5f3b4a6f 100644
--- a/conform/data/ucontext.h-data
+++ b/conform/data/ucontext.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX
 type mcontext_t
 
 type ucontext_t
@@ -18,3 +19,4 @@ function int swapcontext (ucontext_t*, const ucontext_t*)
 allow uc_*
 allow ss_*
 allow *_t
+#endif
diff --git a/conform/data/ulimit.h-data b/conform/data/ulimit.h-data
index 9e7e6f4e9a..1e5e5b471d 100644
--- a/conform/data/ulimit.h-data
+++ b/conform/data/ulimit.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 constant UL_GETFSIZE
 constant UL_SETFSIZE
 
diff --git a/conform/data/unistd.h-data b/conform/data/unistd.h-data
index 72fbdd62b9..ecefa539f2 100644
--- a/conform/data/unistd.h-data
+++ b/conform/data/unistd.h-data
@@ -1,4 +1,4 @@
-#ifndef ISO
+#if !defined ISO && !defined ISO99 && !defined ISO11
 optional-constant _POSIX_VERSION
 optional-constant _POSIX2_C_VERSION
 optional-constant _XOPEN_VERSION
diff --git a/conform/data/utime.h-data b/conform/data/utime.h-data
index 15d4487055..aab9039f38 100644
--- a/conform/data/utime.h-data
+++ b/conform/data/utime.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type {struct utimbuf}
 
 element {struct utimbuf} time_t actime
@@ -9,3 +10,4 @@ function int utime (const char*, const struct utimbuf*)
 
 allow utim_*
 allow *_t
+#endif
diff --git a/conform/data/utmpx.h-data b/conform/data/utmpx.h-data
index af3c229fc0..b9dd0d5a59 100644
--- a/conform/data/utmpx.h-data
+++ b/conform/data/utmpx.h-data
@@ -1,4 +1,4 @@
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 type {struct utmpx}
 
 element {struct utmpx} char ut_user []
diff --git a/conform/data/varargs.h-data b/conform/data/varargs.h-data
index 11dc38c2ab..a486b72603 100644
--- a/conform/data/varargs.h-data
+++ b/conform/data/varargs.h-data
@@ -1,3 +1,4 @@
+#if defined XPG3 || defined XPG4
 macro va_alist
 macro va_dcl
 type va_list
@@ -6,3 +7,4 @@ macro va_arg
 macro va_end
 
 allow *_t
+#endif
diff --git a/conform/data/wchar.h-data b/conform/data/wchar.h-data
index bf9e1a92e5..fdb68d03b9 100644
--- a/conform/data/wchar.h-data
+++ b/conform/data/wchar.h-data
@@ -1,19 +1,24 @@
+#if !defined ISO && !defined POSIX && !defined XPG3 && !defined XPG4
 type wchar_t
 type wint_t
-# if !defined ISO && !defined POSIX && !defined POSIX2008
+# if !defined ISO99 && !defined ISO11 && !defined POSIX2008
 type wctype_t
-#endif
+# endif
 type mbstate_t
+# if !defined ISO99 && !defined ISO11
 type FILE
+# else
+#  define FILE __FILE
+# endif
 type size_t
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 type locale_t
-#endif
+# endif
 
 function wint_t btowc (int)
 function int fwprintf (FILE*, const wchar_t*, ...)
 function int fwscanf (FILE*, const wchar_t*, ...)
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+# if !defined ISO99 && !defined ISO11 && !defined POSIX2008
 function int iswalnum (wint_t)
 function int iswalpha (wint_t)
 function int iswcntrl (wint_t)
@@ -26,7 +31,7 @@ function int iswspace (wint_t)
 function int iswupper (wint_t)
 function int iswxdigit (wint_t)
 function int iswctype (wint_t, wctype_t)
-#endif
+# endif
 function wint_t fgetwc (FILE*)
 function {wchar_t*} fgetws (wchar_t*, int, FILE*)
 function wint_t fputwc (wchar_t, FILE*)
@@ -37,21 +42,21 @@ function wint_t getwchar (void)
 function int mbsinit (const mbstate_t*)
 function size_t mbrlen (const char*, size_t, mbstate_t*)
 function size_t mbrtowc (wchar_t*, const char*, size_t, mbstate_t*)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function size_t mbsnrtowcs (wchar_t*, const char**, size_t, size_t, mbstate_t*)
-#endif
+# endif
 function size_t mbsrtowcs (wchar_t*, const char**, size_t, mbstate_t*)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function {FILE*} open_wmemstream (wchar_t**, size_t*)
-#endif
+# endif
 function wint_t putwc (wchar_t, FILE*)
 function wint_t putwchar (wchar_t)
 function int swprintf (wchar_t*, size_t, const wchar_t*, ...)
 function int swscanf (const wchar_t*, const wchar_t*, ...)
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+# if !defined ISO99 && !defined ISO11 && !defined POSIX2008
 function wint_t towlower (wint_t)
 function wint_t towupper (wint_t)
-#endif
+# endif
 function wint_t ungetwc (wint_t, FILE*)
 function int vfwprintf (FILE*, const wchar_t*, __gnuc_va_list)
 function int vfwscanf (FILE*, const wchar_t*, __gnuc_va_list)
@@ -59,40 +64,40 @@ function int vwprintf (const wchar_t*, __gnuc_va_list)
 function int vwscanf (const wchar_t*, __gnuc_va_list)
 function int vswprintf (wchar_t*, size_t, const wchar_t*, __gnuc_va_list)
 function int vswscanf (const wchar_t*, const wchar_t*, __gnuc_va_list)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function {wchar_t*} wcpcpy (wchar_t*, const wchar_t*)
 function {wchar_t*} wcpncpy (wchar_t*, const wchar_t*, size_t)
-#endif
+# endif
 function size_t wcrtomb (char*, wchar_t, mbstate_t*)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function int wcscasecmp(const wchar_t*, const wchar_t*)
 function int wcscasecmp_l(const wchar_t*, const wchar_t*, locale_t)
-#endif
+# endif
 function {wchar_t*} wcscat (wchar_t*, const wchar_t*)
 function {wchar_t*} wcschr (const wchar_t*, wchar_t)
 function int wcscmp (const wchar_t*, const wchar_t*)
 function int wcscoll (const wchar_t*, const wchar_t*)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function int wcscoll_l (const wchar_t*, const wchar_t*, locale_t)
-#endif
+# endif
 function {wchar_t*} wcscpy (wchar_t*, const wchar_t*)
 function size_t wcscspn (const wchar_t*, const wchar_t*)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function {wchar_t*} wcsdup (const wchar_t*)
-#endif
+# endif
 function size_t wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*)
 function size_t wcslen (const wchar_t*)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function int wcsncasecmp (const wchar_t*, const wchar_t*, size_t)
 function int wcsncasecmp_l (const wchar_t*, const wchar_t*, size_t, locale_t)
-#endif
+# endif
 function {wchar_t*} wcsncat (wchar_t*, const wchar_t*, size_t)
 function int wcsncmp (const wchar_t*, const wchar_t*, size_t)
 function {wchar_t*} wcsncpy (wchar_t*, const wchar_t*, size_t)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function size_t wcsnlen (const wchar_t*, size_t)
 function size_t wcsnrtombs (char*, const wchar_t**, size_t, size_t, mbstate_t*)
-#endif
+# endif
 function {wchar_t*} wcspbrk (const wchar_t*, const wchar_t*)
 function {wchar_t*} wcsrchr (const wchar_t*, wchar_t)
 function size_t wcsrtombs (char*, const wchar_t**, size_t, mbstate_t*)
@@ -102,21 +107,21 @@ function double wcstod (const wchar_t*, wchar_t**)
 function {wchar_t*} wcstok (wchar_t*, const wchar_t*, wchar_t**)
 function {long int} wcstol (const wchar_t*, wchar_t**, int)
 function {unsigned long int} wcstoul (const wchar_t*, wchar_t**, int)
-#if defined UNIX98 || defined XOPEN2K
+# if defined UNIX98 || defined XOPEN2K
 function {wchar_t*} wcswcs (const wchar_t*, const wchar_t*)
-#endif
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+# endif
+# if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008
 function int wcswidth (const wchar_t*, size_t)
-#endif
+# endif
 function size_t wcsxfrm (wchar_t*, const wchar_t*, size_t)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function size_t wcsxfrm_l (wchar_t*, const wchar_t*, size_t, locale_t)
-#endif
+# endif
 function int wctob (wint_t)
-#if !defined ISO && !defined POSIX && !defined POSIX2008
+# if !defined ISO99 && !defined ISO11 && !defined POSIX2008
 function wctype_t wctype (const char*)
 function int wcwidth (wchar_t)
-#endif
+# endif
 function {wchar_t*} wmemchr (const wchar_t*, wchar_t, size_t)
 function int wmemcmp (const wchar_t*, const wchar_t*, size_t)
 function {wchar_t*} wmemcpy (wchar_t*, const wchar_t*, size_t)
@@ -140,3 +145,4 @@ allow-header time.h
 
 allow wcs*
 allow *_t
+#endif
diff --git a/conform/data/wctype.h-data b/conform/data/wctype.h-data
index a3f8c54a85..cbd1dac280 100644
--- a/conform/data/wctype.h-data
+++ b/conform/data/wctype.h-data
@@ -1,9 +1,10 @@
+#if !defined ISO && !defined POSIX && !defined XPG3 && !defined XPG4
 type wint_t
 type wctrans_t
 type wctype_t
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 type locale_t
-#endif
+# endif
 
 function int iswalnum (wint_t)
 function int iswalpha (wint_t)
@@ -22,7 +23,7 @@ function wint_t towlower (wint_t)
 function wint_t towupper (wint_t)
 function wctrans_t wctrans (const char*)
 function wctype_t wctype (const char*)
-#if defined XOPEN2K8 || defined POSIX2008
+# if defined XOPEN2K8 || defined POSIX2008
 function int iswalnum_l (wint_t, locale_t)
 function int iswalpha_l (wint_t, locale_t)
 function int iswcntrl_l (wint_t, locale_t)
@@ -40,7 +41,7 @@ function wint_t towlower_l (wint_t, locale_t)
 function wint_t towupper_l (wint_t, locale_t)
 function wctrans_t wctrans_l (const char*, locale_t)
 function wctype_t wctype_l (const char*, locale_t)
-#endif
+# endif
 
 macro WEOF
 
@@ -56,3 +57,4 @@ allow-header wchar.h
 allow is*
 allow to*
 allow *_t
+#endif
diff --git a/conform/data/wordexp.h-data b/conform/data/wordexp.h-data
index acbed7495e..821784a7fb 100644
--- a/conform/data/wordexp.h-data
+++ b/conform/data/wordexp.h-data
@@ -1,3 +1,4 @@
+#if !defined ISO && !defined ISO99 && !defined ISO11
 type wordexp_t
 
 element wordexp_t size_t we_wordc
@@ -14,9 +15,9 @@ constant WRDE_UNDEF
 constant WRDE_BADCHAR
 constant WRDE_CMDSUB
 constant WRDE_NOSPACE
-#if !defined XOPEN2K8 && !defined POSIX2008
+# if !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008
 constant WRDE_NOSYS
-#endif
+# endif
 constant WRDE_SYNTAX
 
 function int wordexp (const char*, wordexp_t*, int)
@@ -25,3 +26,4 @@ function void wordfree (wordexp_t*)
 allow WRDE_*
 allow we_*
 allow *_t
+#endif
diff --git a/conform/run-conformtest.sh b/conform/run-conformtest.sh
new file mode 100644
index 0000000000..9600524a8d
--- /dev/null
+++ b/conform/run-conformtest.sh
@@ -0,0 +1,30 @@
+#! /bin/sh
+
+objpfx="$1"
+perl="$2"
+cc="$3"
+includes="$4"
+
+standards=("ISO" "ISO99" "ISO11" "POSIX" "XPG3" "XPG4" "UNIX98"
+	   "XOPEN2K" "XOPEN2K8" "POSIX2008")
+standards=("POSIX" "XPG3" "XPG4" "UNIX98"
+	   "XOPEN2K" "XOPEN2K8" "POSIX2008")
+
+exitval=0
+> ${objpfx}run-conformtest.out
+for s in ${standards[*]}; do
+    echo -n $s...
+    e=0
+    if ! $perl conformtest.pl --cc="$cc" --flags="$includes" --standard=$s > ${objpfx}conform-$s.out; then
+	e=1
+    fi
+    printf "\n%s\n" $s >> ${objpfx}run-conformtest.out
+    tail -n 4 ${objpfx}conform-$s.out >> ${objpfx}run-conformtest.out
+    echo
+    if [ $e -ne 0 ]; then
+	tail -n 3 ${objpfx}conform-$s.out
+	exitval=1
+    fi
+done
+
+exit $exitval