PR libgfortran/83649 Chunk large reads and writes
[gcc.git] / fixincludes / inclhack.def
index 411300fb2e0f9015cc09b6ee5be5b4d3c6acfc70..fd0034f3aaa055f649a3828e41e3a25dc303a961 100644 (file)
@@ -426,122 +426,6 @@ fix = {
        _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
-       
-       #endif
-       _EndOfHeader_;
-};
-
 /*
  *  This hack makes makes unistd.h more POSIX-compliant on VxWorks
  */
@@ -596,6 +480,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
  */
@@ -727,7 +661,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"
@@ -841,12 +775,89 @@ 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";
+};
+
+/*
+ * 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;
@@ -861,6 +872,7 @@ fix = {
  */
 fix = {
     hackname  = aix_syswait_2;
+    mach      = "*-*-aix*";
     files     = sys/wait.h;
     select    = '\? (\(\(\(\(unsigned[^)]*\)[^)]*\) >> [^)]*\) \& 0xff\) : -1)';
     c_fix     = format;
@@ -877,6 +889,7 @@ fix = {
  */
 fix = {
     hackname  = aix_volatile;
+    mach      = "*-*-aix*";
     files     = sys/signal.h;
     select    = "typedef volatile int sig_atomic_t";
     c_fix     = format;
@@ -1139,20 +1152,6 @@ fix = {
     test_text = '#define  vfscanf      __svfscanf';
 };
 
-/*
- *  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)";
-};
-
 /*
  *  Fix various macros used to define ioctl numbers.
  *  The traditional syntax was:
@@ -1222,6 +1221,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.
@@ -1279,6 +1304,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?
@@ -1701,7 +1797,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;
@@ -2061,6 +2158,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.
  */
@@ -2074,6 +2189,19 @@ fix = {
     test_text = "#ifndef _MATH_INCLUDED";
 };
 
+/*
+ *  Fix hpux11 __LWP_RWLOCK_VALID define
+ */
+fix = {
+    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 = "#define __LWP_RWLOCK_VALID              -29551";
+    test_text = "#define __LWP_RWLOCK_VALID 0x8c91";
+};
+
 /*
  * hpux sendfile()
  */
@@ -2108,9 +2236,9 @@ fix = {
  */
 fix = {
     hackname  = hpux11_fabsf;
+    mach      = "*-hp-hpux11*";
     files     = math.h;
     select    = "^[ \t]*#[ \t]*define[ \t]+fabsf\\(.*";
-    bypass    = "__cplusplus";
 
     c_fix     = format;
     c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
@@ -2122,16 +2250,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)";
 };
 
@@ -2185,6 +2331,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
  */
@@ -2480,7 +2640,21 @@ 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_longjmp;
+    mach     = "*-hp-hpux*";
+    files    = setjmp.h;
+    select   = "^[ \t]*extern[ \t]+void[ \t]+.*longjmp[ \t]*\(__\\(\\(.*int\\)\\)|\\(.*int\\)|\\(\\)\)";
+
+    c_fix     = format;
+    c_fix_arg = "%0 __attribute__ ((__noreturn__))";
+
+    test_text = 'extern void   longjmp __((jmp_buf, int));';
 };
 
 /*
@@ -2767,6 +2941,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"
@@ -3335,6 +3512,43 @@ fix = {
     "#if       !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)";
 };
 
+/*
+ *  Solaris <iso/stdio_iso.h> should deprecate gets before C11.
+ */
+fix = {
+    hackname  = solaris_gets_c11;
+    mach      = "*-*-solaris2*";
+    files     = "iso/stdio_iso.h";
+    select    = "(extern char[ \t]*\\*gets\\(char \\*\\));";
+
+    c_fix     = format;
+    c_fix_arg = "#if __STDC_VERSION__ < 201112L && __cplusplus < 201402L\n"
+               "%1 __attribute__((__deprecated__));\n"
+               "#endif";
+
+    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.
@@ -3406,42 +3620,6 @@ fix = {
     "#define   SIZE_MAX        4294967295UL";
 };
 
-/*
- * 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";
-};
-
-/*
- *  Before Solaris 10, <iso/setjmp_iso.h> doesn't mark longjump noreturn.
- */
-fix = {
-    hackname  = solaris_longjmp_noreturn;
-    mach      = "*-*-solaris2*";
-    files     = "iso/setjmp_iso.h";
-    bypass    = "__NORETURN";
-    select    = "(.*longjmp\\(jmp_buf.*[^)]+\\));";
-    c_fix     = format;
-    c_fix_arg = "%1 __attribute__ ((__noreturn__));";
-
-    test_text = "extern void longjmp(jmp_buf, int);";
-};
-
 /*
  * Sun Solaris 10 defines several C99 math macros in terms of
  * builtins specific to the Studio compiler, in particular not
@@ -3595,41 +3773,72 @@ fix = {
 };
 
 /*
- * 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
+ * Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing
+ * warnings.
  */
 fix = {
-    hackname = solaris_mutex_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]*';
+    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 = "#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].*)$";
-    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}";
+    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_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_;
 };
 
 /*
@@ -3650,38 +3859,6 @@ fix = {
     "#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";
-};
-
 /*
  * Solaris 10+ <spawn.h> uses char *const argv[_RESTRICT_KYWD] in the
  * posix_spawn declarations, which doesn't work with C++.
@@ -3761,6 +3938,21 @@ fix = {
                "#endif";
 };
 
+/*
+ *  Solaris <stdio.h> shouldn't use std::gets for C++14.
+ */
+fix = {
+    hackname  = solaris_std_gets_cxx14;
+    mach      = "*-*-solaris2*";
+    files     = "stdio.h";
+    select    = "using std::gets;";
+
+    c_fix     = format;
+    c_fix_arg = "#if __cplusplus < 201402L\n%0\n#endif";
+
+    test_text = "using std::gets;";
+};
+
 /*
  * Sun Solaris 8 has what appears to be some gross workaround for
  * some old version of their c++ compiler.  G++ doesn't want it
@@ -3780,30 +3972,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);";
 };
 
 /*