about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog131
-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
-rw-r--r--include/aio.h2
-rw-r--r--include/assert.h4
-rw-r--r--include/ctype.h6
-rw-r--r--include/dirent.h4
-rw-r--r--include/dlfcn.h2
-rw-r--r--include/fcntl.h2
-rw-r--r--include/fnmatch.h2
-rw-r--r--include/glob.h2
-rw-r--r--include/grp.h2
-rw-r--r--include/libio.h2
-rw-r--r--include/locale.h2
-rw-r--r--include/math.h2
-rw-r--r--include/net/if.h2
-rw-r--r--include/netdb.h2
-rw-r--r--include/netinet/in.h2
-rw-r--r--include/pthread.h2
-rw-r--r--include/pwd.h2
-rw-r--r--include/regex.h2
-rw-r--r--include/sched.h2
-rw-r--r--include/search.h2
-rw-r--r--include/setjmp.h4
-rw-r--r--include/signal.h2
-rw-r--r--include/stdio.h8
-rw-r--r--include/stdlib.h10
-rw-r--r--include/string.h4
-rw-r--r--include/stropts.h1
-rw-r--r--include/sys/cdefs.h14
-rw-r--r--include/sys/mman.h2
-rw-r--r--include/sys/msg.h2
-rw-r--r--include/sys/resource.h2
-rw-r--r--include/sys/select.h2
-rw-r--r--include/sys/socket.h2
-rw-r--r--include/sys/stat.h2
-rw-r--r--include/sys/statvfs.h2
-rw-r--r--include/sys/time.h2
-rw-r--r--include/sys/times.h2
-rw-r--r--include/sys/uio.h2
-rw-r--r--include/sys/utsname.h2
-rw-r--r--include/sys/wait.h2
-rw-r--r--include/termios.h2
-rw-r--r--include/time.h6
-rw-r--r--include/uchar.h1
-rw-r--r--include/ulimit.h2
-rw-r--r--include/unistd.h2
-rw-r--r--include/utime.h2
-rw-r--r--include/wchar.h2
-rw-r--r--include/wctype.h4
-rw-r--r--include/wordexp.h2
-rw-r--r--posix/tar.h9
131 files changed, 897 insertions, 358 deletions
diff --git a/ChangeLog b/ChangeLog
index f1dd278281..b216015462 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,136 @@
 2012-02-25  Ulrich Drepper  <drepper@gmail.com>
 
