]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - fixincludes/inclhack.def
fixincludes: vxworks: regs.h: Fix includes in regs.h wrapper
[thirdparty/gcc.git] / fixincludes / inclhack.def
index c92170f4cd99105354f0fab94f5a147e10a027cb..8fd9f7ef295e2bb5f0c5872b529fc813ea8bee9f 100644 (file)
@@ -11,7 +11,7 @@ autogen definitions fixincl;
           pattern='^/\*$' \
           trailer='^/\*EOF\*[/]' \
           input=inclhack.def \
-          key='hackname[       ]*=[    ]*(.*);'
+          key=$'hackname[ \t]*=[ \t]*(.*);'
 
    Set up a debug test so we can make the templates emit special
    code while debugging these fixes:  */
@@ -377,11 +377,15 @@ fix = {
     mach        = "*-*-vxworks*";
         
     replace     = <<- _EndOfHeader_
-       #ifndef _ASSERT_H
+       #ifdef _ASSERT_H
+       #undef _ASSERT_H
+       #undef assert
+       #endif
+
        #define _ASSERT_H
 
-       #ifdef assert
-       #undef assert
+       #ifdef __cplusplus
+       extern "C" {
        #endif
 
        #if defined(__STDC__) || defined(__cplusplus)
@@ -399,11 +403,13 @@ fix = {
 
        #define assert(test) ((void) \
                ((test) ? ((void)0) : \
-               __assert("Assertion failed: " ASSERT_STRINGIFY(test) ", file " \
+               __assert("Assertion failed: " #test ", file " \
                __FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n")))
 
        #endif
 
+       #ifdef __cplusplus
+       }
        #endif
        _EndOfHeader_;
 };
@@ -420,124 +426,18 @@ fix = {
     replace     = <<- _EndOfHeader_
        #ifndef _REGS_H
        #define _REGS_H
+       /* regs.h depends on CPU_FAMILY being properly defined, which
+          is done by vxCpu.h.  */
+       #include <types/vxCpu.h>
+       /* regs.h includes a CPU_FAMILY-specific header that requires
+          vxTypesOld.h to already have been included.  Those headers
+          contain proper _ASMLANGUAGE guards around their typedefs,
+          but vxTypesOld.h itself does not. So we avoid including
+          vxTypesOld.h from assembly.  */
+       #ifndef _ASMLANGUAGE
        #include <types/vxTypesOld.h>
-       #include_next <arch/../regs.h>
        #endif
-       _EndOfHeader_;
-};
-
-/*
- * Make VxWorks stdint.h a bit more compliant - add typedefs
- */
-fix = {
-    hackname    = AAB_vxworks_stdint;
-    files       = stdint.h;
-    mach        = "*-*-vxworks*";
-        
-    replace     = <<- _EndOfHeader_
-       #ifndef _STDINT_H
-       #define _STDINT_H
-       /* get int*_t, uint*_t */
-       #include <types/vxTypes.h>
-       
-       /* get legacy vxworks types for compatibility */
-       #include <types/vxTypesOld.h>
-       
-       typedef long intptr_t;
-       typedef unsigned long uintptr_t;
-       
-       typedef int64_t intmax_t;
-       typedef uint64_t uintmax_t;
-       
-       typedef int8_t int_least8_t;
-       typedef int16_t int_least16_t;
-       typedef int32_t int_least32_t;
-       typedef int64_t int_least64_t;
-       
-       typedef uint8_t uint_least8_t;
-       typedef uint16_t uint_least16_t;
-       typedef uint32_t uint_least32_t;
-       typedef uint64_t uint_least64_t;
-       
-       typedef int8_t int_fast8_t;
-       typedef int int_fast16_t;
-       typedef int32_t int_fast32_t;
-       typedef int64_t int_fast64_t;
-       
-       typedef uint8_t uint_fast8_t;
-       typedef unsigned int uint_fast16_t;
-       typedef uint32_t uint_fast32_t;
-       typedef uint64_t uint_fast64_t;
-       
-       /* Ranges */
-       #define UINT8_MAX (~(uint8_t)0)
-       #define UINT8_MIN 0
-       #define UINT16_MAX (~(uint16_t)0)
-       #define UINT16_MIN 0
-       #define UINT32_MAX (~(uint32_t)0)
-       #define UINT32_MIN 0
-       #define UINT64_MAX (~(uint64_t)0)
-       #define UINT64_MIN 0
-       
-       #define UINTPTR_MAX (~(uintptr_t)0)
-       #define UINTPTR_MIN 0
-       
-       /* Need to do int_fast16_t as well, as type
-          size may be architecture dependent */
-       #define UINT_FAST16_MAX (~(uint_fast16_t)0)
-       #define UINT_FAST16_MAX 0
-       
-       #define INT8_MAX (UINT8_MAX>>1)
-       #define INT8_MIN (INT8_MAX+1)
-       #define INT16_MAX (UINT16_MAX>>1)
-       #define INT16_MIN (INT16_MAX+1)
-       #define INT32_MAX (UINT32_MAX>>1)
-       #define INT32_MIN (INT32_MAX+1)
-       #define INT64_MAX (UINT64_MAX>>1)
-       #define INT64_MIN (INT64_MAX+1)
-       
-       #define INTPTR_MAX (UINTPTR_MAX>>1)
-       #define INTPTR_MIN (INTPTR_MAX+1)       
-       
-       #define INT_FAST16_MAX (UINT_FAST16_MAX>>1)
-       #define INT_FAST16_MIN (INT_FAST16_MAX+1)
-       
-       /* now define equiv. constants */
-       #define UINT_FAST8_MAX UINT8_MAX
-       #define UINT_FAST8_MIN UINT_FAST8_MIN
-       #define INT_FAST8_MAX INT8_MAX
-       #define INT_FAST8_MIN INT8_MIN
-       #define UINT_FAST32_MAX UINT32_MAX
-       #define UINT_FAST32_MIN UINT32_MIN
-       #define INT_FAST32_MAX INT32_MAX
-       #define INT_FAST32_MIN INT32_MIN
-       #define UINT_FAST64_MAX UINT64_MAX
-       #define UINT_FAST64_MIN UINT64_MIN
-       #define INT_FAST64_MAX INT64_MAX
-       #define INT_FAST64_MIN INT64_MIN
-       
-       #define UINT_LEAST8_MAX UINT8_MAX
-       #define UINT_LEAST8_MIN UINT8_MIN
-       #define INT_LEAST8_MAX INT8_MAX
-       #define INT_LEAST8_MIN INT8_MIN
-       #define UINT_LEAST16_MAX UINT16_MAX
-       #define UINT_LEAST16_MIN UINT16_MIN
-       #define INT_LEAST16_MAX INT16_MAX
-       #define INT_LEAST16_MIN INT16_MIN
-       #define UINT_LEAST32_MAX UINT32_MAX
-       #define UINT_LEAST32_MIN UINT32_MIN
-       #define INT_LEAST32_MAX INT32_MAX
-       #define INT_LEAST32_MIN INT32_MIN
-       #define UINT_LEAST64_MAX UINT64_MAX
-       #define UINT_LEAST64_MIN UINT64_MIN
-       #define INT_LEAST64_MAX INT64_MAX
-       #define INT_LEAST64_MIN INT64_MIN
-       
-       #define UINTMAX_MAX UINT64_MAX
-       #define UINTMAX_MIN UINT64_MIN
-       #define INTMAX_MAX INT64_MAX
-       #define INTMAX_MIN INT64_MIN
-       
+       #include_next <arch/../regs.h>
        #endif
        _EndOfHeader_;
 };
@@ -568,6 +468,20 @@ fix = {
        _EndOfHeader_;
 };
 
+/*
+ * assert.h on AIX 7 redefines static_assert as _Static_assert without
+ * protecting C++.
+ */
+fix = {
+    hackname  = aix_assert;
+    mach      = "*-*-aix*";
+    files     = assert.h;
+    select    = "#define[ \t]static_assert[ \t]_Static_assert";
+    c_fix     = format;
+    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
+    test_text = "#define static_assert _Static_assert";
+};
+
 /*
  * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
  * which only is provided by AIX xlc C99.
@@ -582,6 +496,56 @@ fix = {
     test_text = "#define _Complex_I    __I\n";
 };
 
+/*
+ *  On AIX some headers are not properly guarded by 'extern "C"'.
+ */
+fix = {
+  hackname  = aix_externc;
+  mach      = "*-*-aix*";
+  files     = ctype.h;
+  files     = fcntl.h;
+  files     = langinfo.h;
+  files     = ldfcn.h;
+  files     = sys/localedef.h;
+  files     = sys/times.h;
+  bypass    = "extern \"C\"";
+  c_fix     = wrap;
+  c_fix_arg = "#ifdef __cplusplus\n"
+              "extern \"C\" {\n"
+              "#endif\n";
+  c_fix_arg = "#ifdef __cplusplus\n"
+              "}\n"
+              "#endif\n";
+  test_text = "extern int __n_pthreads;\n";
+};
+
+/*
+ *  On AIX sys/socket.h assumes C++.
+ */
+fix = {
+  hackname  = aix_externcpp1;
+  mach      = "*-*-aix*";
+  files     = "sys/socket.h";
+  select    = "#ifdef __cplusplus";
+  c_fix     = format;
+  c_fix_arg = "#ifdef __cplusplus\n"
+              "extern \"C++\" {";
+  test_text = "#ifdef __cplusplus";
+
+};
+
+fix = {
+  hackname  = aix_externcpp2;
+  mach      = "*-*-aix*";
+  files     = "sys/socket.h";
+  select    = "#else  /\\* __cplusplus \\*/";
+  c_fix     = format;
+  c_fix_arg = "} /* extern \"C++\" */\n"
+              "#else  /* __cplusplus */";
+  test_text = "#else  /* __cplusplus */";
+
+};
+
 /*
  *  malloc.h on AIX6 uses XLC++ specific builtin syntax
  */
@@ -713,7 +677,7 @@ fix = {
 fix = {
     hackname  = aix_pthread;
     files     = "pthread.h";
-    select    = "(#define [A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
+    select    = "(#define[\t ][A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
     c_fix     = format;
     c_fix_arg = "%1 %2";
     test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
@@ -827,12 +791,109 @@ fix = {
                "#define UINT16_C(c)    __CONCAT__(c,U)";
 };
 
+/*
+ * stdio.h on AIX defines ferror, clearerr and feof as C++ inline, which
+   produces wrong code with G++.
+ */
+fix = {
+    hackname  = aix_stdio_inline;
+    mach      = "*-*-aix*";
+    files     = stdio.h;
+    select    = "#ifdef __cplusplus\\\n"
+                "}\\\n\\\n"
+                "#ifdef ferror\\\n";
+    c_fix     = format;
+    c_fix_arg = "#ifdef __cplusplus\n"
+                "}\n"
+                "#endif\n\n"
+                "#if (defined(__cplusplus) && defined(__IBMCPP__))\n"
+                "#ifdef ferror\n";
+    test_text = "#ifdef __cplusplus\n}\n\n#ifdef ferror";
+};
+
+/*
+ * stdlib.h on AIX uses #define on malloc and friends.
+ */
+fix = {
+    hackname  = aix_stdlib_malloc;
+    mach      = "*-*-aix*";
+    files     = stdlib.h;
+    select    = "#define[ \t]+malloc[ \t]+__linux_malloc";
+    c_fix     = format;
+    c_fix_arg = "extern void *malloc(size_t) __asm__(\"__linux_malloc\");";
+    test_text = "#define malloc __linux_malloc";
+};
+
+fix = {
+    hackname  = aix_stdlib_realloc;
+    mach      = "*-*-aix*";
+    files     = stdlib.h;
+    select    = "#define[ \t]+realloc[ \t]+__linux_realloc";
+    c_fix     = format;
+    c_fix_arg = "extern void *realloc(void *, size_t) __asm__(\"__linux_realloc\");";
+    test_text = "#define realloc __linux_realloc";
+};
+
+fix = {
+    hackname  = aix_stdlib_calloc;
+    mach      = "*-*-aix*";
+    files     = stdlib.h;
+    select    = "#define[ \t]+calloc[ \t]+__linux_calloc";
+    c_fix     = format;
+    c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"__linux_calloc\");";
+    test_text = "#define calloc __linux_calloc";
+};
+
+fix = {
+    hackname  = aix_stdlib_valloc;
+    mach      = "*-*-aix*";
+    files     = stdlib.h;
+    select    = "#define[ \t]+valloc[ \t]+__linux_valloc";
+    c_fix     = format;
+    c_fix_arg = "extern void *valloc(size_t) __asm__(\"__linux_valloc\");";
+    test_text = "#define valloc __linux_valloc";
+};
+
+fix = {
+    hackname  = aix_stdlib_vec_malloc;
+    mach      = "*-*-aix*";
+    files     = stdlib.h;
+    select    = "#define[ \t]+malloc[ \t]+vec_malloc";
+    c_fix     = format;
+    c_fix_arg = "extern void *malloc(size_t) __asm__(\"vec_malloc\");";
+    test_text = "#define malloc vec_malloc";
+};
+
+fix = {
+    hackname  = aix_stdlib_vec_calloc;
+    mach      = "*-*-aix*";
+    files     = stdlib.h;
+    select    = "#define[ \t]+calloc[ \t]+vec_calloc";
+    c_fix     = format;
+    c_fix_arg = "extern void *calloc(size_t, size_t) __asm__(\"vec_calloc\");";
+    test_text = "#define calloc vec_calloc";
+};
+
+/*
+ * stdlib.h on AIX 4.3 declares strtof() with a non-const first argument.
+ */
+fix = {
+    hackname  = aix_strtof_const;
+    mach      = "*-*-aix*";
+    files     = stdlib.h;
+    select    = "((extern[ \t]+)?float[ \t]+strtof)\\(char \\*, char \\*\\*\\);";
+    c_fix     = format;
+    c_fix_arg = "%1(const char *, char **);";
+    test_text = "extern float    strtof(char *, char **);";
+};
+
 /*
  *  sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
  *  in an otherwise harmless (and #ifed out) macro definition
  */
 fix = {
     hackname  = aix_sysmachine;
+    mach      = "*-*-aix*";
     files     = sys/machine.h;
     select    = "\\\\ +\n";
     c_fix     = format;
@@ -847,6 +908,7 @@ fix = {
  */
 fix = {
     hackname  = aix_syswait_2;
+    mach      = "*-*-aix*";
     files     = sys/wait.h;
     select    = '\? (\(\(\(\(unsigned[^)]*\)[^)]*\) >> [^)]*\) \& 0xff\) : -1)';
     c_fix     = format;
@@ -863,6 +925,7 @@ fix = {
  */
 fix = {
     hackname  = aix_volatile;
+    mach      = "*-*-aix*";
     files     = sys/signal.h;
     select    = "typedef volatile int sig_atomic_t";
     c_fix     = format;
@@ -870,6 +933,20 @@ fix = {
     test_text = "typedef volatile int sig_atomic_t;";
 };
 
+/*
+ *  AIX unistd.h defines a static function with an empty parameter list.
+ */
+fix = {
+    hackname  = aix_unistd;
+    mach      = "*-*-aix*";
+    files     = unistd.h;
+
+    select    = "[ \t]+static[ \t]+int[ \t]+getdtablesize\\(\\)";
+    c_fix     = format;
+    c_fix_arg = "\tstatic int\t\tgetdtablesize(void)";
+    test_text = "      static int              getdtablesize()";
+};
+
 /*
  *  Fix __assert declaration in assert.h on Alpha OSF/1.
  */
@@ -1194,6 +1271,32 @@ fix = {
     test_text = "extern void* malloc( size_t );";
 };
 
+/*
+ *  macOS 10.12 <AvailabilityInternal.h> uses __attribute__((availability))
+ *  unconditionally.
+ */
+fix = {
+    hackname  = darwin_availabilityinternal;
+    mach      = "*-*-darwin*";
+    files     = AvailabilityInternal.h;
+    select    = "#define[ \t]+(__API_[ADU]\\([^)]*\\)).*";
+    c_fix     = format;
+    c_fix_arg = <<- _EOFix_
+       #if defined(__has_attribute)
+         #if __has_attribute(availability)
+       %0
+         #else
+           #define %1
+         #endif
+       #else
+           #define %1
+       #endif
+       _EOFix_;
+
+    test_text = "#define __API_A(x) __attribute__((availability(__API_AVAILABLE_PLATFORM_##x)))\n"
+               "#define __API_D(msg,x) __attribute__((availability(__API_DEPRECATED_PLATFORM_##x,message=msg)))";
+};
+
 /*
  *  For the AAB_darwin7_9_long_double_funcs fix to be useful,
  *  you have to not use "" includes.
@@ -1251,6 +1354,77 @@ fix = {
              "(__GNUC_MINOR__ >= 1)\n";
 };
 
+/*
+ *  Before Mac OS X 10.8 <i386/setjmp.h> doesn't mark longjump noreturn.
+ */
+fix = {
+    hackname  = darwin_longjmp_noreturn;
+    mach      = "*-*-darwin*";
+    files     = "i386/setjmp.h";
+    bypass    = "__dead2";
+    select    = "(.*longjmp\\(.*jmp_buf.*[^)]+\\));";
+    c_fix     = format;
+    c_fix_arg = "%1 __attribute__ ((__noreturn__));";
+
+    test_text = "void siglongjmp(sigjmp_buf, int);";
+};
+
+/*
+ *  Mac OS X 10.11 <os/trace.h> uses attribute on function definition.
+ */
+fix = {
+  hackname  = darwin_os_trace_1;
+  mach      = "*-*-darwin*";
+  files     = os/trace.h;
+  select    = "^(_os_trace_verify_printf.*) (__attribute__.*)";
+  c_fix     = format;
+  c_fix_arg = "%1";
+  test_text = "_os_trace_verify_printf(const char *msg, ...) __attribute__((format(printf, 1, 2)))";
+};
+
+/*
+ *  Mac OS X 10.1[012] <os/trace.h> os_trace_payload_t typedef uses Blocks
+ *  extension without guard.
+ */
+fix = {
+  hackname  = darwin_os_trace_2;
+  mach      = "*-*-darwin*";
+  files     = os/trace.h;
+  select    = "typedef.*\\^os_trace_payload_t.*";
+  c_fix     = format;
+  c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
+  test_text = "typedef void (^os_trace_payload_t)(xpc_object_t xdict);";
+};
+
+/*
+ *  In Mac OS X 10.1[012] <os/trace.h>, need to guard users of
+ *  os_trace_payload_t typedef, too.
+ */
+fix = {
+  hackname  = darwin_os_trace_3;
+  mach      = "*-*-darwin*";
+  files     = os/trace.h;
+  select    = <<- _EOSelect_
+       __(API|OSX)_.*
+       OS_EXPORT.*
+       .*
+       _os_trace.*os_trace_payload_t payload);
+       _EOSelect_;
+  c_fix     = format;
+  c_fix_arg = "#if __BLOCKS__\n%0\n#endif";
+  test_text = <<- _EOText_
+       __API_AVAILABLE(macosx(10.10), ios(8.0), watchos(2.0), tvos(8.0))
+       OS_EXPORT OS_NOTHROW OS_NOT_TAIL_CALLED
+       void
+       _os_trace_with_buffer(void *dso, const char *message, uint8_t type, const void *buffer, size_t buffer_size, os_trace_payload_t payload);
+
+       __OSX_AVAILABLE_STARTING(__MAC_10_12, __IPHONE_10_0)
+       OS_EXPORT OS_NOTHROW
+       void
+       _os_trace_internal(void *dso, uint8_t type, const char *format, const uint8_t *buf, size_t buf_size, os_trace_payload_t payload);
+       _EOText_;
+};
+
 /*
  *  __private_extern__ doesn't exist in FSF GCC.  Even if it did,
  *  why would you ever put it in a system header file?
@@ -1494,6 +1668,60 @@ fix = {
     test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
 };
 
+/*
+ *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
+ *  that fails when compiling for SSE-less 32-bit x86.
+ */
+fix = {
+    hackname  = feraiseexcept_nosse_divbyzero;
+    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+    files     = bits/fenv.h, '*/bits/fenv.h';
+    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
+               ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
+    bypass    = "\"fdivp .*; fwait\"";
+    
+    c_fix     = format;
+    c_fix_arg = <<- _EOText_
+       # ifdef __SSE_MATH__
+       %0
+       # else
+       %1__asm__ __volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
+       %1                      : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+       # endif
+       _EOText_;
+
+    test_text = <<- _EOText_
+         __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+       _EOText_;
+};
+
+/*
+ *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
+ *  that fails when compiling for SSE-less 32-bit x86.
+ */
+fix = {
+    hackname  = feraiseexcept_nosse_invalid;
+    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+    files     = bits/fenv.h, '*/bits/fenv.h';
+    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
+               ": \"x\" \\(__f\\)\\);$";
+    bypass    = "\"fdiv .*; fwait\"";
+    
+    c_fix     = format;
+    c_fix_arg = <<- _EOText_
+       # ifdef __SSE_MATH__
+       %0
+       # else
+       %1__asm__ __volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
+       %1                      : "=t" (__f) : "0" (__f));
+       # endif
+       _EOText_;
+
+    test_text = <<- _EOText_
+         __asm__ __volatile__ ("divss %0, %0" : : "x" (__f));
+       _EOText_;
+};
+
 /*
  *  Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume
  *  neither the existence of GCC 3 nor its exact feature set yet break
@@ -1619,7 +1847,8 @@ fix = {
  */
 fix = {
     hackname  = glibc_c99_inline_4;
-    files     = sys/sysmacros.h, '*/sys/sysmacros.h', wchar.h, '*/wchar.h';
+    files     = sys/sysmacros.h, '*/sys/sysmacros.h', wchar.h, '*/wchar.h',
+    pthread.h, '*/pthread.h';
     bypass    = "__extern_inline|__gnu_inline__";
     select    = "(^| )extern __inline";
     c_fix     = format;
@@ -1724,7 +1953,7 @@ fix = {
    versions.  */
 fix = {
     hackname  = glibc_strncpy;
-    files     = bits/string2.h;
+    files     = bits/string2.h, '*/bits/string2.h';
     bypass    = "__builtin_strncpy";
     c_fix     = format;
     c_fix_arg = "#  define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
@@ -1979,6 +2208,24 @@ fix = {
     test_text = "#  define _iob __iob\n";
 };
 
+/*
+ *  The HP-UX stddef.h is replaced by gcc's. It doesn't include sys/stdsyms.h.
+ *  As a result, we need to include sys/stdsyms.h in alloca.h.
+ */
+fix = {
+    hackname  = hppa_hpux11_alloca;
+    mach      = "hppa*-*-hpux11*";
+    files     = alloca.h;
+    select    = "#ifndef _STDDEF_INCLUDED";
+    c_fix     = format;
+    c_fix_arg = "#ifndef _SYS_STDSYMS_INCLUDED\n"
+               "#  include <sys/stdsyms.h>\n"
+               "#endif /* _SYS_STDSYMS_INCLUDED */\n\n"
+               "%0";
+
+    test_text = "#ifndef _STDDEF_INCLUDED";
+};
+
 /*
  *  Make sure hpux defines abs in header.
  */
@@ -1993,17 +2240,58 @@ fix = {
 };
 
 /*
- *  Keep HP-UX 11 from stomping on C++ math namespace
- *  with defines for fabsf.
+ *  Fix hpux11 __LWP_RWLOCK_VALID define
  */
 fix = {
-    hackname  = hpux11_fabsf;
-    files     = math.h;
-    select    = "^[ \t]*#[ \t]*define[ \t]+fabsf\\(.*";
-    bypass    = "__cplusplus";
-
+    hackname  = hpux11_lwp_rwlock_valid;
+    mach      = "*-hp-hpux11*";
+    files     = sys/pthread.h;
+    select    = "#define __LWP_RWLOCK_VALID[ \t]*0x8c91";
     c_fix     = format;
-    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
+    c_fix_arg = "#define __LWP_RWLOCK_VALID              -29551";
+    test_text = "#define __LWP_RWLOCK_VALID 0x8c91";
+};
+
+/*
+ * hpux sendfile()
+ */
+fix = {
+    hackname  = hpux11_extern_sendfile;
+    mach      = "*-hp-hpux11.[12]*";
+    files     = sys/socket.h;
+    select    = "^[ \t]*extern sbsize_t sendfile.*\n.*, int\\)\\);\n";
+    c_fix     = format;
+    c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
+    test_text = "   extern sbsize_t sendfile __((int, int, off_t, bsize_t,\n"
+        "                               const struct iovec *, int));\n";
+};
+
+/*
+ * hpux sendpath()
+ */
+fix = {
+    hackname  = hpux11_extern_sendpath;
+    mach      = "*-hp-hpux11.[12]*";
+    files     = sys/socket.h;
+    select    = "^[ \t]*extern sbsize_t sendpath.*\n.*, int\\)\\);\n";
+    c_fix     = format;
+    c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
+    test_text = "   extern sbsize_t sendpath __((int, int, off_t, bsize_t,\n"
+        "                               const struct iovec *, int));\n";
+};
+
+/*
+ *  Keep HP-UX 11 from stomping on C++ math namespace
+ *  with defines for fabsf.
+ */
+fix = {
+    hackname  = hpux11_fabsf;
+    mach      = "*-hp-hpux11*";
+    files     = math.h;
+    select    = "^[ \t]*#[ \t]*define[ \t]+fabsf\\(.*";
+
+    c_fix     = format;
+    c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
 
     test_text =
     "#ifdef _PA_RISC\n"
@@ -2012,16 +2300,34 @@ fix = {
 };
 
 /*
- *  Fix C99 constant in __POINTER_SET define.
+ *  The definitions for PTHREAD_MUTEX_INITIALIZER and similar initializers
+ *  in pthread.h need to be constant expressions to be standard complient.
+ *  As a result, we need to remove the void * casts in the initializers
+ *  (see hpux11_pthread_const) and to change the __(M|C|RW)POINTER defines
+ *  to use the long type.
+ */
+fix = {
+    hackname  = hpux11_pthread_pointer;
+    mach      = "*-hp-hpux11.[0-3]*";
+    files     = sys/pthread.h;
+    select    = "(void[ \t]*\\*)(m|c|rw)(_ptr)";
+
+    c_fix     = format;
+    c_fix_arg = "long\t%2%3";
+    test_text = "#define __MPOINTER\t\tvoid\t *m_ptr";
+};
+
+/*
+ *  Remove void pointer cast and fix C99 constant in __POINTER_SET defines.
  */
 fix = {
     hackname  = hpux11_pthread_const;
     mach      = "*-hp-hpux11.[0-3]*";
     files     = sys/pthread.h;
-    select    = "^#define[ \t]*__POINTER_SET[ \t]*\\(\\(void \\*\\) 1LL\\)";
+    select    = "^(#define[ \t]+__POINTER_SET[ \t0,]*)(.*\\))";
 
     c_fix     = format;
-    c_fix_arg = "#define __POINTER_SET\t\t((void *) 1L)";
+    c_fix_arg = "%11";
     test_text = "#define __POINTER_SET\t\t((void *) 1LL)";
 };
 
@@ -2075,6 +2381,20 @@ fix = {
                                      ' __va__list);';
 };
 
+/*
+ *  Fix missing const in hpux vsscanf declaration
+ */
+fix = {
+    hackname = hpux_vsscanf;
+    mach    = "*-*-hpux*";
+    files   = stdio.h;
+    select  = '(extern int vsscanf\()char';
+    c_fix   = format;
+    c_fix_arg = "%1const char";
+
+    test_text = 'extern int vsscanf(char *, const char *, __va_list);';
+};
+
 /*
  *  get rid of bogus inline definitions in HP-UX 8.0
  */
@@ -2092,6 +2412,76 @@ fix = {
                 "inline double sqr(double v) { return v**0.5; }";
 };
 
+/*
+ * hpux intptr
+ */
+fix = {
+    hackname  = hpux_c99_intptr;
+    mach      = "*-hp-hpux11.3*";
+    files     = stdint-hpux11.h, stdint.h;
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*"
+        "INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*"
+        "INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*"
+        "INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*"
+        "INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*"
+        "UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*"
+        "UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@";
+    test_text = "#define PTRDIFF_MAX   INT32_MAX\n"
+               "#define PTRDIFF_MIN    INT32_MIN\n"
+               "#define INTPTR_MAX     INT32_MAX\n"
+               "#define INTPTR_MIN     INT32_MIN\n"
+               "#define UINTPTR_MAX    UINT32_MAX\n"
+               "#define SIZE_MAX       UINT32_MAX\n";
+};
+
+/*
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ */
+fix = {
+    hackname  = hpux_c99_inttypes;
+    mach      = "*-hp-hpux11.[23]*";
+    files     = inttypes.h;
+    files     = stdint-hpux11.h, stdint.h;
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*"
+        "__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*"
+        "__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*"
+        "__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT32_C(__c)[ \t].*$@"
+        "#define UINT32_C(__c) __CONCAT__(__c,u)@";
+    test_text = "#define UINT8_C(__c)     __CONCAT_U__(__c)\n"
+                "#define UINT16_C(__c)    __CONCAT_U__(__c)\n"
+               "#define INT32_C(__c)     __CONCAT__(__c,l)\n"
+               "#define UINT32_C(__c)     __CONCAT__(__c,ul)\n";
+};
+
+/*
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ */
+fix = {
+    hackname  = hpux_c99_inttypes2;
+    mach      = "*-hp-hpux11.2*";
+    files     = stdint-hpux11.h, stdint.h;
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*"
+        "((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*"
+        "((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*"
+        "((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@";
+    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*"
+        "((unsigned short)(__c))[ \t]*$@#define UINT16_C(__c) (__c)@";
+    test_text = "#  define     INT8_C(__c)     ((signed char)(__c))\n"
+                "#  define      UINT8_C(__c)    ((unsigned char)(__c))\n"
+               "#  define      INT16_C(__c)    ((short)(__c))\n"
+               "#  define      UINT16_C(__c)   ((unsigned short)(__c))\n";
+};
+
 /*
  *  Fix hpux broken ctype macros
  */
@@ -2107,6 +2497,26 @@ fix = {
                "# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS\n";
 };
 
+/*
+ * hpux errno()
+ */
+fix = {
+    hackname  = hpux_extern_errno;
+    mach      = "*-hp-hpux10.*";
+    mach      = "*-hp-hpux11.[0-2]*";
+    files     = errno.h;
+    select    = "^[ \t]*extern int errno;$";
+    c_fix     = format;
+    c_fix_arg = "#ifdef __cplusplus\n"
+        "extern \"C\" {\n"
+        "#endif\n"
+        "%0\n"
+        "#ifdef __cplusplus\n"
+        "}\n"
+        "#endif";
+    test_text = "   extern int errno;\n";
+};
+
 /*
  *  Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
  */
@@ -2134,6 +2544,33 @@ fix = {
                 "#endif  /* ! _XOPEN_SOURCE_EXTENDED */";
 };
 
+/*
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ */
+fix = {
+    hackname  = hpux_imaginary_i;
+    mach      = "ia64-hp-hpux11.*";
+    files     = complex.h;
+    select    = "^[ \t]*#[ \t]*define[ \t]*_Complex_I.*";
+    c_fix     = format;
+    c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
+    test_text = "#define _Complex_I (0.f+_Imaginary_I)\n";
+};
+
+/*
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ */
+fix = {
+    hackname  = hpux_inttype_int8_t;
+    mach      = "*-hp-hpux1[01].*";
+    files     = sys/_inttypes.h;
+    select    = "^[ \t]*typedef[ \t]*char[ \t]*int(_least){0,1}8_t.*";
+    c_fix     = format;
+    c_fix_arg = "typedef signed char int%18_t;";
+    test_text = "typedef char int_least8_t;\n"
+                "typedef char int8_t;\n";
+};
+
 /*
  * HP-UX long_double
  */
@@ -2156,10 +2593,10 @@ fix = {
                "extern long_double strtold(const char *, char **);\n";
 };
 
- /*
 * We cannot use the above rule on 11.31 because it removes the strtold
 * definition.  ia64 is OK with no hack, PA needs some help.
 */
+/*
+ * We cannot use the above rule on 11.31 because it removes the strtold
+ * definition.  ia64 is OK with no hack, PA needs some help.
+ */
 fix = {
     hackname  = hpux_long_double_2;
     mach      = "hppa*-*-hpux11.3*";
@@ -2175,82 +2612,6 @@ fix = {
         "defined(_LONG_DOUBLE_STRUCT)\n";
 };
 
-/*
- *  Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
- */
-fix = {
-    hackname = hpux_systime;
-    files    = sys/time.h;
-    select   = "^extern struct sigevent;";
-
-    c_fix     = format;
-    c_fix_arg = "struct sigevent;";
-
-    test_text = 'extern struct sigevent;';
-};
-
-/*
- *  Wrap spu_info in ifdef _KERNEL.  GCC cannot handle an array of unknown
- *  type and mpinfou is only defined when _KERNEL is set.
- */
-fix = {
-    hackname = hpux_spu_info;
-    mach     = "*-hp-hpux*";
-    /*
-     *  It is tempting to omit the first "files" entry.  Do not.
-     *  The testing machinery will take the first "files" entry as the name
-     *  of a test file to play with.  It would be a nuisance to have a directory
-     *  with the name "*".
-     */
-    files    = "ia64/sys/getppdp.h";
-    files    = "*/sys/getppdp.h";
-    select   = "^.*extern.*spu_info.*";
-
-    c_fix     = format;
-    c_fix_arg = "#ifdef _KERNEL\n%0\n#endif";
-
-    test_text = "extern union mpinfou spu_info[];";
-};
-
-fix = {
-    hackname  = hpux11_extern_sendfile;
-    mach      = "*-hp-hpux11.[12]*";
-    files     = sys/socket.h;
-    select    = "^[ \t]*extern sbsize_t sendfile.*\n.*, int\\)\\);\n";
-    c_fix     = format;
-    c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
-    test_text = "   extern sbsize_t sendfile __((int, int, off_t, bsize_t,\n"
-        "                               const struct iovec *, int));\n";
-};
-
-fix = {
-    hackname  = hpux11_extern_sendpath;
-    mach      = "*-hp-hpux11.[12]*";
-    files     = sys/socket.h;
-    select    = "^[ \t]*extern sbsize_t sendpath.*\n.*, int\\)\\);\n";
-    c_fix     = format;
-    c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
-    test_text = "   extern sbsize_t sendpath __((int, int, off_t, bsize_t,\n"
-        "                               const struct iovec *, int));\n";
-};
-
-fix = {
-    hackname  = hpux_extern_errno;
-    mach      = "*-hp-hpux10.*";
-    mach      = "*-hp-hpux11.[0-2]*";
-    files     = errno.h;
-    select    = "^[ \t]*extern int errno;$";
-    c_fix     = format;
-    c_fix_arg = "#ifdef __cplusplus\n"
-        "extern \"C\" {\n"
-        "#endif\n"
-        "%0\n"
-        "#ifdef __cplusplus\n"
-        "}\n"
-        "#endif";
-    test_text = "   extern int errno;\n";
-};
-
 /*
  *  Add missing braces to pthread initializer defines.
  */
@@ -2293,71 +2654,32 @@ fix = {
                "}\n";
 };
 
+/*
+ *  Wrap spu_info in ifdef _KERNEL.  GCC cannot handle an array of unknown
+ *  type and mpinfou is only defined when _KERNEL is set.
+ */
 fix = {
-    hackname  = hpux_c99_intptr;
-    mach      = "*-hp-hpux11.3*";
-    files     = stdint-hpux11.h, stdint.h;
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*"
-        "INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*"
-        "INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*"
-        "INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*"
-        "INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*"
-        "UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*"
-        "UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@";
-    test_text = "#define PTRDIFF_MAX   INT32_MAX\n"
-               "#define PTRDIFF_MIN    INT32_MIN\n"
-               "#define INTPTR_MAX     INT32_MAX\n"
-               "#define INTPTR_MIN     INT32_MIN\n"
-               "#define UINTPTR_MAX    UINT32_MAX\n"
-               "#define SIZE_MAX       UINT32_MAX\n";
+    hackname = hpux_spu_info;
+    mach     = "*-hp-hpux*";
+    /*
+     *  It is tempting to omit the first "files" entry.  Do not.
+     *  The testing machinery will take the first "files" entry as the name
+     *  of a test file to play with.  It would be a nuisance to have a directory
+     *  with the name "*".
+     */
+    files    = "ia64/sys/getppdp.h";
+    files    = "*/sys/getppdp.h";
+    select   = "^.*extern.*spu_info.*";
+
+    c_fix     = format;
+    c_fix_arg = "#ifdef _KERNEL\n%0\n#endif";
+
+    test_text = "extern union mpinfou spu_info[];";
 };
 
 /*
  * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
  */
-
-fix = {
-    hackname  = hpux_c99_inttypes;
-    mach      = "*-hp-hpux11.[23]*";
-    files     = inttypes.h;
-    files     = stdint-hpux11.h, stdint.h;
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*"
-        "__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*"
-        "__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*"
-        "__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT32_C(__c)[ \t].*$@"
-        "#define UINT32_C(__c) __CONCAT__(__c,u)@";
-    test_text = "#define UINT8_C(__c)     __CONCAT_U__(__c)\n"
-                "#define UINT16_C(__c)    __CONCAT_U__(__c)\n"
-               "#define INT32_C(__c)     __CONCAT__(__c,l)\n"
-               "#define UINT32_C(__c)     __CONCAT__(__c,ul)\n";
-};
-
-fix = {
-    hackname  = hpux_c99_inttypes2;
-    mach      = "*-hp-hpux11.2*";
-    files     = stdint-hpux11.h, stdint.h;
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*"
-        "((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*"
-        "((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*"
-        "((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@";
-    sed       = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*"
-        "((unsigned short)(__c))[ \t]*$@#define UINT16_C(__c) (__c)@";
-    test_text = "#  define     INT8_C(__c)     ((signed char)(__c))\n"
-                "#  define      UINT8_C(__c)    ((unsigned char)(__c))\n"
-               "#  define      INT16_C(__c)    ((short)(__c))\n"
-               "#  define      UINT16_C(__c)   ((unsigned short)(__c))\n";
-};
-
 fix = {
     hackname  = hpux_stdint_least_fast;
     mach      = "*-hp-hpux11.2*";
@@ -2368,28 +2690,35 @@ fix = {
     c-fix-arg = "#  define     UINT_%164_MAX   __UINT64_MAX__";
     test-text = "#  define       UINT_FAST64_MAX        ULLONG_MAX\n"
                "#  define       UINT_LEAST64_MAX        ULLONG_MAX\n";
-       _EOFix_;
 };
 
+/*
+ *  Add noreturn attribute to longjmp declarations in hpux <setjmp.h>
+ */
 fix = {
-    hackname  = hpux_inttype_int8_t;
-    mach      = "*-hp-hpux1[01].*";
-    files     = sys/_inttypes.h;
-    select    = "^[ \t]*typedef[ \t]*char[ \t]*int(_least){0,1}8_t.*";
+    hackname = hpux_longjmp;
+    mach     = "*-hp-hpux*";
+    files    = setjmp.h;
+    select   = "^[ \t]*extern[ \t]+void[ \t]+.*longjmp[ \t]*\(__\\(\\(.*int\\)\\)|\\(.*int\\)|\\(\\)\)";
+
     c_fix     = format;
-    c_fix_arg = "typedef signed char int%18_t;";
-    test_text = "typedef char int_least8_t;\n"
-                "typedef char int8_t;\n";
+    c_fix_arg = "%0 __attribute__ ((__noreturn__))";
+
+    test_text = 'extern void   longjmp __((jmp_buf, int));';
 };
 
+/*
+ *  Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
+ */
 fix = {
-    hackname  = hpux_imaginary_i;
-    mach      = "ia64-hp-hpux11.*";
-    files     = complex.h;
-    select    = "^[ \t]*#[ \t]*define[ \t]*_Complex_I.*";
+    hackname = hpux_systime;
+    files    = sys/time.h;
+    select   = "^extern struct sigevent;";
+
     c_fix     = format;
-    c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
-    test_text = "#define _Complex_I (0.f+_Imaginary_I)\n";
+    c_fix_arg = "struct sigevent;";
+
+    test_text = 'extern struct sigevent;';
 };
 
 /*
@@ -2397,7 +2726,7 @@ fix = {
  */
 fix = {
     hackname  = huge_val_hex;
-    files     = bits/huge_val.h;
+    files     = bits/huge_val.h, '*/bits/huge_val.h';
     select    = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
     bypass    = "__builtin_huge_val";
 
@@ -2412,7 +2741,7 @@ fix = {
  */
 fix = {
     hackname  = huge_valf_hex;
-    files     = bits/huge_val.h;
+    files     = bits/huge_val.h, '*/bits/huge_val.h';
     select    = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
     bypass    = "__builtin_huge_valf";
 
@@ -2427,7 +2756,7 @@ fix = {
  */
 fix = {
     hackname  = huge_vall_hex;
-    files     = bits/huge_val.h;
+    files     = bits/huge_val.h, '*/bits/huge_val.h';
     select    = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
     bypass    = "__builtin_huge_vall";
 
@@ -2565,7 +2894,8 @@ fix = {
     test_text = "#define __CONCAT__(a,b) a/**/b";
 };
 
-/* The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
+/*
+ * The /usr/include/sys/ucontext.h on ia64-*linux-gnu systems defines
  * an _SC_GR0_OFFSET macro using an idiom that isn't a compile time
  * constant on recent versions of g++.
  */
@@ -2661,6 +2991,9 @@ fix = {
      */
     bypass    = 'We have a problem when using C\+\+|for C\+\+, '
                '_[a-z0-9A-Z_]+_exception; for C, exception';
+    /* The Solaris 10 headers already get this right.  */
+    mach   = '*-*-solaris2.1[0-9]*';
+    not_machine = true;
     c_fix     = wrap;
 
     c_fix_arg = "#ifdef __cplusplus\n"
@@ -2778,9 +3111,11 @@ fix = {
     test_text = "#define __END_DECLS };";
 };
 
-/* newlib's stdint.h has several failures to conform to C99.  The fix
-   for these removed a comment that can be matched to identify unfixed
-   versions.  */
+/*
+ * newlib's stdint.h has several failures to conform to C99.  The fix
+ *  for these removed a comment that can be matched to identify unfixed
+ *  versions.
+ */
 fix = {
     hackname  = newlib_stdint_1;
     files     = stdint-newlib.h, stdint.h;
@@ -3228,18 +3563,111 @@ fix = {
 };
 
 /*
- *  Before Solaris 10, <iso/setjmp_iso.h> doesn't mark longjump noreturn.
+ *  Solaris <iso/stdio_iso.h> should deprecate gets before C11.
  */
 fix = {
-    hackname  = solaris_longjmp_noreturn;
+    hackname  = solaris_gets_c11;
     mach      = "*-*-solaris2*";
-    files     = "iso/setjmp_iso.h";
-    bypass    = "__NORETURN";
-    select    = "(.*longjmp\\(jmp_buf.*[^)]+\\));";
+    files     = "iso/stdio_iso.h";
+    select    = "(extern char[ \t]*\\*gets\\(char \\*\\));";
+
     c_fix     = format;
-    c_fix_arg = "%1 __attribute__ ((__noreturn__));";
+    c_fix_arg = "#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L\n"
+               "%1 __attribute__((__deprecated__));\n"
+               "#endif";
 
-    test_text = "extern void longjmp(jmp_buf, int);";
+    test_text = "extern char   *gets(char *);";
+};
+
+/*
+ *  Solaris <iso/stdio_iso.h> shouldn't declare gets for C++14.
+ */
+fix = {
+    hackname  = solaris_gets_cxx14;
+    mach      = "*-*-solaris2*";
+    files     = "iso/stdio_iso.h";
+    select    = <<- _EOSelect_
+(#if __STDC_VERSION__ < 201112L)
+(extern char   \*gets\(char \*\) __ATTR_DEPRECATED;)
+_EOSelect_;
+    c_fix     = format;
+    c_fix_arg = "%1 && __cplusplus < 201402L\n%2";
+
+    test_text = <<- _EOText_
+#if __STDC_VERSION__ < 201112L
+extern char    *gets(char *) __ATTR_DEPRECATED;
+_EOText_;
+};
+
+/*
+ * Sun Solaris 2 has a version of sys/int_const.h that defines
+ * UINT8_C and UINT16_C to unsigned constants.
+ */
+fix = {
+    hackname  = solaris_int_const;
+    files     = sys/int_const.h;
+    mach      = '*-*-solaris2*';
+    c_fix     = format;
+    c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
+                "%1\n"
+                "#define\tUINT16_C(c)\t(c)";
+    select    = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
+                "(/\*.*\*/)\n"
+                "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
+    test_text =
+    "#define   UINT8_C(c)      __CONCAT__(c,u)\n"
+    "/* CSTYLED */\n"
+    "#define   UINT16_C(c)     __CONCAT__(c,u)";
+};
+
+/*
+ * Sun Solaris 2 has a version of sys/int_limits.h that defines
+ * UINT8_MAX and UINT16_MAX to unsigned constants.
+ */
+fix = {
+    hackname  = solaris_int_limits_1;
+    files     = sys/int_limits.h;
+    mach      = '*-*-solaris2*';
+    c_fix     = format;
+    c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
+                "#define\tUINT16_MAX\t(65535)";
+    select    = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
+                "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
+    test_text =
+    "#define   UINT8_MAX       (255U)\n"
+    "#define   UINT16_MAX      (65535U)";
+};
+
+/*
+ * Sun Solaris 2 has a version of sys/int_limits.h that defines
+ * INT_FAST16 limits to wrong values for sys/int_types.h.
+ */
+fix = {
+    hackname  = solaris_int_limits_2;
+    files     = sys/int_limits.h;
+    mach      = '*-*-solaris2*';
+    c_fix     = format;
+    c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
+    select    = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
+    test_text =
+    "#define   INT_FAST16_MAX INT16_MAX\n"
+    "#define   UINT_FAST16_MAX UINT16_MAX\n"
+    "#define   INT_FAST16_MIN  INT16_MIN";
+};
+
+/*
+ * Sun Solaris 2 has a version of sys/int_limits.h that defines
+ * SIZE_MAX as unsigned long.
+ */
+fix = {
+    hackname  = solaris_int_limits_3;
+    files     = sys/int_limits.h;
+    mach      = '*-*-solaris2*';
+    c_fix     = format;
+    c_fix_arg = "#define\tSIZE_MAX\t4294967295U";
+    select    = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
+    test_text =
+    "#define   SIZE_MAX        4294967295UL";
 };
 
 /*
@@ -3265,6 +3693,35 @@ fix = {
     "#define   HUGE_VALL       __builtin_huge_vall";
 };
 
+/*
+ * On Solaris 11, if you do isinf(NaN) you'll get a floating point
+ * exception.  Provide an alternative using GCC's builtin.
+ */
+fix = {
+    hackname  = solaris_math_10;
+    select    = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+    files     = iso/math_c99.h;
+    c_fix     = format;
+    c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
+    c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
+                "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);"
+                    "[ \t]*\\\\\n"
+                "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
+                    "INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
+                "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
+                    "\\(-INFINITY\\);[ \t]*\\}\\)";
+    test_text =
+    '#pragma ident     "@(#)math_c99.h 1.12    07/01/21 SMI"'"\n"
+    "#undef    isinf\n"
+    "#define   isinf(x)        __extension__( \\\\\n"
+    "                  { __typeof(x) __x_i = (x); \\\\\n"
+    "                  __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
+    "                  __x_i == (__typeof(__x_i)) (-INFINITY); })";
+};
+
+/*
+ * Solaris math INFINITY
+ */
 fix = {
     hackname = solaris_math_2;
     select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
@@ -3279,6 +3736,9 @@ fix = {
     "#define   INFINITY        __builtin_infinity";
 };
 
+/*
+ * Solaris math NAN
+ */
 fix = {
     hackname = solaris_math_3;
     select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
@@ -3293,6 +3753,9 @@ fix = {
     "#define   NAN     __builtin_nan";
 };
 
+/*
+ * Solaris math fpclassify
+ */
 fix = {
     hackname = solaris_math_4;
     select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
@@ -3309,6 +3772,9 @@ fix = {
     "#define   fpclassify(x)   __builtin_fpclassify(x)";
 };
 
+/*
+ * Solaris math signbit
+ */
 fix = {
     hackname = solaris_math_8;
     select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
@@ -3328,6 +3794,9 @@ fix = {
        _EOText_;
 };
 
+/*
+ * Solaris math comparison macros
+ */
 fix = {
     hackname = solaris_math_9;
     select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
@@ -3354,68 +3823,106 @@ fix = {
 };
 
 /*
- * On Solaris 11, if you do isinf(NaN) you'll get a floating point
- * exception.  Provide an alternative using GCC's builtin.
+ * Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing
+ * warnings.
  */
+fix = {
+    hackname = solaris_math_11;
+    select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ ";
+    files = iso/math_c99.h;
+    c_fix = format;
+    c_fix_arg = << _EOArg_
+#undef signbit
+#define        signbit(x)      (sizeof(x) == sizeof(float) \
+                          ? __builtin_signbitf(x) \
+                          : sizeof(x) == sizeof(long double) \
+                            ? __builtin_signbitl(x) \
+                            : __builtin_signbit(x))
+_EOArg_;
+    c_fix_arg = << _EOArg_
+^#undef[       ]+signbit
+#if defined\(__sparc\)
+#define[       ]+signbit\(x\)[         ]+__extension__\( \\
+[      ]+\{[   ]*__typeof\(x\)[        ]*__x_s[        ]*=[    ]*\(x\);[       ]*\\
+[      ]+\(int\)[      ]*\(\*\(unsigned[       ]*\*\)[         ]*\&__x_s[      ]*>>[   ]*31\);[        ]*\}\)
+#elif defined\(__i386\) \|\| defined\(__amd64\)
+#define[       ]+signbit\(x\)[         ]+__extension__\( \\
+[      ]+\{ __typeof\(x\) __x_s = \(x\); \\
+[      ]+\(sizeof \(__x_s\) == sizeof \(float\) \? \\
+[      ]+\(int\) \(\*\(unsigned \*\) \&__x_s >> 31\) : \\
+[      ]+sizeof \(__x_s\) == sizeof \(double\) \? \\
+[      ]+\(int\) \(\(\(unsigned \*\) \&__x_s\)\[1\] >> 31\) : \\
+[      ]+\(int\) \(\(\(unsigned short \*\) \&__x_s\)\[4\] >> 15\)\); \}\)
+#endif
+_EOArg_;
+    test_text = << _EOText_
+/* @(#)math_c99.h      1.14    13/03/27 */
+#undef signbit
+#if defined(__sparc)
+#define        signbit(x)      __extension__( \\
+                               { __typeof(x) __x_s = (x); \\
+                               (int) (*(unsigned *) &__x_s >> 31); })
+#elif defined(__i386) || defined(__amd64)
+#define        signbit(x)      __extension__( \\
+                       { __typeof(x) __x_s = (x); \\
+                       (sizeof (__x_s) == sizeof (float) ? \\
+                       (int) (*(unsigned *) &__x_s >> 31) : \\
+                       sizeof (__x_s) == sizeof (double) ? \\
+                       (int) (((unsigned *) &__x_s)[1] >> 31) : \\
+                       (int) (((unsigned short *) &__x_s)[4] >> 15)); })
+#endif
+_EOText_;
+};
 
+/*
+ * Some versions of Solaris 10+ <math.h> #undef libstdc++-internal macros.
+ */
 fix = {
-    hackname  = solaris_math_10;
-    select    = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
-    files     = iso/math_c99.h;
-    c_fix     = format;
-    c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
-    c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
-                "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);"
-                    "[ \t]*\\\\\n"
-                "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
-                    "INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
-                "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
-                    "\\(-INFINITY\\);[ \t]*\\}\\)";
-    test_text =
-    '#pragma ident     "@(#)math_c99.h 1.12    07/01/21 SMI"'"\n"
-    "#undef    isinf\n"
-    "#define   isinf(x)        __extension__( \\\\\n"
-    "                  { __typeof(x) __x_i = (x); \\\\\n"
-    "                  __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
-    "                  __x_i == (__typeof(__x_i)) (-INFINITY); })";
+    hackname  = solaris_math_12;
+    files     = math.h;
+    mach      = '*-*-solaris2*';
+    select    = '#undef.*_GLIBCXX_USE_C99_MATH';
+    sed       = "/#undef[ \t]*_GLIBCXX_USE_C99_MATH/d";
+    test_text = << _EOText_
+#if __cplusplus >= 201103L
+#undef  _GLIBCXX_USE_C99_MATH
+#undef  _GLIBCXX_USE_C99_MATH_TR1
+#endif
+_EOText_;
 };
 
 /*
- * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
- * "0" for the last field of the pthread_mutex_t structure, which is
- * of type upad64_t, which itself is typedef'd to int64_t, but with
- * __STDC__ defined (e.g. by -ansi) it is a union. So change the
- * initializer to "{0}" instead
+ * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
+ * structure.  As such, it need two levels of brackets, but only
+ * contains one.  Wrap the macro definition in an extra layer.
  */
 fix = {
-    hackname = solaris_mutex_init_2;
+    hackname = solaris_once_init_1;
     select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
     files = pthread.h;
-    /*
-     * On Solaris 10, this fix is unnecessary because upad64_t is
-     * always defined correctly regardless of the definition of the
-     * __STDC__ macro.  The first "mach" pattern matches up to
-     * solaris9.  The second "mach" pattern will not match any two (or
-     * more) digit solaris version, but it will match e.g. 2.5.1.
-     */
-    mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
+    mach = '*-*-solaris*';
     c_fix = format;
-    c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
-                "%0\n"
-                "#else\n"
-                "%1, {0}}%4\n"
-                "#endif";
-    c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+"
-                "(|/\*.*\*/[ \t]*\\\\\n[ \t]*)\\{.*)"
-                ",[ \t]*0\\}" "(|[ \t].*)$";
+    c_fix_arg = "%1{%2}%3";
+    c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
     test_text =
-    '#ident "@(#)pthread.h  1.26  98/04/12 SMI"'"\n"
-    "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
-    "#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
-    "#define   PTHREAD_MUTEX_INITIALIZER               /* = DEFAULTMUTEX */    \\\\\n"
-    "  {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}\n"
-    "#define   PTHREAD_COND_INITIALIZER                /* = DEFAULTCV */       \\\\\n"
-    "  {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}";
+    '#pragma ident     "@(#)pthread.h  1.37    04/09/28 SMI"'"\n"
+    "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
+};
+
+/*
+ * Solaris 10+ <spawn.h> uses char *const argv[_RESTRICT_KYWD] in the
+ * posix_spawn declarations, which doesn't work with C++.
+ */
+fix = {
+    hackname  = solaris_posix_spawn_restrict;
+    files     = spawn.h;
+    mach      = '*-*-solaris2*';
+    c_fix     = format;
+    c_fix_arg = "%1*_RESTRICT_KYWD %2%3";
+    select    = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
+    test_text =
+    "char *const argv[_RESTRICT_KYWD],\n"
+    "char *const envp[_RESTRICT_KYWD]);";
 };
 
 /*
@@ -3462,181 +3969,38 @@ fix = {
 };
 
 /*
- * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
- * structure.  As such, it need two levels of brackets, but only
- * contains one.  Wrap the macro definition in an extra layer.
- */
-fix = {
-    hackname = solaris_once_init_1;
-    select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
-    files = pthread.h;
-    mach = '*-*-solaris*';
-    c_fix = format;
-    c_fix_arg = "%1{%2}%3";
-    c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
-    test_text =
-    '#pragma ident     "@(#)pthread.h  1.37    04/09/28 SMI"'"\n"
-    "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
-};
-
-/*
- * Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
- *  fields of the pthread_once_t structure, which are of type
- *  upad64_t, which itself is typedef'd to int64_t, but with __STDC__
- *  defined (e.g. by -ansi) it is a union. So change the initializer
- *  to "{0}" instead.  This test relies on solaris_once_init_1.
- */
-fix = {
-    hackname = solaris_once_init_2;
-    select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
-    files = pthread.h;
-    /*
-     * On Solaris 10, this fix is unnecessary because upad64_t is
-     * always defined correctly regardless of the definition of the
-     * __STDC__ macro.  The first "mach" pattern matches up to
-     * solaris9.  The second "mach" pattern will not match any two (or
-     * more) digit solaris version, but it will match e.g. 2.5.1.
-     */
-    mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
-    c_fix = format;
-    c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
-                "%0\n"
-                "#else\n"
-                "%1{0}, {0}, {0}, {%3}%4\n"
-                "#endif";
-    c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{\\{)"
-                "(0, 0, 0, )(PTHREAD_[A-Z_]+)(\\}\\})[ \t]*$";
-    test_text =
-    '#ident "@(#)pthread.h  1.26  98/04/12 SMI"'"\n"
-    "#define PTHREAD_ONCE_INIT\t{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}\n";
-};
-
-/*
- * Sun Solaris 2 has a version of sys/int_const.h that defines
- * UINT8_C and UINT16_C to unsigned constants.
- */
-fix = {
-    hackname  = solaris_int_const;
-    files     = sys/int_const.h;
-    mach      = '*-*-solaris2*';
-    c_fix     = format;
-    c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
-                "%1\n"
-                "#define\tUINT16_C(c)\t(c)";
-    select    = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
-                "(/\*.*\*/)\n"
-                "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
-    test_text =
-    "#define   UINT8_C(c)      __CONCAT__(c,u)\n"
-    "/* CSTYLED */\n"
-    "#define   UINT16_C(c)     __CONCAT__(c,u)";
-};
-
-/*
- * Sun Solaris 2 has a version of sys/int_limits.h that defines
- * UINT8_MAX and UINT16_MAX to unsigned constants.
- */
-fix = {
-    hackname  = solaris_int_limits_1;
-    files     = sys/int_limits.h;
-    mach      = '*-*-solaris2*';
-    c_fix     = format;
-    c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
-                "#define\tUINT16_MAX\t(65535)";
-    select    = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
-                "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
-    test_text =
-    "#define   UINT8_MAX       (255U)\n"
-    "#define   UINT16_MAX      (65535U)";
-};
-
-/*
- * Sun Solaris 2 has a version of sys/int_limits.h that defines
- * INT_FAST16 limits to wrong values for sys/int_types.h.
- */
-fix = {
-    hackname  = solaris_int_limits_2;
-    files     = sys/int_limits.h;
-    mach      = '*-*-solaris2*';
-    c_fix     = format;
-    c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
-    select    = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
-    test_text =
-    "#define   INT_FAST16_MAX INT16_MAX\n"
-    "#define   UINT_FAST16_MAX UINT16_MAX\n"
-    "#define   INT_FAST16_MIN  INT16_MIN";
-};
-
-/*
- * Sun Solaris 2 has a version of sys/int_limits.h that defines
- * SIZE_MAX as unsigned long.
+ * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
+ * std::__flsbuf, but <iso/stdio_iso.h> uses them.
  */
 fix = {
-    hackname  = solaris_int_limits_3;
-    files     = sys/int_limits.h;
+    hackname  = solaris_std___filbuf;
+    files     = stdio.h;
     mach      = '*-*-solaris2*';
+    bypass    = "using std::__filbuf";
+    select    = "(using std::perror;\n)(#endif)";
     c_fix     = format;
-    c_fix_arg = "#define\tSIZE_MAX\t4294967295U";
-    select    = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
-    test_text =
-    "#define   SIZE_MAX        4294967295UL";
-};
+    c_fix_arg = "%1#ifndef _LP64\n"
+               "using std::__filbuf;\n"
+               "using std::__flsbuf;\n"
+               "#endif\n%2";
 
-/*
- * Sun Solaris up to 9 has a version of sys/int_types.h that forbids use
- * of Standard C99 64-bit types in 32-bit mode.
- */
-fix = {
-    hackname  = solaris_int_types;
-    select    = "__STDC__ - 0 == 0";
-    bypass    = "_LONGLONG_TYPE";
-    files     = sys/int_types.h;
-    c_fix     = format;
-    c_fix_arg =
-    "(defined(_STDC_C99) || !defined(_STRICT_STDC) || defined(__GNUC__))";
-    test_text =
-    "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
-    "typedef   long long               int64_t;\n"
-    "#endif\n\n"
-    "#if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))\n"
-    "typedef int64_t                   intmax_t;\n"
-    "#endif";
+    test_text = "using std::perror;\n"
+               "#endif";
 };
 
 /*
- * Solaris 10+ <spawn.h> uses char *const argv[_RESTRICT_KYWD] in the
- * posix_spawn declarations, which doesn't work with C++.
+ *  Solaris <stdio.h> shouldn't use std::gets for C++14.
  */
 fix = {
-    hackname  = solaris_posix_spawn_restrict;
-    files     = spawn.h;
-    mach      = '*-*-solaris2*';
-    c_fix     = format;
-    c_fix_arg = "%1*_RESTRICT_KYWD %2%3";
-    select    = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
-    test_text =
-    "char *const argv[_RESTRICT_KYWD],\n"
-    "char *const envp[_RESTRICT_KYWD]);";
-};
+    hackname  = solaris_std_gets_cxx14;
+    mach      = "*-*-solaris2*";
+    files     = "stdio.h";
+    select    = "using std::gets;";
 
-/*
- * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
- * std::__flsbuf, but <iso/stdio_iso.h> uses them.
- */
-fix = {
-    hackname  = solaris_std___filbuf;
-    files     = stdio.h;
-    mach      = '*-*-solaris2*';
-    bypass    = "using std::__filbuf";
-    select    = "(using std::perror;\n)(#endif)";
     c_fix     = format;
-    c_fix_arg = "%1#ifndef _LP64\n"
-               "using std::__filbuf;\n"
-               "using std::__flsbuf;\n"
-               "#endif\n%2";
+    c_fix_arg = "#if __cplusplus < 201402L\n%0\n#endif";
 
-    test_text = "using std::perror;\n"
-               "#endif";
+    test_text = "using std::gets;";
 };
 
 /*
@@ -3658,30 +4022,18 @@ fix = {
 };
 
 /*
- * On Solaris 9, __va_list needs to become a typedef for
- * __builtin_va_list to make -Wmissing-format-attribute work.
+ *  Solaris <stdlib.h> shouldn't use _Noreturn, breaks with C++.
  */
 fix = {
-    hackname = solaris_sys_va_list;
-    files    = sys/va_list.h;
-    mach     = '*-*-solaris2.9';
-    select   = "#if.*__STDC__.*\n"
-              "typedef void \\*__va_list;\n"
-              "#else\n"
-              "typedef char \\*__va_list;\n"
-              "#endif";
+    hackname  = solaris_stdlib_noreturn;
+    mach      = "*-*-solaris2*";
+    files     = "iso/stdlib_c99.h";
+    select    = "(extern) _Noreturn (void quick_exit\\(int\\));";
 
-    c_fix    = format;
-    c_fix_arg = "#ifdef __GNUC__\n"
-               "typedef __builtin_va_list __va_list;\n"
-               "#else\n"
-               "%0\n"
-               "#endif";
-    test_text = "#if defined(__STDC__) && !defined(__ia64)\n"
-               "typedef void *__va_list;\n"
-               "#else\n"
-               "typedef char *__va_list;\n"
-               "#endif";
+    c_fix     = format;
+    c_fix_arg = "%1 %2 __attribute__((__noreturn__));";
+
+    test_text = "extern _Noreturn void quick_exit(int);";
 };
 
 /*
@@ -4051,6 +4403,20 @@ fix = {
     test_text = " int\tstrlen(); /* string length */";
 };
 
+/*
+ *  Linux kernel's vt.h breaks C++
+ */
+fix = {
+    hackname  = suse_linux_vt_cxx;
+    files     = linux/vt.h;
+
+    select    = "^[ \t]*unsigned int new;";
+    c_fix     = format;
+    c_fix_arg = "unsigned int newev;";
+
+    test_text = "        unsigned int new;      /* New console (if changing) */";
+};
+
 /*
  *  Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
  *  that is visible to any ANSI compiler using this include.  Simply
@@ -4212,7 +4578,7 @@ fix = {
 fix = {
     hackname  = thread_keyword;
     files     = "pthread.h";
-    files     = "bits/sigthread.h";
+    files     = bits/sigthread.h, '*/bits/sigthread.h';
     select    = "([* ])__thread([,)])";
     c_fix     = format;
     c_fix_arg = "%1__thr%2";
@@ -4297,6 +4663,41 @@ fix = {
     "#define __alignof__(x) ...";
 };
 
+/*
+ * On VMS, add missing braces around sigset_t constants.
+ */
+fix = {
+    hackname  = vms_add_missing_braces;
+    select    = "(_SIG_[A-Z]+_SET[ \t]+= \\{)(0x[0F]+, 0x[0F]+)";
+    mach      = "*-*-*vms*";
+    files     = "rtldef/signal.h";
+    c_fix     = format;
+
+    c_fix_arg = '%1 {%2} ';
+
+    test_text = "static const __sigset_t _SIG_EMPTY_SET  = "
+                "{0x00000000, 0x00000000},\n"
+                " _SIG_FULL_SET   = {0xFFFFFFFF, 0xFFFFFFFF};\n";
+};
+
+/*
+ * On VMS, some DEC-C builtins are directly used.
+ */
+fix = {
+    hackname  = vms_decc_builtin;
+    select    = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY)";
+    mach      = "*-*-*vms*";
+    files     = rtldef/string.h, rtldef/time.h, rtldef/strings.h,
+                rtldef/socket.h;
+    sed       = "s@__MEMSET@memset@";
+    sed       = "s@__MEMMOVE@memmove@";
+    sed       = "s@__MEMCPY@memcpy@";
+    sed       = "s@__STRLEN@strlen@";
+    sed       = "s@__STRCPY@strcpy@";
+
+    test_text = "define FD_ZERO(__p) __MEMSET((__p), 0, sizeof(*(__p)))\n";
+};
+
 /*
  *  Define __CAN_USE_EXTERN_PREFIX on vms.
  */
@@ -4320,27 +4721,6 @@ fix = {
                "# endif\n";
 };
 
-/*
- * On VMS, use pragma extern_model instead of VAX-C keywords.
- */
-fix = {
-    hackname  = vms_use_pragma_extern_model;
-    select    = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n"
-               "# pragma extern_model __save\n";
-    mach      = "*-*-*vms*";
-    c_fix     = format;
-
-    c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n"
-               "# pragma extern_model __save\n";
-
-    test_text = "#if defined(__DECC) || defined(__DECCXX)\n"
-               "# pragma extern_model __save\n"
-               "# pragma extern_model strict_refdef\n"
-               "   extern struct x zz$yy;\n"
-               "# pragma extern_model __restore\n"
-               "#endif\n";
-};
-
 /*
  * On VMS, disable the use of dec-c string builtins
  */
@@ -4356,39 +4736,6 @@ fix = {
     test_text = "#if !defined(__VAX)\n";
 };
 
-/*
- * On VMS, change <resource.h> to <sys/resource.h> to avoid a
- * conflict while building gcc.  Likewise for <builtins.h>
- */
-fix = {
-    hackname  = vms_use_quoted_include;
-    select    = "(#[ \t]*include[ \t]+)<(resource|builtins)\\.h>";
-    mach      = "*-*-*vms*";
-    files     = rtldef/wait.h, starlet_c/pthread.h;
-    c_fix     = format;
-
-    c_fix_arg = '%1<sys/%2.h>';
-
-    test_text = "#   include <resource.h>";
-};
-
-/*
- * On VMS, add missing braces around sigset_t constants.
- */
-fix = {
-    hackname  = vms_add_missing_braces;
-    select    = "(_SIG_[A-Z]+_SET[ \t]+= \\{)(0x[0F]+, 0x[0F]+)";
-    mach      = "*-*-*vms*";
-    files     = "rtldef/signal.h";
-    c_fix     = format;
-
-    c_fix_arg = '%1 {%2} ';
-
-    test_text = "static const __sigset_t _SIG_EMPTY_SET  = "
-                "{0x00000000, 0x00000000},\n"
-                " _SIG_FULL_SET   = {0xFFFFFFFF, 0xFFFFFFFF};\n";
-};
-
 /*
  * On VMS, fix incompatible redeclaration of hostalias.
  */
@@ -4408,21 +4755,23 @@ fix = {
 };
 
 /*
- * On VMS, some DEC-C builtins are directly used.
+ * On VMS, forward declare structure before referencing them in prototypes.
  */
 fix = {
-    hackname  = vms_decc_builtin;
-    select    = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY)";
+    hackname  = vms_forward_declare_struct;
+    select    = "(/\\* forward decls for C\\+\\+ \\*/\n)"
+                "#ifdef __cplusplus\n";
     mach      = "*-*-*vms*";
-    files     = rtldef/string.h, rtldef/time.h, rtldef/strings.h,
-                rtldef/socket.h;
-    sed       = "s@__MEMSET@memset@";
-    sed       = "s@__MEMMOVE@memmove@";
-    sed       = "s@__MEMCPY@memcpy@";
-    sed       = "s@__STRLEN@strlen@";
-    sed       = "s@__STRCPY@strcpy@";
+    files     = rtldef/if.h;
+    c_fix     = format;
 
-    test_text = "define FD_ZERO(__p) __MEMSET((__p), 0, sizeof(*(__p)))\n";
+    c_fix_arg = "%1"
+                "#if defined (__cplusplus) || defined (__GNUC__)\n";
+
+    test_text = "/* forward decls for C++ */\n"
+                "#ifdef __cplusplus\n"
+                "struct foo;\n"
+                "#endif\n";
 };
 
 /*
@@ -4446,39 +4795,56 @@ fix = {
 };
 
 /*
- * On VMS, forward declare structure before referencing them in prototypes.
+ * On VMS, force the use of fast setjmp, as the normal setjmp uses conditions
+ * which is not yet fully supported by gcc.
  */
 fix = {
-    hackname  = vms_forward_declare_struct;
-    select    = "(/\\* forward decls for C\\+\\+ \\*/\n)"
-                "#ifdef __cplusplus\n";
+    hackname  = vms_use_fast_setjmp;
+    select    = "(#[ \t]*if[ \t]*defined\\(__FAST_SETJMP\\)[ \t]*\\|\\|)";
     mach      = "*-*-*vms*";
-    files     = rtldef/if.h;
+    files     = rtldef/setjmp.h;
     c_fix     = format;
 
-    c_fix_arg = "%1"
-                "#if defined (__cplusplus) || defined (__GNUC__)\n";
+    c_fix_arg = "%0 defined (__GNUC__) ||";
 
-    test_text = "/* forward decls for C++ */\n"
-                "#ifdef __cplusplus\n"
-                "struct foo;\n"
-                "#endif\n";
+    test_text = "#   if defined(__FAST_SETJMP) || defined(__UNIX_SETJMP)";
 };
 
 /*
- * On VMS, force the use of fast setjmp, as the normal setjmp uses conditions
- * which is not yet fully supported by gcc.
+ * On VMS, use pragma extern_model instead of VAX-C keywords.
  */
 fix = {
-    hackname  = vms_use_fast_setjmp;
-    select    = "(#[ \t]*if[ \t]*defined\\(__FAST_SETJMP\\)[ \t]*\\|\\|)";
+    hackname  = vms_use_pragma_extern_model;
+    select    = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n"
+               "# pragma extern_model __save\n";
     mach      = "*-*-*vms*";
-    files     = rtldef/setjmp.h;
     c_fix     = format;
 
-    c_fix_arg = "%0 defined (__GNUC__) ||";
+    c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n"
+               "# pragma extern_model __save\n";
 
-    test_text = "#   if defined(__FAST_SETJMP) || defined(__UNIX_SETJMP)";
+    test_text = "#if defined(__DECC) || defined(__DECCXX)\n"
+               "# pragma extern_model __save\n"
+               "# pragma extern_model strict_refdef\n"
+               "   extern struct x zz$yy;\n"
+               "# pragma extern_model __restore\n"
+               "#endif\n";
+};
+
+/*
+ * On VMS, change <resource.h> to <sys/resource.h> to avoid a
+ * conflict while building gcc.  Likewise for <builtins.h>
+ */
+fix = {
+    hackname  = vms_use_quoted_include;
+    select    = "(#[ \t]*include[ \t]+)<(resource|builtins)\\.h>";
+    mach      = "*-*-*vms*";
+    files     = rtldef/wait.h, starlet_c/pthread.h;
+    c_fix     = format;
+
+    c_fix_arg = '%1<sys/%2.h>';
+
+    test_text = "#   include <resource.h>";
 };
 
 /*
@@ -4560,7 +4926,7 @@ fix = {
 
     c_fix       = format;
     c_fix_arg   = "%0\n"
-        "#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n";
+        "#define ioctl(fd, func, arg) ioctl(fd, func, (int)(arg))\n";
     c_fix_arg   = "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);";
         
     test_text   = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
@@ -4674,6 +5040,22 @@ fix = {
     test_text       = "extern int write ( int , char * , size_t ) ;";
 };
 
+/*
+ *  This hack ensures the include_next in the fixed unistd.h actually
+ *  finds the system's unistd.h and not the fixed unistd.h again.
+ */
+fix = {
+    hackname    = vxworks_iolib_include_unistd;
+    files       = ioLib.h;
+    mach        = "*-*-vxworks*";
+    select      = "#include \"unistd.h\"";
+
+    c_fix       = format;
+    c_fix_arg   = "#include <unistd.h>";
+
+    test_text       = "#include \"unistd.h\"";
+};
+
 /*
  *  There are several name conflicts with C++ reserved words in X11 header
  *  files.  These are fixed in some versions, so don't do the fixes if
@@ -4745,73 +5127,4 @@ fix = {
 
     test_text = "extern char *\tsprintf();";
 };
-
-/*
- *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
- *  that fails when compiling for SSE-less 32-bit x86.
- */
-fix = {
-    hackname  = feraiseexcept_nosse_invalid;
-    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
-    files     = bits/fenv.h;
-    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
-               ": \"x\" \\(__f\\)\\);$";
-    bypass    = "\"fdiv .*; fwait\"";
-    
-    c_fix     = format;
-    c_fix_arg = <<- _EOText_
-       # ifdef __SSE_MATH__
-       %0
-       # else
-       %1__asm__ __volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
-       %1                      : "=t" (__f) : "0" (__f));
-       # endif
-       _EOText_;
-
-    test_text = <<- _EOText_
-         __asm__ __volatile__ ("divss %0, %0" : : "x" (__f));
-       _EOText_;
-};
-
-/*
- *  Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
- *  that fails when compiling for SSE-less 32-bit x86.
- */
-fix = {
-    hackname  = feraiseexcept_nosse_divbyzero;
-    mach      = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
-    files     = bits/fenv.h;
-    select    = "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
-               ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
-    bypass    = "\"fdivp .*; fwait\"";
-    
-    c_fix     = format;
-    c_fix_arg = <<- _EOText_
-       # ifdef __SSE_MATH__
-       %0
-       # else
-       %1__asm__ __volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
-       %1                      : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
-       # endif
-       _EOText_;
-
-    test_text = <<- _EOText_
-         __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
-       _EOText_;
-};
-
-/*
- *  Old Linux kernel's <compiler.h> header breaks Traditional CPP
- */
-fix = {
-    hackname  = complier_h_tradcpp;
-    files     = linux/compiler.h;
-
-    select    = "#define __builtin_warning\\(x, y\\.\\.\\.\\) \\(1\\)";
-    c_fix     = format;
-    c_fix_arg = "/* __builtin_warning(x, y...) is obsolete */";
-
-    test_text = "#define __builtin_warning(x, y...) (1)";
-};
-
 /*EOF*/