+	* conform/run-conformtest.sh: New file.
+	* conform/Makefile: Run run-conformtest for tests.
+	* conform/conformtest.pl: Many bug fixes.  Add ISO C99, ISO C11
+	support.
+
+	* conform/data/uchar.h-data: New file.
+	* conform/data/aio.h-data: Fixes for ISO C and POSIX 1995 testing.
+	* conform/data/arpa/inet.h-data: Likewise.
+	* conform/data/assert.h-data: Likewise.
+	* conform/data/complex.h-data: Likewise.
+	* conform/data/cpio.h-data: Likewise.
+	* conform/data/ctype.h-data: Likewise.
+	* conform/data/dirent.h-data: Likewise.
+	* conform/data/dlfcn.h-data: Likewise.
+	* conform/data/errno.h-data: Likewise.
+	* conform/data/fcntl.h-data: Likewise.
+	* conform/data/float.h-data: Likewise.
+	* conform/data/fmtmsg.h-data: Likewise.
+	* conform/data/fnmatch.h-data: Likewise.
+	* conform/data/ftw.h-data: Likewise.
+	* conform/data/glob.h-data: Likewise.
+	* conform/data/grp.h-data: Likewise.
+	* conform/data/iconv.h-data: Likewise.
+	* conform/data/inttypes.h-data: Likewise.
+	* conform/data/langinfo.h-data: Likewise.
+	* conform/data/libgen.h-data: Likewise.
+	* conform/data/limits.h-data: Likewise.
+	* conform/data/locale.h-data: Likewise.
+	* conform/data/math.h-data: Likewise.
+	* conform/data/monetary.h-data: Likewise.
+	* conform/data/mqueue.h-data: Likewise.
+	* conform/data/ndbm.h-data: Likewise.
+	* conform/data/net/if.h-data: Likewise.
+	* conform/data/netdb.h-data: Likewise.
+	* conform/data/netinet/in.h-data: Likewise.
+	* conform/data/nl_types.h-data: Likewise.
+	* conform/data/poll.h-data: Likewise.
+	* conform/data/pthread.h-data: Likewise.
+	* conform/data/pwd.h-data: Likewise.
+	* conform/data/regex.h-data: Likewise.
+	* conform/data/sched.h-data: Likewise.
+	* conform/data/search.h-data: Likewise.
+	* conform/data/semaphore.h-data: Likewise.
+	* conform/data/setjmp.h-data: Likewise.
+	* conform/data/signal.h-data: Likewise.
+	* conform/data/spawn.h-data: Likewise.
+	* conform/data/stdarg.h-data: Likewise.
+	* conform/data/stdio.h-data: Likewise.
+	* conform/data/stdlib.h-data: Likewise.
+	* conform/data/string.h-data: Likewise.
+	* conform/data/strings.h-data: Likewise.
+	* conform/data/stropts.h-data: Likewise.
+	* conform/data/sys/ipc.h-data: Likewise.
+	* conform/data/sys/mman.h-data: Likewise.
+	* conform/data/sys/msg.h-data: Likewise.
+	* conform/data/sys/resource.h-data: Likewise.
+	* conform/data/sys/select.h-data: Likewise.
+	* conform/data/sys/sem.h-data: Likewise.
+	* conform/data/sys/shm.h-data: Likewise.
+	* conform/data/sys/socket.h-data: Likewise.
+	* conform/data/sys/stat.h-data: Likewise.
+	* conform/data/sys/statvfs.h-data: Likewise.
+	* conform/data/sys/time.h-data: Likewise.
+	* conform/data/sys/timeb.h-data: Likewise.
+	* conform/data/sys/times.h-data: Likewise.
+	* conform/data/sys/types.h-data: Likewise.
+	* conform/data/sys/uio.h-data: Likewise.
+	* conform/data/sys/un.h-data: Likewise.
+	* conform/data/sys/utsname.h-data: Likewise.
+	* conform/data/sys/wait.h-data: Likewise.
+	* conform/data/syslog.h-data: Likewise.
+	* conform/data/tar.h-data: Likewise.
+	* conform/data/termios.h-data: Likewise.
+	* conform/data/utime.h-data: Likewise.
+	* conform/data/utmpx.h-data: Likewise.
+	* conform/data/varargs.h-data: Likewise.
+	* conform/data/wchar.h-data: Likewise.
+	* conform/data/wctype.h-data: Likewise.
+	* conform/data/wordexp.h-data: Likewise.
+
+	* include/stropts.h: New file.
+	* include/uchar.h: New file.
+	* include/aio.h: Changes to allow conformtest.pl to use the headers.
+	* include/assert.h: Likewise.
+	* include/ctype.h: Likewise.
+	* include/dirent.h: Likewise.
+	* include/dlfcn.h: Likewise.
+	* include/fcntl.h: Likewise.
+	* include/fnmatch.h: Likewise.
+	* include/glob.h: Likewise.
+	* include/grp.h: Likewise.
+	* include/libio.h: Likewise.
+	* include/locale.h: Likewise.
+	* include/math.h: Likewise.
+	* include/net/if.h: Likewise.
+	* include/netdb.h: Likewise.
+	* include/netinet/in.h: Likewise.
+	* include/pthread.h: Likewise.
+	* include/pwd.h: Likewise.
+	* include/regex.h: Likewise.
+	* include/sched.h: Likewise.
+	* include/search.h: Likewise.
+	* include/setjmp.h: Likewise.
+	* include/signal.h: Likewise.
+	* include/stdio.h: Likewise.
+	* include/stdlib.h: Likewise.
+	* include/string.h: Likewise.
+	* include/sys/cdefs.h: Likewise.
+	* include/sys/mman.h: Likewise.
+	* include/sys/msg.h: Likewise.
+	* include/sys/resource.h: Likewise.
+	* include/sys/select.h: Likewise.
+	* include/sys/socket.h: Likewise.
+	* include/sys/stat.h: Likewise.
+	* include/sys/statvfs.h: Likewise.
+	* include/sys/time.h: Likewise.
+	* include/sys/times.h: Likewise.
+	* include/sys/uio.h: Likewise.
+	* include/sys/utsname.h: Likewise.
+	* include/sys/wait.h: Likewise.
+	* include/termios.h: Likewise.
+	* include/time.h: Likewise.
+	* include/ulimit.h: Likewise.
+	* include/unistd.h: Likewise.
+	* include/utime.h: Likewise.
+	* include/wchar.h: Likewise.
+	* include/wctype.h: Likewise.
+	* include/wordexp.h: Likewise.
+
+	* posix/tar.h (TSVTX): Should not be visible for POSIX before 2008.
+
 	* time/time.h: TIME_UTC must be a macro.
 	Make timespec_get available for ISO C11 only as well.
 
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
diff --git a/include/aio.h b/include/aio.h
index c81dae9706..90c74f9951 100644
--- a/include/aio.h
+++ b/include/aio.h
@@ -1,6 +1,7 @@
 #ifndef _AIO_H
 #include <rt/aio.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern void __aio_init (const struct aioinit *__init);
 
@@ -8,5 +9,6 @@ extern void __aio_init (const struct aioinit *__init);
    lio_listio and we do not issue events for each individual list
    element.  */
 #define LIO_NO_INDIVIDUAL_EVENT	128
+#endif
 
 #endif
diff --git a/include/assert.h b/include/assert.h
index 573eb404ec..d0d9259ab3 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -1,5 +1,6 @@
 #include <assert/assert.h>
 
+#ifndef _ISOMAC
 /* This prints an "Assertion failed" message and aborts.
    In installed assert.h this is only conditionally declared,
    so it has to be repeated here.  */
@@ -19,7 +20,8 @@ extern void __assert_fail_base (const char *fmt, const char *assertion,
 				const char *function)
      __THROW  __attribute__ ((__noreturn__));
 
-#if !defined NOT_IN_libc || defined IS_IN_rtld
+# if !defined NOT_IN_libc || defined IS_IN_rtld
 hidden_proto (__assert_fail)
 hidden_proto (__assert_perror_fail)
+# endif
 #endif
diff --git a/include/ctype.h b/include/ctype.h
index 4b5abda375..6a18039e3f 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -1,5 +1,6 @@
 #ifndef _CTYPE_H
 
+#ifndef _ISOMAC
 /* Initialize ctype locale data.  */
 extern void __ctype_init (void);
 libc_hidden_proto (__ctype_init)
@@ -46,9 +47,11 @@ __ctype_tolower_loc (void)
 }
 
 # endif	/* Not NOT_IN_libc.  */
+#endif
 
-# include <ctype/ctype.h>
+#include <ctype/ctype.h>
 
+#ifndef _ISOMAC
 # if !defined __NO_CTYPE && !defined NOT_IN_libc
 /* The spec says that isdigit must only match the decimal digits.  We
    can check this without a memory access.  */
@@ -59,5 +62,6 @@ __ctype_tolower_loc (void)
 #  undef __isdigit_l
 #  define __isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; })
 # endif
+#endif
 
 #endif /* ctype.h */
diff --git a/include/dirent.h b/include/dirent.h
index 28bf432301..2e88005e00 100644
--- a/include/dirent.h
+++ b/include/dirent.h
@@ -1,6 +1,7 @@
 #ifndef _DIRENT_H
-# include <dirstream.h>
 # include <dirent/dirent.h>
+# ifndef _ISOMAC
+# include <dirstream.h>
 # include <sys/stat.h>
 # include <stdbool.h>
 
@@ -44,5 +45,6 @@ extern void __scandir_cancel_handler (void *arg);
 libc_hidden_proto (rewinddir)
 libc_hidden_proto (scandirat)
 libc_hidden_proto (scandirat64)
+# endif
 
 #endif
diff --git a/include/dlfcn.h b/include/dlfcn.h
index ae9c886087..a67b2e3251 100644
--- a/include/dlfcn.h
+++ b/include/dlfcn.h
@@ -1,5 +1,6 @@
 #ifndef _DLFCN_H
 #include <dlfcn/dlfcn.h>
+#ifndef _ISOMAC
 #include <link.h>		/* For ElfW.  */
 #include <stdbool.h>
 
@@ -146,5 +147,6 @@ extern void __libc_register_dl_open_hook (struct link_map *map)
 extern void __libc_register_dlfcn_hook (struct link_map *map)
      attribute_hidden;
 #endif
+#endif
 
 #endif
diff --git a/include/fcntl.h b/include/fcntl.h
index 7afbd1c74c..b645ffc000 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -1,6 +1,7 @@
 #ifndef _FCNTL_H
 #include <io/fcntl.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern int __open64 (const char *__file, int __oflag, ...);
 libc_hidden_proto (__open64)
@@ -44,5 +45,6 @@ extern int __have_atfcts attribute_hidden;
 #ifdef O_CLOEXEC
 extern int __have_o_cloexec attribute_hidden;
 #endif
+#endif
 
 #endif
diff --git a/include/fnmatch.h b/include/fnmatch.h
index 2cdad0a40f..9ef8150eda 100644
--- a/include/fnmatch.h
+++ b/include/fnmatch.h
@@ -2,6 +2,8 @@
 
 #include <posix/fnmatch.h>
 
+#ifndef _ISOMAC
 libc_hidden_proto (fnmatch)
+#endif
 
 #endif
diff --git a/include/glob.h b/include/glob.h
index a0c05977f7..228fe30ca8 100644
--- a/include/glob.h
+++ b/include/glob.h
@@ -1,6 +1,7 @@
 #ifndef	_GLOB_H
 #include <posix/glob.h>
 
+#ifndef _ISOMAC
 libc_hidden_proto (glob)
 libc_hidden_proto (glob64)
 libc_hidden_proto (globfree)
@@ -11,5 +12,6 @@ extern int __glob_pattern_p (const char *__pattern, int __quote);
 extern int __glob64 (const char *__pattern, int __flags,
 		     int (*__errfunc) (const char *, int),
 		     glob64_t *__pglob);
+#endif
 
 #endif
diff --git a/include/grp.h b/include/grp.h
index 9fa71eac75..0fb5c9a574 100644
--- a/include/grp.h
+++ b/include/grp.h
@@ -1,6 +1,7 @@
 #ifndef _GRP_H
 #include <grp/grp.h>
 
+#ifndef _ISOMAC
 libc_hidden_proto (setgroups)
 
 /* Now define the internal interfaces.  */
@@ -60,3 +61,4 @@ DECLARE_NSS_PROTOTYPES (nisplus)
 
 #undef DECLARE_NSS_PROTOTYPES
 #endif
+#endif
diff --git a/include/libio.h b/include/libio.h
index 633ee51bb7..aca7000f8e 100644
--- a/include/libio.h
+++ b/include/libio.h
@@ -1,5 +1,6 @@
 #include <libio/libio.h>
 
+#ifndef _ISOMAC
 #ifndef _LIBC_LIBIO_H
 #define _LIBC_LIBIO_H
 
@@ -22,3 +23,4 @@ libc_hidden_proto (__wuflow)
 #endif
 
 #endif
+#endif
diff --git a/include/locale.h b/include/locale.h
index a296a5f8f6..8091e1dc80 100644
--- a/include/locale.h
+++ b/include/locale.h
@@ -1,6 +1,7 @@
 #ifndef	_LOCALE_H
 #include <locale/locale.h>
 
+#ifndef _ISOMAC
 extern __typeof (uselocale) __uselocale;
 
 libc_hidden_proto (setlocale)
@@ -22,3 +23,4 @@ extern struct lconv *__localeconv (void);
 extern const char *__current_locale_name (int category) attribute_hidden;
 
 #endif
+#endif
diff --git a/include/math.h b/include/math.h
index 3934880171..2b040c67fd 100644
--- a/include/math.h
+++ b/include/math.h
@@ -2,6 +2,7 @@
 
 #include <math/math.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern int __matherr (struct exception *__exc);
 
@@ -36,3 +37,4 @@ extern int __isinf_nsf (float);
 extern int __isinf_nsl (long double);
 
 #endif
+#endif
diff --git a/include/net/if.h b/include/net/if.h
index 872ab6da15..1d862260c7 100644
--- a/include/net/if.h
+++ b/include/net/if.h
@@ -2,9 +2,11 @@
 
 # include_next <net/if.h>
 
+#ifndef _ISOMAC
 libc_hidden_proto (if_nametoindex)
 libc_hidden_proto (if_indextoname)
 libc_hidden_proto (if_nameindex)
 libc_hidden_proto (if_freenameindex)
+#endif
 
 #endif
diff --git a/include/netdb.h b/include/netdb.h
index 0db3579259..3f2ae06451 100644
--- a/include/netdb.h
+++ b/include/netdb.h
@@ -1,6 +1,7 @@
 #ifndef	_NETDB_H
 #include <resolv/netdb.h>
 
+#ifndef _ISOMAC
 /* Macros for accessing h_errno from inside libc.  */
 # undef  h_errno
 # ifdef _LIBC_REENTRANT
@@ -280,5 +281,6 @@ DECLARE_NSS_PROTOTYPES (nis)
 DECLARE_NSS_PROTOTYPES (nisplus)
 
 #undef DECLARE_NSS_PROTOTYPES
+#endif
 
 #endif /* !_NETDB_H */
diff --git a/include/netinet/in.h b/include/netinet/in.h
index 876f1a4369..6fb5c86de9 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -2,8 +2,10 @@
 
 #include <inet/netinet/in.h>
 
+#ifndef _ISOMAC
 libc_hidden_proto (bindresvport)
 libc_hidden_proto (in6addr_loopback)
 libc_hidden_proto (in6addr_any)
+#endif
 
 #endif
diff --git a/include/pthread.h b/include/pthread.h
index f8860bdf93..51854f6053 100644
--- a/include/pthread.h
+++ b/include/pthread.h
@@ -1,4 +1,6 @@
 #include_next <pthread.h>
 
+#ifndef _ISOMAC
 /* This function is called to initialize the pthread library.  */
 extern void __pthread_initialize (void) __attribute__ ((weak));
+#endif
diff --git a/include/pwd.h b/include/pwd.h
index 465c17c50c..bd7fecc16e 100644
--- a/include/pwd.h
+++ b/include/pwd.h
@@ -1,6 +1,7 @@
 #ifndef _PWD_H
 #include <pwd/pwd.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern int __getpwent_r (struct passwd *__resultbuf, char *__buffer,
 			 size_t __buflen, struct passwd **__result)
@@ -51,5 +52,6 @@ DECLARE_NSS_PROTOTYPES (nis)
 DECLARE_NSS_PROTOTYPES (nisplus)
 
 #undef DECLARE_NSS_PROTOTYPES
+#endif
 
 #endif
diff --git a/include/regex.h b/include/regex.h
index a7606c5e0d..fd4beeff3d 100644
--- a/include/regex.h
+++ b/include/regex.h
@@ -1,6 +1,7 @@
 #ifndef _REGEX_H
 #include <posix/regex.h>
 
+#ifndef _ISOMAC
 /* Document internal interfaces.  */
 extern reg_syntax_t __re_set_syntax (reg_syntax_t syntax);
 
@@ -41,3 +42,4 @@ extern size_t __regerror (int __errcode, const regex_t *__preg,
 
 extern void __regfree (regex_t *__preg);
 #endif
+#endif
diff --git a/include/sched.h b/include/sched.h
index 1eae9f72ff..4f59397090 100644
--- a/include/sched.h
+++ b/include/sched.h
@@ -1,6 +1,7 @@
 #ifndef _SCHED_H
 #include <posix/sched.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern int __sched_setparam (__pid_t __pid,
 			     const struct sched_param *__param);
@@ -21,3 +22,4 @@ extern int __clone (int (*__fn) (void *__arg), void *__child_stack,
 extern int __clone2 (int (*__fn) (void *__arg), void *__child_stack_base,
 		     size_t __child_stack_size, int __flags, void *__arg, ...);
 #endif
+#endif
diff --git a/include/search.h b/include/search.h
index d1f3a92e83..cf9c343708 100644
--- a/include/search.h
+++ b/include/search.h
@@ -1,6 +1,7 @@
 #ifndef _SEARCH_H
 #include <misc/search.h>
 
+#ifndef _ISOMAC
 libc_hidden_proto (hcreate_r)
 libc_hidden_proto (hdestroy_r)
 libc_hidden_proto (hsearch_r)
@@ -17,3 +18,4 @@ extern void *__tdelete (const void *__key, void **__rootp,
 extern void __twalk (const void *__root, __action_fn_t action);
 extern void __tdestroy (void *__root, __free_fn_t freefct);
 #endif
+#endif
diff --git a/include/setjmp.h b/include/setjmp.h
index 6863f51c11..622bb319f3 100644
--- a/include/setjmp.h
+++ b/include/setjmp.h
@@ -1,6 +1,7 @@
 #ifndef _SETJMP_H
 #include <setjmp/setjmp.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 
 /* Internal machine-dependent function to restore context sans signal mask.  */
@@ -16,12 +17,13 @@ extern int __sigjmp_save (jmp_buf __env, int __savemask);
 extern void _longjmp_unwind (jmp_buf env, int val);
 
 extern void __libc_siglongjmp (sigjmp_buf env, int val)
-          __attribute__ ((noreturn));
+	  __attribute__ ((noreturn));
 extern void __libc_longjmp (sigjmp_buf env, int val)
      __attribute__ ((noreturn));
 libc_hidden_proto (__libc_longjmp)
 
 libc_hidden_proto (_setjmp)
 libc_hidden_proto (__sigsetjmp)
+#endif
 
 #endif
diff --git a/include/signal.h b/include/signal.h
index 6250d30f77..c43f2abeec 100644
--- a/include/signal.h
+++ b/include/signal.h
@@ -4,6 +4,7 @@
 #else
 # include <signal/signal.h>
 
+# ifndef _ISOMAC
 libc_hidden_proto (sigemptyset)
 libc_hidden_proto (sigfillset)
 libc_hidden_proto (sigaddset)
@@ -58,5 +59,6 @@ extern int __xpg_sigpause (int sig);
 
 /* Allocate real-time signal with highest/lowest available priority.  */
 extern int __libc_allocate_rtsig (int __high);
+# endif
 #endif
 #endif
diff --git a/include/stdio.h b/include/stdio.h
index 48aa765e02..bd0209aaac 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -1,5 +1,5 @@
 #ifndef _STDIO_H
-# if defined __need_FILE || defined __need___FILE
+# if defined __need_FILE || defined __need___FILE || defined _ISOMAC
 #  include <libio/stdio.h>
 # else
 #  include <libio/stdio.h>
@@ -29,7 +29,7 @@ extern int __vsscanf (const char *__restrict __s,
 		      _G_va_list __arg)
      __attribute__ ((__format__ (__scanf__, 2, 0)));
 
-#ifndef __cplusplus
+#  ifndef __cplusplus
 extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW;
 extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...)
      __THROW;
@@ -51,7 +51,7 @@ extern int __obstack_printf_chk (struct obstack *, int, const char *, ...)
      __THROW;
 extern int __obstack_vprintf_chk (struct obstack *, int, const char *,
 				  _G_va_list) __THROW;
-#endif
+#  endif
 
 extern int __isoc99_fscanf (FILE *__restrict __stream,
 			    const char *__restrict __format, ...) __wur;
@@ -119,7 +119,7 @@ extern int _sys_nerr_internal attribute_hidden;
 extern int __asprintf_internal (char **__restrict __ptr,
 				const char *__restrict __fmt, ...)
      attribute_hidden __attribute__ ((__format__ (__printf__, 2, 3)));
-#  if !defined NOT_IN_libc && !defined _ISOMAC
+#  if !defined NOT_IN_libc
 #    define __asprintf(ptr, fmt, args...) \
   INTUSE(__asprintf) (ptr, fmt, ##args)
 
diff --git a/include/stdlib.h b/include/stdlib.h
index fc9ef7f5d6..de0b414d86 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -4,14 +4,14 @@
 #define __Need_M_And_C
 #endif
 
-#include <stddef.h>
+#ifndef _ISOMAC
+# include <stddef.h>
+#endif
 #include <stdlib/stdlib.h>
 
 /* Now define the internal interfaces.  */
-#ifndef __Need_M_And_C
-# ifndef _ISOMAC
-#  include <sys/stat.h>
-# endif
+#if !defined __Need_M_And_C && !defined _ISOMAC
+# include <sys/stat.h>
 
 __BEGIN_DECLS
 
diff --git a/include/string.h b/include/string.h
index 0b49b8fe7c..f1077f66ed 100644
--- a/include/string.h
+++ b/include/string.h
@@ -1,5 +1,6 @@
 #ifndef _STRING_H
 
+#ifndef _ISOMAC
 #include <sys/types.h>
 
 extern void *__memccpy (void *__dest, const void *__src,
@@ -43,11 +44,13 @@ extern void *__memchr (const void *__s, int __c, size_t __n)
 extern int __ffs (int __i) __attribute__ ((const));
 
 extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen);
+#endif
 
 /* Now the real definitions.  We do this here since some of the functions
    above are defined as macros in the headers.  */
 #include <string/string.h>
 
+#ifndef _ISOMAC
 extern __typeof (strcoll_l) __strcoll_l;
 extern __typeof (strxfrm_l) __strxfrm_l;
 extern __typeof (strcasecmp_l) __strcasecmp_l;
@@ -142,5 +145,6 @@ extern char *__strcat_chk (char *__restrict __dest,
 extern char *__strncat_chk (char *__restrict __dest,
 			    const char *__restrict __src,
 			    size_t __len, size_t __destlen) __THROW;
+#endif
 
 #endif
diff --git a/include/stropts.h b/include/stropts.h
new file mode 100644
index 0000000000..27ab60ac7f
--- /dev/null
+++ b/include/stropts.h
@@ -0,0 +1 @@
+#include <streams/stropts.h>
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index a2bdf20d93..fa93982af9 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -2,21 +2,23 @@
 
 #include <misc/sys/cdefs.h>
 
+#ifndef _ISOMAC
 /* The compiler will optimize based on the knowledge the parameter is
    not NULL.  This will omit tests.  A robust implementation cannot allow
    this so when compiling glibc itself we ignore this attribute.  */
-#undef __nonnull
-#define __nonnull(params)
+# undef __nonnull
+# define __nonnull(params)
 
 extern void __chk_fail (void) __attribute__ ((__noreturn__));
 libc_hidden_proto (__chk_fail)
 rtld_hidden_proto (__chk_fail)
 
 
-#if __GNUC_PREREQ (4,3)
-# define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__)))
-#else
-# define __attribute_alloc_size(...)
+# if __GNUC_PREREQ (4,3)
+#  define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__)))
+# else
+#  define __attribute_alloc_size(...)
+# endif
 #endif
 
 #endif
diff --git a/include/sys/mman.h b/include/sys/mman.h
index a4687b30f7..0a0e4a6533 100644
--- a/include/sys/mman.h
+++ b/include/sys/mman.h
@@ -1,6 +1,7 @@
 #ifndef _SYS_MMAN_H
 #include <misc/sys/mman.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern void *__mmap (void *__addr, size_t __len, int __prot,
 		     int __flags, int __fd, __off_t __offset);
@@ -14,5 +15,6 @@ extern void *__mremap (void *__addr, size_t __old_len,
 		       size_t __new_len, int __flags, ...);
 
 libc_hidden_proto (madvise);
+#endif
 
 #endif
diff --git a/include/sys/msg.h b/include/sys/msg.h
index 03e17f915e..43ec5b9472 100644
--- a/include/sys/msg.h
+++ b/include/sys/msg.h
@@ -1,9 +1,11 @@
 #ifndef _SYS_MSG_H
 #include <sysvipc/sys/msg.h>
 
+#ifndef _ISOMAC
 extern ssize_t __libc_msgrcv (int msqid, void *msgp, size_t msgsz,
 			      long int msgtyp, int msgflg);
 extern int __libc_msgsnd (int msqid, const void *msgp, size_t msgsz,
 			  int msgflg);
+#endif
 
 #endif
diff --git a/include/sys/resource.h b/include/sys/resource.h
index b4ea1ae592..c35df435a5 100644
--- a/include/sys/resource.h
+++ b/include/sys/resource.h
@@ -1,6 +1,7 @@
 #ifndef _SYS_RESOURCE_H
 #include <resource/sys/resource.h>
 
+#ifndef _ISOMAC
 libc_hidden_proto (getpriority)
 libc_hidden_proto (setpriority)
 libc_hidden_proto (getrlimit64)
@@ -14,3 +15,4 @@ extern int __getrusage (enum __rusage_who __who, struct rusage *__usage)
 extern int __setrlimit (enum __rlimit_resource __resource,
 			const struct rlimit *__rlimits);
 #endif
+#endif
diff --git a/include/sys/select.h b/include/sys/select.h
index 2e5901c13d..07bb49b994 100644
--- a/include/sys/select.h
+++ b/include/sys/select.h
@@ -1,6 +1,7 @@
 #ifndef _SYS_SELECT_H
 #include <misc/sys/select.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern int __pselect (int __nfds, fd_set *__readfds,
 		      fd_set *__writefds, fd_set *__exceptfds,
@@ -14,3 +15,4 @@ extern int __select (int __nfds, fd_set *__restrict __readfds,
 libc_hidden_proto (__select)
 
 #endif
+#endif
diff --git a/include/sys/socket.h b/include/sys/socket.h
index d45c99d1cf..2ae3428bdd 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -1,6 +1,7 @@
 #ifndef _SYS_SOCKET_H
 #include <socket/sys/socket.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 
 /* Create a new socket of type TYPE in domain DOMAIN, using
@@ -162,3 +163,4 @@ extern int __have_sock_cloexec;
 #endif
 
 #endif
+#endif
diff --git a/include/sys/stat.h b/include/sys/stat.h
index a6cf60f401..7a65d608c5 100644
--- a/include/sys/stat.h
+++ b/include/sys/stat.h
@@ -1,6 +1,7 @@
 #ifndef _SYS_STAT_H
 #include <io/sys/stat.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces. */
 extern int __stat (const char *__file, struct stat *__buf);
 extern int __fstat (int __fd, struct stat *__buf);
@@ -55,3 +56,4 @@ libc_hidden_proto (__fxstatat64)
 #define __fstatat64(dfd, fname, buf, flag) \
   __fxstatat64 (_STAT_VER, dfd, fname, buf, flag)
 #endif
+#endif
diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h
index 74ef2db45d..fa3045386d 100644
--- a/include/sys/statvfs.h
+++ b/include/sys/statvfs.h
@@ -1,6 +1,7 @@
 #ifndef _SYS_STATVFS_H
 #include <io/sys/statvfs.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern int __statvfs64 (const char *__file, struct statvfs64 *__buf);
 extern int __fstatvfs64 (int __fildes, struct statvfs64 *__buf);
@@ -8,3 +9,4 @@ extern int __fstatvfs64 (int __fildes, struct statvfs64 *__buf);
 libc_hidden_proto (statvfs)
 libc_hidden_proto (fstatvfs)
 #endif
+#endif
diff --git a/include/sys/time.h b/include/sys/time.h
index a5ec500cde..d5de942ed6 100644
--- a/include/sys/time.h
+++ b/include/sys/time.h
@@ -1,6 +1,7 @@
 #ifndef _SYS_TIME_H
 #include <time/sys/time.h>
 
+#ifndef _ISOMAC
 /* Now document the internal interfaces.  */
 extern int __gettimeofday (struct timeval *__tv,
 			   struct timezone *__tz);
@@ -27,3 +28,4 @@ extern int __futimes (int fd, const struct timeval tvp[2]) attribute_hidden;
 #endif
 
 #endif
+#endif
diff --git a/include/sys/times.h b/include/sys/times.h
index 6ad39fb8c5..026d140fe1 100644
--- a/include/sys/times.h
+++ b/include/sys/times.h
@@ -1,6 +1,8 @@
 #ifndef _SYS_TIMES_H
 #include <posix/sys/times.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern clock_t __times (struct tms *__buffer);
 #endif
+#endif
diff --git a/include/sys/uio.h b/include/sys/uio.h
index 1e5d64e47e..0ec9ab09a8 100644
--- a/include/sys/uio.h
+++ b/include/sys/uio.h
@@ -1,6 +1,7 @@
 #ifndef _SYS_UIO_H
 #include <misc/sys/uio.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern ssize_t __readv (int __fd, const struct iovec *__vector,
 			int __count);
@@ -11,3 +12,4 @@ extern ssize_t __writev (int __fd, const struct iovec *__vector,
 extern ssize_t __libc_writev (int __fd, const struct iovec *__vector,
 			      int __count);
 #endif
+#endif
diff --git a/include/sys/utsname.h b/include/sys/utsname.h
index a6b4ceb97e..66a5289638 100644
--- a/include/sys/utsname.h
+++ b/include/sys/utsname.h
@@ -1,8 +1,10 @@
 #ifndef	_SYS_UTSNAME_H
 #include <posix/sys/utsname.h>
 
+#ifndef _ISOMAC
 extern int __uname (struct utsname *__name);
 
 libc_hidden_proto (uname)
 libc_hidden_proto (__uname)
 #endif
+#endif
diff --git a/include/sys/wait.h b/include/sys/wait.h
index efabd0cc45..2239501614 100644
--- a/include/sys/wait.h
+++ b/include/sys/wait.h
@@ -1,6 +1,7 @@
 #ifndef _SYS_WAIT_H
 #include <posix/sys/wait.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern __pid_t __waitpid (__pid_t __pid, int *__stat_loc,
 			  int __options);
@@ -16,3 +17,4 @@ extern __pid_t __wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc,
 			int __options, struct rusage *__usage)
 			attribute_hidden;
 #endif
+#endif
diff --git a/include/termios.h b/include/termios.h
index 8916f1434f..fad51f8385 100644
--- a/include/termios.h
+++ b/include/termios.h
@@ -1,6 +1,7 @@
 #ifndef _TERMIOS_H
 #include <termios/termios.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern int __tcgetattr (int __fd, struct termios *__termios_p);
 
@@ -11,3 +12,4 @@ libc_hidden_proto (cfsetispeed)
 libc_hidden_proto (cfsetospeed)
 
 #endif
+#endif
diff --git a/include/time.h b/include/time.h
index 0bda094cb4..f056542a10 100644
--- a/include/time.h
+++ b/include/time.h
@@ -1,5 +1,5 @@
 #ifndef _TIME_H
-#if defined __need_time_t  || defined __need_clock_t || defined __need_timespec
+#if defined __need_time_t  || defined __need_clock_t || defined __need_timespec || defined _ISOMAC
 # include <time/time.h>
 #else
 # include <time/time.h>
@@ -106,9 +106,7 @@ extern double __difftime (time_t time1, time_t time0);
 
 /* Use in the clock_* functions.  Size of the field representing the
    actual clock ID.  */
-#ifndef _ISOMAC
-# define CLOCK_IDFIELD_SIZE	3
-#endif
+#define CLOCK_IDFIELD_SIZE	3
 
 __END_DECLS
 
diff --git a/include/uchar.h b/include/uchar.h
new file mode 100644
index 0000000000..f456684706
--- /dev/null
+++ b/include/uchar.h
@@ -0,0 +1 @@
+#include <wcsmbs/uchar.h>
diff --git a/include/ulimit.h b/include/ulimit.h
index d2430fa6a3..dd83faa049 100644
--- a/include/ulimit.h
+++ b/include/ulimit.h
@@ -1,6 +1,8 @@
 #ifndef _ULIMIT_H
 #include <resource/ulimit.h>
 
+#ifndef _ISOMAC
 /* Now define the internal interfaces.  */
 extern long int __ulimit (int __cmd, ...);
 #endif
+#endif
diff --git a/include/unistd.h b/include/unistd.h
index 4664dc2852..2e6101b0d0 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -1,6 +1,7 @@
 #ifndef _UNISTD_H
 # include <posix/unistd.h>
 
+# ifndef _ISOMAC
 __BEGIN_DECLS
 
 libc_hidden_proto (_exit, __noreturn__)
@@ -182,5 +183,6 @@ extern int __getlogin_r_loginuid (char *name, size_t namesize)
      attribute_hidden;
 
 __END_DECLS
+# endif
 
 #endif
diff --git a/include/utime.h b/include/utime.h
index aecd6a14d8..5049251311 100644
--- a/include/utime.h
+++ b/include/utime.h
@@ -2,6 +2,8 @@
 
 #include <io/utime.h>
 
+#ifndef _ISOMAC
 libc_hidden_proto (utime)
+#endif
 
 #endif /* utime.h */
diff --git a/include/wchar.h b/include/wchar.h
index d2f9e0d166..f927a95fdf 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -1,6 +1,7 @@
 #ifndef _WCHAR_H
 #include <wcsmbs/wchar.h>
 
+# ifndef _ISOMAC
 # ifdef _WCHAR_H
 
 extern __typeof (wcscasecmp_l) __wcscasecmp_l;
@@ -194,6 +195,7 @@ extern size_t __mbsrtowcs_l (wchar_t *dst, const char **src, size_t len,
 #  define __mbsinit(state) ((state)->__count == 0)
 
 # endif
+# endif
 #endif
 
 /* Undefine all __need_* constants in case we are included to get those
diff --git a/include/wctype.h b/include/wctype.h
index 9833f958dd..a2ee9ff880 100644
--- a/include/wctype.h
+++ b/include/wctype.h
@@ -1,5 +1,6 @@
 #ifndef _WCTYPE_H
 
+#ifndef _ISOMAC
 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
    there.  So define it ourselves if it remains undefined.  */
 # define __need_wint_t
@@ -33,9 +34,11 @@ libc_hidden_proto (iswspace)
 libc_hidden_proto (iswxdigit)
 libc_hidden_proto (towlower)
 libc_hidden_proto (towupper)
+#endif
 
 #include <wctype/wctype.h>
 
+#ifndef _ISOMAC
 /* Internal interfaces.  */
 extern int __iswalpha_l_internal (wint_t __wc, __locale_t __locale)
      attribute_hidden;
@@ -96,3 +99,4 @@ libc_hidden_proto (__towupper_l)
 # endif
 
 #endif
+#endif
diff --git a/include/wordexp.h b/include/wordexp.h
index 27ae0454c5..33c90c15c0 100644
--- a/include/wordexp.h
+++ b/include/wordexp.h
@@ -2,6 +2,8 @@
 
 #include <posix/wordexp.h>
 
+#ifndef _ISOMAC
 libc_hidden_proto (wordfree)
+#endif
 
 #endif
diff --git a/posix/tar.h b/posix/tar.h
index 9732d67cb5..be2961ce91 100644
--- a/posix/tar.h
+++ b/posix/tar.h
@@ -1,5 +1,5 @@
 /* Extended tar format from POSIX.1.
-   Copyright (C) 1992, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1996, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by David J. MacKenzie.
 
@@ -20,6 +20,9 @@
 #ifndef	_TAR_H
 #define	_TAR_H	1
 
+#include <features.h>
+
+
 /* A tar archive consists of 512-byte blocks.
    Each file in the archive has a header block followed by 0+ data blocks.
    Two blocks of NUL bytes indicate the end of the archive.  */
@@ -70,7 +73,9 @@
 /* The bits in mode: */
 #define TSUID	04000
 #define TSGID	02000
-#define TSVTX	01000
+#ifdef __USE_XOPEN
+# define TSVTX	01000
+#endif
 #define TUREAD	00400
 #define TUWRITE	00200
 #define TUEXEC	00100