FIXINC_DEBUG = yes;
#endif
+/* On AIX when _LARGE_FILES is defined stdio.h defines fopen to
+ * fopen64 etc. and this causes problems when building with g++
+ * because cstdio udefs everything from stdio.h, leaving us with
+ * ::fopen has not been declared errors. This fixes stdio.h to
+ * undef those defines and use __asm__ to alias the symbols if
+ * building with g++ and -D_LARGE_FILES
+ */
+fix = {
+ hackname = AAB_aix_stdio;
+ files = stdio.h;
+ select = "define fopen fopen64";
+ mach = "*-*-aix*";
+ test-text = ''; /* no way to test */
+
+ c_fix = wrap;
+
+ c_fix_arg = "";
+
+ c_fix_arg = <<- _EOArg_
+
+ #if defined __GNUG__ && defined _LARGE_FILES && defined __cplusplus
+ #define __need__aix_stdio_h_fix
+ #ifdef __need__aix_stdio_h_fix
+ #undef fseeko
+ #undef ftello
+ #undef fgetpos
+ #undef fsetpos
+ #undef fopen
+ #undef freopen
+ /* Alias the symbols using asm */
+ extern "C" {
+ extern int fgetpos(FILE *, fpos64_t *) __asm__("fgetpos64");
+ extern FILE *fopen(const char *, const char *) __asm__("fopen64");
+ extern FILE *freopen(const char *, const char *, FILE *) __asm__("freopen64");
+ extern int fseeko(FILE *, off64_t, int) __asm__("fseeko64");
+ extern int fsetpos(FILE *, const fpos64_t *) __asm__("fsetpos64");
+ extern off64_t ftello(FILE *) __asm__("ftello64");
+ }
+ #endif
+ #endif
+
+ _EOArg_;
+};
+
+
+/*
+ * On Mac OS 10.3.9, the 'long double' functions are available in
+ * libSystem, but are not prototyped in math.h.
+ */
+fix = {
+ hackname = AAB_darwin7_9_long_double_funcs;
+ mach = "*-*-darwin7.9*";
+ files = architecture/ppc/math.h;
+ bypass = "powl";
+ replace = <<- _EndOfHeader_
+ /* This file prototypes the long double functions available on Mac OS
+ 10.3.9. */
+ #ifndef __MATH__
+ # undef __APPLE_CC__
+ # define __APPLE_CC__ 1345
+ # include_next <architecture/ppc/math.h>
+ # undef __APPLE_CC__
+ # define __APPLE_CC__ 1
+ # ifndef __LIBMLDBL_COMPAT
+ # ifdef __LONG_DOUBLE_128__
+ # define __LIBMLDBL_COMPAT(sym) __asm("_" #sym "$LDBL128")
+ # else
+ # define __LIBMLDBL_COMPAT(sym)
+ # endif /* __LONG_DOUBLE_128__ */
+ # endif /* __LIBMLDBL_COMPAT */
+ # ifdef __cplusplus
+ extern "C" {
+ # endif
+ extern long double acosl( long double ) __LIBMLDBL_COMPAT(acosl);
+ extern long double asinl( long double ) __LIBMLDBL_COMPAT(asinl);
+ extern long double atanl( long double ) __LIBMLDBL_COMPAT(atanl);
+ extern long double atan2l( long double, long double ) __LIBMLDBL_COMPAT(atan2l);
+ extern long double cosl( long double ) __LIBMLDBL_COMPAT(cosl);
+ extern long double sinl( long double ) __LIBMLDBL_COMPAT(sinl);
+ extern long double tanl( long double ) __LIBMLDBL_COMPAT(tanl);
+ extern long double acoshl( long double ) __LIBMLDBL_COMPAT(acoshl);
+ extern long double asinhl( long double ) __LIBMLDBL_COMPAT(asinhl);
+ extern long double atanhl( long double ) __LIBMLDBL_COMPAT(atanhl);
+ extern long double coshl( long double ) __LIBMLDBL_COMPAT(coshl);
+ extern long double sinhl( long double ) __LIBMLDBL_COMPAT(sinhl);
+ extern long double tanhl( long double ) __LIBMLDBL_COMPAT(tanhl);
+ extern long double expl( long double ) __LIBMLDBL_COMPAT(expl);
+ extern long double exp2l( long double ) __LIBMLDBL_COMPAT(exp2l);
+ extern long double expm1l( long double ) __LIBMLDBL_COMPAT(expm1l);
+ extern long double logl( long double ) __LIBMLDBL_COMPAT(logl);
+ extern long double log10l( long double ) __LIBMLDBL_COMPAT(log10l);
+ extern long double log2l( long double ) __LIBMLDBL_COMPAT(log2l);
+ extern long double log1pl( long double ) __LIBMLDBL_COMPAT(log1pl);
+ extern long double logbl( long double ) __LIBMLDBL_COMPAT(logbl);
+ extern long double modfl( long double, long double * ) __LIBMLDBL_COMPAT(modfl);
+ extern long double ldexpl( long double, int ) __LIBMLDBL_COMPAT(ldexpl);
+ extern long double frexpl( long double, int * ) __LIBMLDBL_COMPAT(frexpl);
+ extern int ilogbl( long double ) __LIBMLDBL_COMPAT(ilogbl);
+ extern long double scalbnl( long double, int ) __LIBMLDBL_COMPAT(scalbnl);
+ extern long double scalblnl( long double, long int ) __LIBMLDBL_COMPAT(scalblnl);
+ extern long double fabsl( long double ) __LIBMLDBL_COMPAT(fabsl);
+ extern long double cbrtl( long double ) __LIBMLDBL_COMPAT(cbrtl);
+ extern long double hypotl( long double, long double ) __LIBMLDBL_COMPAT(hypotl);
+ extern long double powl( long double, long double ) __LIBMLDBL_COMPAT(powl);
+ extern long double sqrtl( long double ) __LIBMLDBL_COMPAT(sqrtl);
+ extern long double erfl( long double ) __LIBMLDBL_COMPAT(erfl);
+ extern long double erfcl( long double ) __LIBMLDBL_COMPAT(erfcl);
+ extern long double lgammal( long double ) __LIBMLDBL_COMPAT(lgammal);
+ extern long double tgammal( long double ) __LIBMLDBL_COMPAT(tgammal);
+ extern long double ceill( long double ) __LIBMLDBL_COMPAT(ceill);
+ extern long double floorl( long double ) __LIBMLDBL_COMPAT(floorl);
+ extern long double nearbyintl( long double ) __LIBMLDBL_COMPAT(nearbyintl);
+ extern long double rintl( long double ) __LIBMLDBL_COMPAT(rintl);
+ extern long int lrintl( long double ) __LIBMLDBL_COMPAT(lrintl);
+ extern long long int llrintl( long double ) __LIBMLDBL_COMPAT(llrintl);
+ extern long double roundl( long double ) __LIBMLDBL_COMPAT(roundl);
+ extern long int lroundl( long double ) __LIBMLDBL_COMPAT(lroundl);
+ extern long long int llroundl( long double ) __LIBMLDBL_COMPAT(llroundl);
+ extern long double truncl( long double ) __LIBMLDBL_COMPAT(truncl);
+ extern long double fmodl( long double, long double) __LIBMLDBL_COMPAT(fmodl);
+ extern long double remainderl( long double, long double ) __LIBMLDBL_COMPAT(remainderl);
+ extern long double remquol( long double, long double, int * ) __LIBMLDBL_COMPAT(remquol);
+ extern long double copysignl( long double, long double ) __LIBMLDBL_COMPAT(copysignl);
+ extern long double nanl( const char * ) __LIBMLDBL_COMPAT(nanl);
+ extern long double nextafterl( long double, long double ) __LIBMLDBL_COMPAT(nextafterl);
+ extern long double nexttowardl( long double, long double ) __LIBMLDBL_COMPAT(nexttowardl);
+ extern long double fdiml( long double, long double ) __LIBMLDBL_COMPAT(fdiml);
+ extern long double fmaxl( long double, long double ) __LIBMLDBL_COMPAT(fmaxl);
+ extern long double fminl( long double, long double ) __LIBMLDBL_COMPAT(fminl);
+ extern long double fmal( long double, long double, long double ) __LIBMLDBL_COMPAT(fmal);
+ # ifdef __cplusplus
+ }
+ # endif
+ #endif /* __MATH__ */
+ _EndOfHeader_;
+};
+
+
+/*
+ * ... and for the previous fix to be useful, you have to not use ""
+ * includes.
+ */
+fix = {
+ hackname = AAB_darwin7_9_long_double_funcs_2;
+ mach = "*-*-darwin7.9*";
+ files = math.h;
+ select = '#include[ \t]+\"';
+ c_fix = format;
+ c_fix_arg = "%1<%2.h>";
+
+ c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
+
+ test_text = '#include "architecture/ppc/math.h"';
+};
+
+
/*
* This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
*/
files = asm/posix_types.h;
mach = 'i[34567]86-*-linux*';
bypass = '} while';
+ bypass = 'x86_64';
+ bypass = 'posix_types_64';
/*
* Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
#define __FD_ZERO(fdsetp) \
do { \
int __d0, __d1; \
- __asm__ __volatile__("cld ; rep ; stosl" \
- : "=&c" (__d0), "=&D" (__d1) \
- : "a" (0), "0" (__FDSET_LONGS), \
- "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \
+ __asm__ __volatile__("cld ; rep ; stosl" \
+ : "=&c" (__d0), "=&D" (__d1) \
+ : "a" (0), "0" (__FDSET_LONGS), \
+ "1" ((__kernel_fd_set *) (fdsetp)) :"memory"); \
} while (0)
#endif
#if defined(__FD_ZERO) && !defined(__GLIBC__)
#undef __FD_ZERO
- # define __FD_ZERO(fdsetp) \\
- do { \\
- int __d0, __d1; \\
- __asm__ __volatile__("cld ; rep ; stosl" \\
- : "=&c" (__d0), "=&D" (__d1) \\
- : "a" (0), "0" (__FDSET_LONGS), \\
- "1" ((__fd_set *) (fdsetp)) :"memory"); \\
+ # define __FD_ZERO(fdsetp) \
+ do { \
+ int __d0, __d1; \
+ __asm__ __volatile__("cld ; rep ; stosl" \
+ : "=&c" (__d0), "=&D" (__d1) \
+ : "a" (0), "0" (__FDSET_LONGS), \
+ "1" ((__fd_set *) (fdsetp)) :"memory"); \
} while (0)
#endif
extern int memcmp();
#endif /* __memory_h__ */
- _EndOfHeader;
+ _EndOfHeader_;
};
/*
- * Completely replace <sys/varargs.h> with a file that includes gcc's
- * stdarg.h or varargs.h files as appropriate.
+ * 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.
*/
-#ifdef SVR4
fix = {
- hackname = AAB_svr4_no_varargs;
- files = sys/varargs.h;
- replace = "/* This file was generated by fixincludes. */\n"
- "#ifndef _SYS_VARARGS_H\n"
- "#define _SYS_VARARGS_H\n\n"
-
- "#ifdef __STDC__\n"
- "#include <stdarg.h>\n"
- "#else\n"
- "#include <varargs.h>\n"
- "#endif\n\n"
-
- "#endif /* _SYS_VARARGS_H */\n";
+ hackname = aix_complex;
+ mach = "*-*-aix*";
+ files = complex.h;
+ select = "#define[ \t]_Complex_I[ \t]__I";
+ c_fix = format;
+ c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
+ test_text = "#define _Complex_I __I\n";
};
-#endif
/*
- * Completely replace <sys/byteorder.h> with a file that implements gcc's
- * optimized byteswapping. (The original probably implemented some
- * incompatible optimized byteswapping.)
+ * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
+ * which violates a requirement of ISO C.
*/
fix = {
- hackname = AAB_svr4_replace_byteorder;
- mach = "*-*-sysv4*";
- mach = "i[34567]86-*-sysv5*";
- mach = "i[34567]86-*-sco3.2v5*";
- mach = "i[34567]86-*-udk*";
- mach = "i[34567]86-*-solaris2.[0-4]";
- mach = "powerpcle-*-solaris2.[0-4]";
- mach = "sparc-*-solaris2.[0-4]";
- mach = "i[34567]86-sequent-ptx*";
- files = sys/byteorder.h;
- replace = <<- _EndOfHeader_
- #ifndef _SYS_BYTEORDER_H
- #define _SYS_BYTEORDER_H
-
- /* Functions to convert `short' and `long' quantities from host byte order
- to (internet) network byte order (i.e. big-endian).
-
- Written by Ron Guilmette (rfg@ncd.com).
-
- This isn't actually used by GCC. It is installed by fixinc.svr4.
-
- For big-endian machines these functions are essentially no-ops.
-
- For little-endian machines, we define the functions using specialized
- asm sequences in cases where doing so yields better code (e.g. i386). */
-
- #if !defined (__GNUC__) && !defined (__GNUG__)
- #error You lose! This file is only useful with GNU compilers.
- #endif
-
- #ifndef __BYTE_ORDER__
- /* Byte order defines. These are as defined on UnixWare 1.1, but with
- double underscores added at the front and back. */
- #define __LITTLE_ENDIAN__ 1234
- #define __BIG_ENDIAN__ 4321
- #define __PDP_ENDIAN__ 3412
- #endif
-
- #ifdef __STDC__
- static __inline__ unsigned long htonl (unsigned long);
- static __inline__ unsigned short htons (unsigned int);
- static __inline__ unsigned long ntohl (unsigned long);
- static __inline__ unsigned short ntohs (unsigned int);
- #endif /* defined (__STDC__) */
-
- #if defined (__i386__)
-
- #ifndef __BYTE_ORDER__
- #define __BYTE_ORDER__ __LITTLE_ENDIAN__
- #endif
-
- /* Convert a host long to a network long. */
-
- /* We must use a new-style function definition, so that this will also
- be valid for C++. */
- static __inline__ unsigned long
- htonl (unsigned long __arg)
- {
- register unsigned long __result;
-
- __asm__ ("xchg%B0 %b0,%h0
- ror%L0 $16,%0
- xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
- return __result;
- }
-
- /* Convert a host short to a network short. */
-
- static __inline__ unsigned short
- htons (unsigned int __arg)
- {
- register unsigned short __result;
-
- __asm__ ("xchg%B0 %b0,%h0" : "=q" (__result) : "0" (__arg));
- return __result;
- }
-
- #elif (defined (__ns32k__) || defined (__vax__) || defined (__arm__))
-
- #ifndef __BYTE_ORDER__
- #define __BYTE_ORDER__ __LITTLE_ENDIAN__
- #endif
-
- /* For other little-endian machines, using C code is just as efficient as
- using assembly code. */
-
- /* Convert a host long to a network long. */
-
- static __inline__ unsigned long
- htonl (unsigned long __arg)
- {
- register unsigned long __result;
-
- __result = (__arg >> 24) & 0x000000ff;
- __result |= (__arg >> 8) & 0x0000ff00;
- __result |= (__arg << 8) & 0x00ff0000;
- __result |= (__arg << 24) & 0xff000000;
- return __result;
- }
-
- /* Convert a host short to a network short. */
-
- static __inline__ unsigned short
- htons (unsigned int __arg)
- {
- register unsigned short __result;
-
- __result = (__arg << 8) & 0xff00;
- __result |= (__arg >> 8) & 0x00ff;
- return __result;
- }
-
- #else /* must be a big-endian machine */
-
- #ifndef __BYTE_ORDER__
- #define __BYTE_ORDER__ __BIG_ENDIAN__
- #endif
-
- /* Convert a host long to a network long. */
-
- static __inline__ unsigned long
- htonl (unsigned long __arg)
- {
- return __arg;
- }
-
- /* Convert a host short to a network short. */
-
- static __inline__ unsigned short
- htons (unsigned int __arg)
- {
- return __arg;
- }
-
- #endif /* big-endian */
-
- /* Convert a network long to a host long. */
-
- static __inline__ unsigned long
- ntohl (unsigned long __arg)
- {
- return htonl (__arg);
- }
-
- /* Convert a network short to a host short. */
-
- static __inline__ unsigned short
- ntohs (unsigned int __arg)
- {
- return htons (__arg);
- }
- #endif
- _EndOfHeader_;
+ hackname = aix_pthread;
+ files = "pthread.h";
+ select = "(#define [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"
+ "{...init stuff...}";
};
/*
- * Cancel out ansi_compat.h on Ultrix. Replace it with an empty file.
+ * AIX stdint.h fixes.
*/
fix = {
- hackname = AAB_ultrix_ansi_compat;
- files = ansi_compat.h;
- select = ULTRIX;
- replace = "/* This file intentionally left blank. */\n";
+ hackname = aix_stdint_1;
+ mach = "*-*-aix*";
+ files = stdint-aix.h, stdint.h;
+ select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
+ "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
+ c_fix = format;
+ c_fix_arg = "#define UINT8_MAX (255)\n"
+ "#define UINT16_MAX (65535)";
+ test_text = "#define UINT8_MAX (255U)\n"
+ "#define UINT16_MAX (65535U)";
};
-/*
- * The Ultrix 4.3 file limits.h is a symbolic link to sys/limits.h.
- * Replace limits.h with a file that includes sys/limits.h.
- */
fix = {
- hackname = AAB_ultrix_limits;
- files = limits.h;
- mach = "*-*-ultrix4.3";
- replace = <<- _EndOfHeader_
- #ifndef _LIMITS_INCLUDED
- #define _LIMITS_INCLUDED
- #include <sys/limits.h>
- #endif /* _LIMITS_INCLUDED */
- _EndOfHeader_;
+ hackname = aix_stdint_2;
+ mach = "*-*-aix*";
+ files = stdint-aix.h, stdint.h;
+ select = "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n"
+ "#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n"
+ "#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n"
+ "#else\n"
+ "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n"
+ "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n"
+ "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX";
+ c_fix = format;
+ c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#define INTPTR_MAX 9223372036854775807L\n"
+ "#define UINTPTR_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#define INTPTR_MAX 2147483647L\n"
+ "#define UINTPTR_MAX 4294967295UL";
+ test_text = "#define INTPTR_MIN INT64_MIN\n"
+ "#define INTPTR_MAX INT64_MAX\n"
+ "#define UINTPTR_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define INTPTR_MIN INT32_MIN\n"
+ "#define INTPTR_MAX INT32_MAX\n"
+ "#define UINTPTR_MAX UINT32_MAX";
};
-/*
- * The ULTRIX 4.3 version of memory.h duplicates definitions
- * present in strings.h. Replace memory.h with a file that includes
- * strings.h to prevent problems from multiple inclusion.
- */
fix = {
- hackname = AAB_ultrix_memory;
- files = memory.h;
- mach = "*-*-ultrix4.3";
- replace = <<- _EndOfHeader_
- #ifndef _MEMORY_INCLUDED
- #define _MEMORY_INCLUDED
- #include <strings.h>
- #endif /* _MEMORY_INCLUDED */
- _EndOfHeader_;
+ hackname = aix_stdint_3;
+ mach = "*-*-aix*";
+ files = stdint-aix.h, stdint.h;
+ select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n"
+ "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n"
+ "#else\n"
+ "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n"
+ "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX";
+ c_fix = format;
+ c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
+ "#define PTRDIFF_MAX 9223372036854775807L\n"
+ "#else\n"
+ "#define PTRDIFF_MIN (-2147483647L - 1)\n"
+ "#define PTRDIFF_MAX 2147483647L";
+ test_text = "#define PTRDIFF_MIN INT64_MIN\n"
+ "#define PTRDIFF_MAX INT64_MAX\n"
+ "#else\n"
+ "#define PTRDIFF_MIN INT32_MIN\n"
+ "#define PTRDIFF_MAX INT32_MAX";
};
-/*
- * The Ultrix 4.3 file string.h is a symbolic link to strings.h.
- * Replace string.h link with a file that includes strings.h to prevent
- * problems from multiple inclusion.
- */
fix = {
- hackname = AAB_ultrix_string;
- files = string.h;
- mach = "*-*-ultrix4.3";
- replace = <<- _EndOfHeader_
- #ifndef _STRING_INCLUDED
- #define _STRING_INCLUDED
- #include <strings.h>
- #endif /* _STRING_INCLUDED */
- _EndOfHeader_;
+ hackname = aix_stdint_4;
+ mach = "*-*-aix*";
+ files = stdint-aix.h, stdint.h;
+ select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
+ "#else\n"
+ "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
+ c_fix = format;
+ c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define SIZE_MAX 4294967295UL";
+ test_text = "#define SIZE_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define SIZE_MAX UINT32_MAX";
};
-/*
- * pthread.h on AIX 4.3.3 tries to define a macro without whitspace
- * which violates a requirement of ISO C.
- */
fix = {
- hackname = aix_pthread;
- files = "pthread.h";
- select = "(#define [A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
+ hackname = aix_stdint_5;
+ mach = "*-*-aix*";
+ files = stdint-aix.h, stdint.h;
+ select = "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n"
+ "#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)";
c_fix = format;
- c_fix_arg = "%1 %2";
- test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
- "{...init stuff...}";
+ c_fix_arg = "#define UINT8_C(c) c\n"
+ "#define UINT16_C(c) c";
+ test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n"
+ "#define UINT16_C(c) __CONCAT__(c,U)";
};
/*
- * sys/wait.h on AIX 3.2.5 puts the declaration of wait3 before the
- * definition of struct rusage, so the prototype added by fixproto fails.
- */
-fix = {
- hackname = aix_syswait;
- files = sys/wait.h;
- select = "^extern pid_t wait3\\(\\);\n";
- select = "bos325,";
- c_fix = format;
- c_fix_arg = "struct rusage;\n%0";
- test_text = "/* bos325, */\n"
- "extern pid_t wait3();\n"
- "\t/* pid_t wait3(int *, int, struct rusage *); */";
-};
-
-
-/*
* sys/wait.h on AIX 5.2 defines macros that have both signed and
* unsigned types in conditional expressions.
*/
*/
fix = {
hackname = alpha___extern_prefix;
- select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n(#[ \t]*pragma[ \t]*extern_prefix.*)";
+ select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n"
+ "(#[ \t]*pragma[ \t]*extern_prefix.*)";
mach = "alpha*-dec-osf*";
c_fix = format;
c_fix = format;
c_fix_arg = "%0 && !defined(__PRAGMA_EXTERN_PREFIX)";
- test_text = "#if (_ISO_C_SOURCE>=19990L) && !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)";
+ test_text = "#if (_ISO_C_SOURCE>=19990L) "
+ "&& !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)";
};
select = '(#define assert\(EX\).*)\(\(int\) \(EX\)\)';
c_fix = format;
c_fix_arg = "%1(EX)";
- test_text = '#define assert(EX) (((int) (EX)) ? (void)0 : __assert(#EX, __FILE__, __LINE__))';
+ test_text = '#define assert(EX) (((int) (EX)) ? (void)0 '
+ ': __assert(#EX, __FILE__, __LINE__))';
};
/*
+ * Fix missing semicolon on Alpha OSF/4 in <net/if.h>
+ */
+fix = {
+ hackname = alpha_if_semicolon;
+ files = net/if.h;
+ select = "struct[ \t]+sockaddr[ \t]+vmif_paddr[ \t]+/\\*";
+ c_fix = format;
+ c_fix_arg = "struct sockaddr vmif_paddr;\t/*";
+ test_text = ' struct sockaddr vmif_paddr /* protocol address */';
+};
+
+
+/*
* Remove erroneous parentheses in sym.h on Alpha OSF/1.
*/
fix = {
fix = {
hackname = alpha_pthread;
files = pthread.h;
- select = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)|def _PTHREAD_ENV_DECC)(.*))\n"
+ select = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)"
+ "|def _PTHREAD_ENV_DECC)(.*))\n"
"(#[ \t]*define _PTHREAD_USE_PTDNAM_)";
mach = "alpha*-dec-osf*";
c_fix = format;
- c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 || defined (__PRAGMA_EXTERN_PREFIX)\n%5";
+ c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 "
+ "|| defined (__PRAGMA_EXTERN_PREFIX)\n%5";
- test_text = "# if defined (_PTHREAD_ENV_DECC) || defined (_PTHREAD_ENV_EPCC)\n"
+ test_text = "# if defined (_PTHREAD_ENV_DECC) "
+ "|| defined (_PTHREAD_ENV_EPCC)\n"
"# define _PTHREAD_USE_PTDNAM_\n"
"# endif\n"
"# ifdef _PTHREAD_ENV_DECC\n"
"#endif";
};
+
/*
* Compaq Tru64 v5.1 defines all of its PTHREAD_*_INITIALIZER macros
* incorrectly, specifying less fields in the initializers than are
"s@CVALID\\(.*\\)_}@CVALID\\1_, 0, 0 }@\n"
"s@WVALID\\(.*\\)A}@WVALID\\1A, 0, 0, 0, 0, 0, 0, 0, 0, 0 }@\n"
"s@WVALID\\(.*\\)_}@WVALID\\1_, 0, 0, 0, 0, 0, 0, 0 }@\n";
- test_text = "/*\n"
- " * @(#)_RCSfile: pthread.h,v \\$ "
- "_Revision: 1.1.33.21 \\$ (DEC) "
- "_Date: 2000/08/15 15:30:13 \\$\n"
- " */\n"
-"#ifndef _PTHREAD_NOMETER_STATIC\n"
-"# define PTHREAD_MUTEX_INITIALIZER \\\n"
-" {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA}\n"
-"# define PTHREAD_COND_INITIALIZER \\\n"
-" {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA}\n"
-"# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \\\n"
-" {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}\n"
-"# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \\\n"
-" {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}\n"
-"#else\n"
-"# define PTHREAD_MUTEX_INITIALIZER {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA}\n"
-"# define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \\\n"
-" {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}\n"
-"# define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \\\n"
-" {0, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}\n"
-"#endif\n\n"
-"#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA}\n"
-"#define PTHREAD_RWLOCK_INITWITHNAME_NP(_n_,_a_) \\\n"
-" {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA, _n_, _a_}\n";
+ test_text = <<- _EOText_
+ /*
+ * @(#)_RCSfile: pthread.h,v $ _Revision: 1.1.33.21 $ (DEC) _Date: 2000/08/15 15:30:13 $
+ */
+ #ifndef _PTHREAD_NOMETER_STATIC
+ # define PTHREAD_MUTEX_INITIALIZER \
+ {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA}
+ # define PTHREAD_COND_INITIALIZER \
+ {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA}
+ # define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \
+ {_PTHREAD_MSTATE_CONFIG, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}
+ # define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \
+ {_PTHREAD_CSTATE_SLOW, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}
+ #else
+ # define PTHREAD_MUTEX_INITIALIZER {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA}
+ # define PTHREAD_MUTEX_INITWITHNAME_NP(_n_,_a_) \
+ {0, _PTHREAD_MVALID | _PTHREAD_MVF_STA, _n_, _a_}
+ # define PTHREAD_COND_INITWITHNAME_NP(_n_,_a_) \
+ {0, _PTHREAD_CVALID | _PTHREAD_CVF_STA, _n_, _a_}
+ #endif
+
+ #define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA}
+ #define PTHREAD_RWLOCK_INITWITHNAME_NP(_n_,_a_) \
+ {_PTHREAD_RWVALID | _PTHREAD_RWVF_STA, _n_, _a_}
+ _EOText_;
};
+
/*
* Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
* And OpenBSD.
mach = "alpha*-dec-osf4*";
select = "#define wcstok wcstok_r";
- sed = "s@#define wcstok wcstok_r@extern wchar_t *wcstok __((wchar_t *, const wchar_t *, wchar_t **)) __asm__(\"wcstok_r\");@";
- sed = "s@#define wcsftime __wcsftime_isoc@extern size_t wcsftime __((wchar_t *, size_t, const wchar_t *, const struct tm *)) __asm__(\"__wcsftime_isoc\");@";
+ sed = "s@#define wcstok wcstok_r@"
+ "extern wchar_t *wcstok __((wchar_t *, const wchar_t *, "
+ "wchar_t **)) __asm__(\"wcstok_r\");@";
+ sed = "s@#define wcsftime __wcsftime_isoc@"
+ "extern size_t wcsftime __((wchar_t *, size_t, const wchar_t *"
+ ", const struct tm *)) __asm__(\"__wcsftime_isoc\");@";
test_text = "#define wcstok wcstok_r\n"
"#define wcsftime __wcsftime_isoc";
};
/*
* Remove `extern double cabs' declarations from math.h.
* This conflicts with C99. Discovered on AIX.
+ * IRIX 5 and IRIX 6 before 6.5.18 (where C99 support was introduced)
+ * declares cabs() to take a struct __cabs_s argument.
* SunOS4 has its cabs() declaration followed by a comment which
* terminates on the following line.
* Darwin hides its broken cabs in architecture-specific subdirs.
*/
fix = {
hackname = broken_cabs;
- files = "math.h";
- files = "architecture/ppc/math.h";
- files = "architecture/i386/math.h";
- select = '^extern[ \t]+double[ \t]+cabs';
+ files = math.h, "architecture/*/math.h";
+ select = "^extern[ \t]+double[ \t]+cabs";
- c_fix = format;
- c_fix_arg = "";
- c_fix_arg = "^extern[ \t]+double[ \t]+cabs[ \t]*\\([^\\)]*\\);";
+ sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//";
+ sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//";
test_text = "#ifdef __STDC__\n"
"extern double cabs(struct dbl_hypot);\n"
"#endif\n"
"extern double cabs ( _Complex z );\n"
"extern double cabs(); /* This is a comment\n"
- " and it ends here. */";
+ " and it ends here. */\n"
+ "extern double cabs(struct __cabs_s);\n"
+ "extern long double cabsl( struct __cabsl_s );";
+};
+
+
+/*
+ * Fixup Darwin's broken check for __builtin_nanf.
+ */
+fix = {
+ hackname = broken_nan;
+ /*
+ * 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 = "architecture/ppc/math.h";
+ files = "architecture/*/math.h";
+ select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
+ bypass = "powl";
+ c_fix = format;
+ c_fix_arg = "#if 1";
+ test_text = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
};
*/
fix = {
hackname = bsd_stdio_attrs_conflict;
- mach = *-*-*bsd*;
- mach = *-*-*darwin*;
+ mach = "*-*-*bsd*";
+ mach = "*-*-*darwin*";
files = stdio.h;
select = "^#define[ \t]*vfscanf[ \t]*__svfscanf[ \t]*$";
c_fix = format;
/*
+ * On darwin8 and earlier, mach-o/swap.h isn't properly guarded
+ * by 'extern "C"'. On darwin7 some mach/ headers aren't properly guarded.
+ */
+fix = {
+ hackname = darwin_externc;
+ mach = "*-*-darwin*";
+ files = mach-o/swap.h;
+ files = mach/mach_time.h;
+ files = mach/mach_traps.h;
+ files = mach/message.h;
+ files = mach/mig.h;
+ files = mach/semaphore.h;
+ bypass = "extern \"C\"";
+ bypass = "__BEGIN_DECLS";
+ 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 void swap_fat_header();\n";
+};
+
+
+/*
* AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of
* bad __GNUC__ tests.
*/
/*
+ * Darwin headers have a stdint.h that defines UINT8_C and UINT16_C to
+ * unsigned constants.
+ */
+fix = {
+ hackname = darwin_stdint_1;
+ mach = "*-*-darwin*";
+ files = stdint-darwin.h, stdint.h;
+ c_fix = format;
+ c_fix_arg = "#define UINT8_C(v)\tv\n#define UINT16_C(v)\tv";
+ select = "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n"
+ "#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)";
+ test_text = "#define UINT8_C(v) (v ## U)\n"
+ "#define UINT16_C(v) (v ## U)";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines INTPTR_MIN and INTPTR_MAX
+ * with wrong types.
+ */
+fix = {
+ hackname = darwin_stdint_2;
+ mach = "*-*-darwin*";
+ files = stdint-darwin.h, stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define INTPTR_MAX 9223372036854775807L\n"
+ "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#else\n"
+ "#define INTPTR_MAX 2147483647L\n"
+ "#define INTPTR_MIN (-INTPTR_MAX-1)\n"
+ "#endif";
+ select = "#if __WORDSIZE == 64\n"
+ "#define INTPTR_MIN[ \t]+INT64_MIN\n"
+ "#define INTPTR_MAX[ \t]+INT64_MAX\n"
+ "#else\n"
+ "#define INTPTR_MIN[ \t]+INT32_MIN\n"
+ "#define INTPTR_MAX[ \t]+INT32_MAX\n"
+ "#endif";
+ test_text = "#if __WORDSIZE == 64\n"
+ "#define INTPTR_MIN INT64_MIN\n"
+ "#define INTPTR_MAX INT64_MAX\n"
+ "#else\n"
+ "#define INTPTR_MIN INT32_MIN\n"
+ "#define INTPTR_MAX INT32_MAX\n"
+ "#endif";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines UINTPTR_MAX with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_3;
+ mach = "*-*-darwin*";
+ files = stdint-darwin.h, stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define UINTPTR_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define UINTPTR_MAX 4294967295UL\n"
+ "#endif";
+ select = "#if __WORDSIZE == 64\n"
+ "#define UINTPTR_MAX[ \t]+UINT64_MAX\n"
+ "#else\n"
+ "#define UINTPTR_MAX[ \t]+UINT32_MAX\n"
+ "#endif";
+ test_text = "#if __WORDSIZE == 64\n"
+ "#define UINTPTR_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define UINTPTR_MAX UINT32_MAX\n"
+ "#endif";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines SIZE_MAX with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_4;
+ mach = "*-*-darwin*";
+ files = stdint-darwin.h, stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define SIZE_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define SIZE_MAX 4294967295UL\n"
+ "#endif";
+ select = "#if __WORDSIZE == 64\n"
+ "#define SIZE_MAX[ \t]+UINT64_MAX\n"
+ "#else\n"
+ "#define SIZE_MAX[ \t]+UINT32_MAX\n"
+ "#endif";
+ test_text = "#if __WORDSIZE == 64\n"
+ "#define SIZE_MAX UINT64_MAX\n"
+ "#else\n"
+ "#define SIZE_MAX UINT32_MAX\n"
+ "#endif";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines {U,}INTMAX_{MIN,MAX}
+ * with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_5;
+ mach = "*-*-darwin*";
+ files = stdint-darwin.h, stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define INTMAX_MIN (-9223372036854775807L - 1)\n"
+ "#define INTMAX_MAX 9223372036854775807L\n"
+ "#define UINTMAX_MAX 18446744073709551615UL\n"
+ "#else\n"
+ "#define INTMAX_MIN (-9223372036854775807LL - 1)\n"
+ "#define INTMAX_MAX 9223372036854775807LL\n"
+ "#define UINTMAX_MAX 18446744073709551615ULL\n"
+ "#endif";
+ select = "#define INTMAX_MIN[ \t]+INT64_MIN\n"
+ "#define INTMAX_MAX[ \t]+INT64_MAX\n"
+ "\n"
+ "#define UINTMAX_MAX[ \t]+UINT64_MAX";
+ test_text = "#define INTMAX_MIN INT64_MIN\n"
+ "#define INTMAX_MAX INT64_MAX\n"
+ "\n"
+ "#define UINTMAX_MAX UINT64_MAX";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines {U,}INTMAX_C
+ * with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_6;
+ mach = "*-*-darwin*";
+ files = stdint-darwin.h, stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
+ "#define PTRDIFF_MAX 9223372036854775807L\n"
+ "#else\n"
+ "#define PTRDIFF_MIN (-2147483647 - 1)\n"
+ "#define PTRDIFF_MAX 2147483647\n"
+ "#endif";
+ select = "#if __WORDSIZE == 64\n"
+ "#define PTRDIFF_MIN[ \t]+INT64_MIN\n"
+ "#define PTRDIFF_MAX[ \t]+INT64_MAX\n"
+ "#else\n"
+ "#define PTRDIFF_MIN[ \t]+INT32_MIN\n"
+ "#define PTRDIFF_MAX[ \t]+INT32_MAX\n"
+ "#endif";
+ test_text = "#if __WORDSIZE == 64\n"
+ "#define PTRDIFF_MIN INT64_MIN\n"
+ "#define PTRDIFF_MAX INT64_MAX\n"
+ "#else\n"
+ "#define PTRDIFF_MIN INT32_MIN\n"
+ "#define PTRDIFF_MAX INT32_MAX\n"
+ "#endif";
+};
+
+
+/*
+ * Darwin headers have a stdint.h that defines {U,}INTMAX_C
+ * with a wrong type.
+ */
+fix = {
+ hackname = darwin_stdint_7;
+ mach = "*-*-darwin*";
+ files = stdint-darwin.h, stdint.h;
+ c_fix = format;
+ c_fix_arg = "#if __WORDSIZE == 64\n"
+ "#define INTMAX_C(v) (v ## L)\n"
+ "#define UINTMAX_C(v) (v ## UL)\n"
+ "#else\n"
+ "#define INTMAX_C(v) (v ## LL)\n"
+ "#define UINTMAX_C(v) (v ## ULL)\n"
+ "#endif";
+ select = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
+ "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
+ test_text = "#define INTMAX_C(v) (v ## LL)\n"
+ "#define UINTMAX_C(v) (v ## ULL)";
+};
+
+
+/*
* Fix <c_asm.h> on Digital UNIX V4.0:
* It contains a prototype for a DEC C internal asm() function,
* clashing with gcc's asm keyword. So protect this with __DECC.
/*
- * math.h on SunOS 4 puts the declaration of matherr before the definition
- * of struct exception, so the prototype (added by fixproto) causes havoc.
- * This must appear before the math_exception fix.
- */
-fix = {
- hackname = exception_structure;
- files = math.h;
-
- /* If matherr has a prototype already, the header needs no fix. */
- bypass = 'matherr.*(struct exception|__MATH_EXCEPTION|[ \t]*__FP_EXCEPTION[ \t]*\*[ \t]*)';
- select = matherr;
-
- c_fix = wrap;
- c_fix_arg = "struct exception;\n";
-
- test_text = "extern int matherr();";
-};
-
-
-/*
* 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
* (by design?) when __GNUC__ is set beyond 2.
*/
fix = {
hackname = freebsd_gcc3_breakage;
- mach = *-*-freebsd*;
+ mach = "*-*-freebsd*";
files = sys/cdefs.h;
select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7$';
bypass = '__GNUC__[ \t]*([>=]=[ \t]*[3-9]|>[ \t]*2)';
*/
fix = {
hackname = freebsd_gcc4_breakage;
- mach = *-*-freebsd*;
+ mach = "*-*-freebsd*";
files = sys/cdefs.h;
select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
c_fix = format;
/*
- * Fix these files to use the types we think they should for
- * ptrdiff_t, size_t, and wchar_t.
- *
- * This defines the types in terms of macros predefined by our 'cpp'.
- * This is supposedly necessary for glibc's handling of these types.
- * It's probably not necessary for anyone else, but it doesn't hurt.
+ * Some versions of glibc don't expect the C99 inline semantics.
*/
fix = {
- hackname = gnu_types;
- files = "sys/types.h";
+ hackname = glibc_c99_inline_1;
+ files = features.h, '*/features.h';
+ select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
+ c_fix = format;
+ c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)";
+ test_text = <<-EOT
+ #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
+ && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
+ # define __USE_EXTERN_INLINES 1
+ #endif
+ EOT;
+};
+
+
+/*
+ * Similar, but a version that didn't have __NO_INLINE__
+ */
+fix = {
+ hackname = glibc_c99_inline_1a;
+ files = features.h, '*/features.h';
+ select = "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
+ "(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
+ c_fix = format;
+ c_fix_arg = "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
+ test_text = <<-EOT
+ #if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
+ # define __USE_EXTERN_INLINES 1
+ #endif
+ EOT;
+};
+
+
+/*
+ * The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
+ * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
+ * The remaining glibc_c99_inline_* fixes deal with some of those headers.
+ */
+fix = {
+ hackname = glibc_c99_inline_2;
+ files = sys/stat.h, '*/sys/stat.h';
+ select = "extern __inline__ int";
+ sed = "s/extern int \\(stat\\)/"
+ "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
+ "__inline__ int \\1/";
+ sed = "s/extern int \\([lf]stat\\)/"
+ "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
+ "__inline__ int \\1/";
+ sed = "s/extern int \\(mknod\\)/"
+ "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
+ "__inline__ int \\1/";
+ sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\(stat\\)/"
+ "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
+ "__inline__ int __REDIRECT\\1 (\\2/";
+ sed = "s/extern int __REDIRECT\\(_NTH\\)\\{0,1\\} (\\([lf]stat\\)/"
+ "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
+ "__inline__ int __REDIRECT\\1 (\\2/";
+ sed = "s/^extern __inline__ int/"
+ "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
+ "__inline__ int/";
+ test_text = <<-EOT
+ extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
+ extern __inline__ int
+ __NTH (fstat64 (int __fd, struct stat64 *__statbuf))
+ {}
+ EOT;
+};
+
+
+fix = {
+ hackname = glibc_c99_inline_3;
+ files = bits/string2.h, '*/bits/string2.h';
+ select = "extern __inline";
+ bypass = "__extern_inline|__GNU_STDC_INLINE__";
+ c_fix = format;
+ c_fix_arg = "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
+ c_fix_arg = "^# ifdef __cplusplus$";
+ test_text = <<-EOT
+ # ifdef __cplusplus
+ # define __STRING_INLINE inline
+ # else
+ # define __STRING_INLINE extern __inline
+ # endif
+ EOT;
+};
+
+
+fix = {
+ hackname = glibc_c99_inline_4;
+ files = sys/sysmacros.h, '*/sys/sysmacros.h', wchar.h, '*/wchar.h';
+ bypass = "__extern_inline|__gnu_inline__";
+ select = "(^| )extern __inline";
+ c_fix = format;
+ c_fix_arg = "%0 __attribute__ ((__gnu_inline__))";
+ test_text = <<-EOT
+ __extension__ extern __inline unsigned int
+ extern __inline unsigned int
+ EOT;
+};
+
+
+/* glibc-2.3.5 defines pthread mutex initializers incorrectly,
+ * so we replace them with versions that correspond to the
+ * definition.
+ */
+fix = {
+ hackname = glibc_mutex_init;
+ files = pthread.h;
+ select = '\{ *\{ *0, *\} *\}';
+ sed = "/define[ \t]\\{1,\\}PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/{\n"
+ "N\ns/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/\n}";
+ sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
+ "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0 }/";
+ sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
+ "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0 }/";
+ sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_"
+ "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
+ sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
+ "\\(RECURSIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
+ sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
+ "\\(ERRORCHECK\\)_NP\\) }/{ \\1, 0, 0 }/";
+ sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_"
+ "\\(ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
+ sed = "/define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
+ "N;s/^[ \t]*#[ \t]*"
+ "\\(define[ \t]\\{1,\\}PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\\\)\\n"
+ "[ \t]*{ { 0, } }/# if __WORDSIZE == 64\\\n"
+ "# \\1\\\n"
+ " { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
+ "# else\\\n"
+ "# \\1\\\n"
+ " { { 0, 0, 0, 0, 0, 0, 0, 0 } }\\\n"
+ "# endif/";
+ sed = "s/{ \\(0, 0, 0, 0, 0, 0, "
+ "PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
+ sed = "/define[ \t]\\{1,\\}PTHREAD_COND_INITIALIZER/"
+ "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, (void *) 0, 0, 0 } }/";
+
+ test_text = <<- _EOText_
+ #define PTHREAD_MUTEX_INITIALIZER \\
+ { { 0, } }
+ #ifdef __USE_GNU
+ # if __WORDSIZE == 64
+ # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \\
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
+ # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \\
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
+ # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \\
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
+ # else
+ # define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \\
+ { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP } }
+ # define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \\
+ { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP } }
+ # define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \\
+ { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP } }
+ # endif
+ #endif
+ # define PTHREAD_RWLOCK_INITIALIZER \\
+ { { 0, } }
+ # ifdef __USE_GNU
+ # if __WORDSIZE == 64
+ # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \\
+ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \\
+ PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
+ # else
+ # define PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP \\
+ { { 0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP } }
+ # endif
+ # endif
+ #define PTHREAD_COND_INITIALIZER { { 0, } }
+ _EOText_;
+};
+
+
+/* glibc versions before 2.5 have a version of stdint.h that defines
+ UINT8_C and UINT16_C to produce unsigned constants, as do uClibc
+ versions with stdint.h based on those glibc versions. */
+fix = {
+ hackname = glibc_stdint;
+ files = stdint.h;
+ select = "GNU C Library";
+ c_fix = format;
+ c_fix_arg = "# define UINT8_C(c)\tc\n# define UINT16_C(c)\tc";
+ c_fix_arg = "# define UINT8_C\\(c\\)\tc ## U\n# define UINT16_C\\(c\\)\tc ## U";
+ test_text = "/* This file is part of the GNU C Library. */\n# define UINT8_C(c)\tc ## U\n# define UINT16_C(c)\tc ## U";
+};
+
+
+/* Some versions of glibc have a version of bits/string2.h that
+ produces "value computed is not used" warnings from strncpy; fix
+ this definition by using __builtin_strncpy instead as in newer
+ versions. */
+fix = {
+ hackname = glibc_strncpy;
+ files = bits/string2.h;
+ bypass = "__builtin_strncpy";
+ c_fix = format;
+ c_fix_arg = "# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
+ c_fix_arg = "# define strncpy([^\n]*\\\\\n)*[^\n]*";
+ test_text = <<-EOT
+ # define strncpy(dest, src, n) \
+ (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \\
+ ? (strlen (src) + 1 >= ((size_t) (n)) \\
+ ? (char *) memcpy (dest, src, n) \\
+ : strncpy (dest, src, n)) \\
+ : strncpy (dest, src, n)))
+ EOT;
+
+};
+
+/* glibc's tgmath.h relies on an expression that is not an integer
+ constant expression being treated as it was by GCC 4.4 and
+ earlier. */
+fix = {
+ hackname = glibc_tgmath;
+ files = tgmath.h;
+ select = '\(\(\(type\) 0.25\) && \(\(type\) 0.25 - 1\)\)';
+ bypass = "__floating_type\\(type\\) \\\\\n.*__builtin_classify_type";
+ c_fix = format;
+ c_fix_arg = "(__builtin_classify_type ((type) 0) == 8 || (__builtin_classify_type ((type) 0) == 9 && __builtin_classify_type (__real__ ((type) 0)) == 8))";
+ test_text = "# define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))";
+};
+
+/*
+ * Fix these files to use the types we think they should for
+ * ptrdiff_t, size_t, and wchar_t.
+ *
+ * This defines the types in terms of macros predefined by our 'cpp'.
+ * This is supposedly necessary for glibc's handling of these types.
+ * It's probably not necessary for anyone else, but it doesn't hurt.
+ */
+fix = {
+ hackname = gnu_types;
+ files = "sys/types.h";
files = "stdlib.h";
files = "sys/stdtypes.h";
files = "stddef.h";
/*
+ * Un-Hide a series of five FP defines from post-1999 compliance GCC:
+ * FP_NORMAL, FP_ZERO, FP_INFINITE, FP_SUBNORMAL and FP_NAN
+ */
+fix = {
+ hackname = hppa_hpux_fp_macros;
+ mach = "hppa*-hp-hpux11*";
+ files = math.h;
+ select = "#[ \t]*define[ \t]*FP_NORMAL.*\n"
+ "#[ \t]*define[ \t]*FP_ZERO.*\n"
+ "#[ \t]*define[ \t]*FP_INFINITE.*\n"
+ "#[ \t]*define[ \t]*FP_SUBNORMAL.*\n"
+ "#[ \t]*define[ \t]*FP_NAN.*\n";
+ c_fix = format;
+ c_fix_arg = <<- _EOFix_
+ #endif /* _INCLUDE_HPUX_SOURCE */
+
+ #if defined(_INCLUDE_HPUX_SOURCE) || \
+ (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))
+ %0#endif
+
+ #ifdef _INCLUDE_HPUX_SOURCE
+
+ _EOFix_;
+
+ test_text =
+ "# define FP_NORMAL 0\n"
+ "# define FP_ZERO 1\n"
+ "# define FP_INFINITE 2\n"
+ "# define FP_SUBNORMAL 3\n"
+ "# define FP_NAN 4\n";
+};
+
+
+/*
* Delete C++ double pow (double, int) inline function from HP-UX 10 & 11
* math.h to prevent clash with define in c_std/bits/std_cmath.h.
*/
*/
fix = {
hackname = hpux11_abs;
- mach = ia64-hp-hpux11*;
+ mach = "ia64-hp-hpux11*";
files = stdlib.h;
select = "ifndef _MATH_INCLUDED";
c_fix = format;
c_fix_arg = "if !defined(_MATH_INCLUDED) || defined(__GNUG__)";
-// sed = "s/ifndef _MATH_INCLUDED/if !defined(_MATH_INCLUDED) || defined(__GNUG__)/";
test_text = "#ifndef _MATH_INCLUDED";
};
/*
+ * Fix C99 constant in __POINTER_SET define.
+ */
+fix = {
+ hackname = hpux11_pthread_const;
+ mach = "*-hp-hpux11.[0-3]*";
+ files = sys/pthread.h;
+ select = "^#define[ \t]*__POINTER_SET[ \t]*\\(\\(void \\*\\) 1LL\\)";
+
+ c_fix = format;
+ c_fix_arg = "#define __POINTER_SET\t\t((void *) 1L)";
+ test_text = "#define __POINTER_SET\t\t((void *) 1LL)";
+};
+
+
+/*
* Prevent HP-UX 11 from defining __size_t and preventing size_t from
* being defined by having it define _hpux_size_t instead.
*/
"extern int snprintf(char *, _hpux_size_t, char *, ...);";
};
-
-/*
- * In inttypes.h on HPUX 11, the use of __CONCAT__ in the definition
- * of UINT32_C has undefined behavior according to ISO/ANSI:
- * the arguments to __CONCAT__ are not macro expanded before the
- * concatination happens so the trailing ')' in the first argument
- * is concatinated with the 'l' in the second argument creating an
- * invalid pp token. The behavior of invalid pp tokens is undefined.
- * GCC does not handle these invalid tokens the way the HP compiler does.
- * This problem will potentially occur anytime macros are used in the
- * arguments to __CONCAT__. A general solution to this problem would be to
- * insert another layer of macro between __CONCAT__ and its use
- * in UINT32_C. An example of this solution can be found in the C standard.
- * A more specific solution, the one used here, is to change the UINT32_C
- * macro to not used macros in the arguments to __CONCAT__.
- */
-fix = {
- hackname = hpux11_uint32_c;
- files = inttypes.h;
- select = "^#define UINT32_C\\(__c\\)[ \t]*"
- "__CONCAT__\\(__CONCAT_U__\\(__c\\),l\\)";
- c_fix = format;
- c_fix_arg = '#define UINT32_C(__c) __CONCAT__(__c,ul)';
- test_text =
- "#define CONCAT_U__(__c)\t__CONCAT__(__c,u)\n"
- "#define UINT32_C(__c)\t__CONCAT__(__CONCAT_U__(__c),l)";
-};
-
-
/*
* Fix hpux 11.00 broken vsnprintf declaration
*/
*/
fix = {
hackname = hpux_long_double;
+ mach = "*-*-hpux10*";
+ mach = "*-*-hpux11.[012]*";
files = stdlib.h;
select = "extern[ \t]long_double[ \t]strtold";
bypass = "long_double_t";
"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.
+ */
+fix = {
+ hackname = hpux_long_double_2;
+ mach = "hppa*-*-hpux11.3*";
+ files = stdlib.h;
+ select = "#[ \t]*if[ \t]*!defined\\(__ia64\\) \\|\\| defined\\(_PROTOTYPES\\) \\|\\| defined\\(_LONG_DOUBLE_STRUCT\\)";
+ c_fix = format;
+ c_fix_arg = "# if !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)";
+
+ test_text = "# if !defined(__ia64) || !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)\n";
+};
/*
* Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
/*
+ * 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\nextern \"C\" {\n#endif\n%0\n#ifdef __cplusplus\n}\n#endif";
+ test_text = " extern int errno;\n";
+};
+
+
+/*
+ * Add missing braces to pthread initializer defines.
+ */
+fix = {
+ hackname = hpux_pthread_initializers;
+ mach = "*-hp-hpux11.[0-3]*";
+ files = sys/pthread.h;
+ sed = "s@^[ \t]*1, 1, 1, 1,[ \t]*\\\\"
+ "@\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@";
+ sed = "s@^[ \t]*1,[ \t]*\\\\"
+ "@\t{ 1, 0 }@";
+ sed = "/^[ \t]*0$/d";
+ sed = "s@__PTHREAD_MUTEX_VALID, 0"
+ "@{ __PTHREAD_MUTEX_VALID, 0 }@";
+ sed = "s@^[ \t]*0, 0, -1, 0,[ \t]*\\\\"
+ "@\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@";
+ sed = "s@0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,[ \t]*\\\\"
+ "@{ 0, __LWP_MTX_VALID }, { 0, 1, 1, 1, 1 },\t\t\t\\\\@";
+ sed = "s@^[ \t]*__LWP_MTX_VALID, 0, 1, 1, 1, 1,[ \t]*\\\\"
+ "@\t{ 0, __LWP_MTX_VALID }, { 0, 1, 1, 1, 1 },\t\t\t\\\\@";
+ sed = "s@^[ \t]*0, 0[ \t]*\\\\"
+ "@\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@";
+ sed = "s@__PTHREAD_COND_VALID, 0"
+ "@{ __PTHREAD_COND_VALID, 0 }@";
+ sed = "s@__LWP_COND_VALID, 0,[ \t]*\\\\"
+ "@{ __LWP_COND_VALID, 0 },\t\t\t\t\t\\\\@";
+ sed = "s@__PTHREAD_RWLOCK_VALID, 0"
+ "@{ __PTHREAD_RWLOCK_VALID, 0 }@";
+ sed = "s@__LWP_RWLOCK_VALID, 0,[ \t]*\\\\"
+ "@{ __LWP_RWLOCK_VALID, 0 },\t\t\t\t\t\\\\@";
+ sed = "s@^[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\"
+ "@\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@";
+ test_text = "#define PTHREAD_MUTEX_INITIALIZER {\t\t\t\t\t\\\\\n"
+ "\t__PTHREAD_MUTEX_VALID, 0,\t\t\t\t\t\\\\\n"
+ "\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE),\t\t\\\\\n"
+ "\t__SPNLCK_INITIALIZER,\t\t\t\t\t\t\\\\\n"
+ "\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n"
+ "\t0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
+ "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
+ "}\n";
+};
+
+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";
+};
+
+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*";
+ files = stdint-hpux11.h, stdint.h;
+ select =
+ "^[ \t]*#[ \t]*define[ \t]+UINT_(LEAST|FAST)64_MAX[ \t]+ULLONG_MAX";
+ c_fix = format;
+ 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_;
+};
+
+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";
+};
+
+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";
+};
+
+/*
+ * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
+ */
+fix = {
+ hackname = huge_val_hex;
+ files = bits/huge_val.h;
+ select = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
+ bypass = "__builtin_huge_val";
+
+ c_fix = format;
+ c_fix_arg = "#define HUGE_VAL (__builtin_huge_val())\n";
+
+ test_text = "# define HUGE_VAL\t(__extension__ 0x1.0p2047)";
+};
+
+
+/*
+ * Fix glibc definition of HUGE_VALF in terms of hex floating point constant
+ */
+fix = {
+ hackname = huge_valf_hex;
+ files = bits/huge_val.h;
+ select = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
+ bypass = "__builtin_huge_valf";
+
+ c_fix = format;
+ c_fix_arg = "#define HUGE_VALF (__builtin_huge_valf())\n";
+
+ test_text = "# define HUGE_VALF (__extension__ 0x1.0p255f)";
+};
+
+
+/*
+ * Fix glibc definition of HUGE_VALL in terms of hex floating point constant
+ */
+fix = {
+ hackname = huge_vall_hex;
+ files = bits/huge_val.h;
+ select = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
+ bypass = "__builtin_huge_vall";
+
+ c_fix = format;
+ c_fix_arg = "#define HUGE_VALL (__builtin_huge_vall())\n";
+
+ test_text = "# define HUGE_VALL (__extension__ 0x1.0p32767L)";
+};
+
+
+/*
* Fix return type of abort and free
*/
fix = {
/*
+ * IRIX 6.5 complex.h defines _Complex_I and _Imaginary_I in terms of __I__,
+ * which is a MIPSpro compiler builtin. Remove _Imaginary_I and imaginary
+ * definitions which are not supported by GCC.
+ */
+fix = {
+ hackname = irix_complex;
+ mach = "mips-sgi-irix6.5";
+ files = complex.h;
+ select = "#define[ \t]_Complex_I[ \t]\\(\\(float[ \t]_Complex\\)[ \t]\\(__I__\\)\\)";
+ sed = "s/#define[ \t]_Complex_I[ \t]((float[ \t]_Complex)[ \t](__I__))/"
+ "#define _Complex_I (__extension__ 1.0iF)/";
+ sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
+ sed = "/#define[ \t]_Imaginary_I/d";
+ sed = "s/#define[ \t]I[ \t]_Imaginary_I/#define I _Complex_I/";
+ test_text = "#define _Complex_I ((float _Complex) (__I__))\n"
+ "#define imaginary _Imaginary\n"
+ "// #define _Imaginary_I ((float _Imaginary) 1)\n"
+ "#define _Imaginary_I __I__\n"
+ "#define I _Imaginary_I";
+};
+
+
+/*
* Non-traditional "const" declaration in Irix's limits.h.
*/
fix = {
};
/*
+ * IRIX 6.5 <stdint.h> only works with ISO C99 and errors out
+ * otherwise.
+ */
+fix = {
+ hackname = irix_stdint_c99_mode;
+ files = stdint.h;
+ select = "(#ifndef __c99\n)(#error This header file is to be used only for c99 mode compilations)";
+
+ mach = "mips-sgi-irix6.5";
+ c_fix = format;
+ c_fix_arg = "#if 0\n"
+ "%2";
+ test_text =
+ "#ifndef __c99\n#error This header file is to be used only for c99 mode compilations\n#else";
+};
+
+
+/*
+ * IRIX 6.5 <stdint.h> has some *_MIN/MAX constants whose types don't
+ * match the corresponding types, as required by ISO C99.
+ */
+fix = {
+ hackname = irix_stdint_c99_types;
+ files = stdint-irix65.h, stdint.h;
+ mach = "mips-sgi-irix6.5";
+ sed = "s@^#define INT64_MIN.*(-0x7fffffffffffffff - 1)$@"
+ "#define INT64_MIN (-0x7fffffffffffffffLL - 1)@";
+ sed = "s@^#define INT64_MAX.*0x7fffffffffffffff$@"
+ "#define INT64_MAX 0x7fffffffffffffffLL@";
+ sed = "s@^#define UINT32_MAX.*0xffffffff$@"
+ "#define UINT32_MAX 0xffffffffU@";
+ sed = "s@^#define UINT64_MAX.*0xffffffffffffffff$@"
+ "#define UINT64_MAX 0xffffffffffffffffULL@";
+ sed = "s@^#define INTPTR_MIN.*INT32_MIN$@"
+ "#define INTPTR_MIN (-0x7fffffffL - 1)@";
+ sed = "s@^#define INTPTR_MAX.*INT32_MAX$@"
+ "#define INTPTR_MAX 0x7fffffffL@";
+ sed = "s@^#define UINTPTR_MAX.*UINT32_MAX$@"
+ "#define UINTPTR_MAX 0xffffffffUL@";
+ sed = "s@^#define INTPTR_MIN.*INT64_MIN@"
+ "#define INTPTR_MIN (-0x7fffffffffffffffL - 1)@";
+ sed = "s@^#define INTPTR_MAX.*INT64_MAX$@"
+ "#define INTPTR_MAX 0x7fffffffffffffffL@";
+ sed = "s@^#define UINTPTR_MAX.*UINT64_MAX$@"
+ "#define UINTPTR_MAX 0xffffffffffffffffUL@";
+ sed = "s@^#define PTRDIFF_MIN.*INT64_MIN$@"
+ "#define PTRDIFF_MIN (-0x7fffffffffffffffL - 1)@";
+ sed = "s@^#define PTRDIFF_MAX.*INT64_MAX$@"
+ "#define PTRDIFF_MAX 0x7fffffffffffffffL@";
+ sed = "s@^#define SIZE_MAX.*UINT64_MAX$@"
+ "#define SIZE_MAX 0xffffffffffffffffUL@";
+ test_text = "#define INT64_MIN (-0x7fffffffffffffff - 1)\n"
+ "#define INT64_MAX 0x7fffffffffffffff\n"
+ "#define UINT32_MAX 0xffffffff\n"
+ "#define UINT64_MAX 0xffffffffffffffff\n"
+ "#define INTPTR_MIN INT32_MIN\n"
+ "#define INTPTR_MAX INT32_MAX\n"
+ "#define UINTPTR_MAX UINT32_MAX\n"
+ "#define INTPTR_MIN INT64_MIN\n"
+ "#define INTPTR_MAX INT64_MAX\n"
+ "#define UINTPTR_MAX UINT64_MAX\n"
+ "#define PTRDIFF_MIN INT64_MIN\n"
+ "#define PTRDIFF_MAX INT64_MAX\n"
+ "#define SIZE_MAX UINT64_MAX";
+};
+
+
+/*
+ * IRIX 6.5 <stdint.h> uses casts in some macros which cannot thus be used
+ * in preprocessor tests, although ISO C99 requires this.
+ */
+fix = {
+ hackname = irix_stdint_c99_macros;
+ files = stdint-irix65.h, stdint.h;
+ mach = "mips-sgi-irix6.5";
+ sed = "s@^#define INT8_C(x).*int.*_t.*$@#define INT8_C(x) (x)@";
+ sed = "s@^#define INT16_C(x).*int.*_t.*$@#define INT16_C(x) (x)@";
+ sed = "s@^#define INT32_C(x).*int.*_t.*$@#define INT32_C(x) (x)@";
+ sed = "s@^#define INT64_C(x).*int.*_t.*$@#define INT64_C(x) (x ## LL)@";
+ sed = "s@^#define UINT8_C(x).*int.*_t.*$@#define UINT8_C(x) (x)@";
+ sed = "s@^#define UINT16_C(x).*int.*_t.*$@#define UINT16_C(x) (x)@";
+ sed = "s@^#define UINT32_C(x).*int.*_t.*$@#define UINT32_C(x) (x ## U)@";
+ sed = "s@^#define UINT64_C(x).*int.*_t.*$@#define UINT64_C(x) (x ## ULL)@";
+ sed = "s@^#define INTMAX_C(x).*int.*_t.*$@#define INTMAX_C(x) (x ## LL)@";
+ sed = "s@^#define UINTMAX_C(x).*int.*_t.*$@#define UINTMAX_C(x) (x ## ULL)@";
+ test_text = "#define INT8_C(x) (int_least8_t)(x)\n"
+ "#define INT16_C(x) (int_least16_t)(x)\n"
+ "#define INT32_C(x) (int_least32_t)(x)\n"
+ "#define INT64_C(x) (int_least64_t)(x)\n"
+ "#define UINT8_C(x) (uint_least8_t)(x)\n"
+ "#define UINT16_C(x) (uint_least16_t)(x)\n"
+ "#define UINT32_C(x) (uint_least32_t)(x)\n"
+ "#define UINT64_C(x) (uint_least64_t)(x)\n"
+ "#define INTMAX_C(x) (intmax_t)(x)\n"
+ "#define UINTMAX_C(x) (uintmax_t)(x)";
+};
+
+
+/*
* IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
* some functions that take a va_list as
* taking char *. However, GCC uses void * for va_list, so
c_fix_arg = "#if _NO_XOPEN5 && !defined(__c99)\n%1";
test_text = "#if _NO_XOPEN5\n"
- "extern size_t wcsftime(wchar_t *, __SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, const struct tm *);";
-};
-
-/*
- * Fixing ISC fmod declaration
- */
-fix = {
- hackname = isc_fmod;
- files = math.h;
- select = 'fmod\(double\)';
- c_fix = format;
- c_fix_arg = "fmod(double, double)";
- test_text = "extern double fmod(double);";
-};
-
-
-/*
- * On Interactive Unix 2.2, certain traditional Unix definitions
- * (notably getc and putc in stdio.h) are omitted if __STDC__ is
- * defined, not just if _POSIX_SOURCE is defined. This makes it
- * impossible to compile any nontrivial program except with -posix.
- */
-fix = {
- hackname = isc_omits_with_stdc;
-
- files = "stdio.h";
- files = "math.h";
- files = "ctype.h";
- files = "sys/limits.h";
- files = "sys/fcntl.h";
- files = "sys/dirent.h";
-
- select = '!defined\(__STDC__\) && !defined\(_POSIX_SOURCE\)';
- c_fix = format;
- c_fix_arg = '!defined(_POSIX_SOURCE)';
- test_text = "#if !defined(__STDC__) && !defined(_POSIX_SOURCE) /* ? ! */"
- "\nint foo;\n#endif";
+ "extern size_t wcsftime(wchar_t *, "
+ "__SGI_LIBC_NAMESPACE_QUALIFIER size_t, const char *, "
+ "const struct tm *);";
};
fix = {
hackname = kandr_concat;
files = "sparc/asm_linkage.h";
- files = "sun3/asm_linkage.h";
- files = "sun3x/asm_linkage.h";
- files = "sun4/asm_linkage.h";
- files = "sun4c/asm_linkage.h";
- files = "sun4m/asm_linkage.h";
- files = "sun4c/debug/asm_linkage.h";
- files = "sun4m/debug/asm_linkage.h";
+ files = "sun*/asm_linkage.h";
files = "arm/as_support.h";
files = "arm/mc_type.h";
files = "arm/xcb.h";
};
-/*
- * Fix libc1 _G_va_list definition, used in declarations of several
- * more-or-less standard functions, for example vasprintf.
- */
-fix = {
- hackname = libc1_G_va_list;
- files = _G_config.h;
- mach = '*-*-linux*libc1';
- select = 'typedef void \* _G_va_list;';
- c_fix = format;
- c_fix_arg = "typedef __builtin_va_list _G_va_list;";
- test_text = 'typedef void * _G_va_list;';
-};
-
-
-/*
- * GNU libc1 string.h does not prototype memcpy and memcmp for gcc
- * versions > 1. This fix will open up the declaration for all
- * versions of GCC and for g++.
- */
-fix = {
- hackname = libc1_ifdefd_memx;
-
- /* The string.h result is overwritten by AAB_ultrix_string when doing
- "make check" and will fail. Therefore, we add the following kludgery
- to insert the test_text into the special testing header. :-} */
- files = testing.h;
- files = string.h;
-
- c_fix = format;
- select = "' is a built-in function for gcc 2\\.x\\. \\*/";
- bypass = __cplusplus;
- c_fix_arg = "%1";
- c_fix_arg =
- '/\* `mem...\' is a built-in function for gcc 2\.x\. \*/' "\n"
- '#if defined\(__STDC__\) && __GNUC__ < 2' "\n"
- "(/\\* .* \\*/\n"
- "extern [a-z_]+ mem.*(\n[^#].*)*;)\n"
- "#endif";
-
- test_text =
- "/* \\`memcpy' is a built-in function for gcc 2.x. */\n"
- "#if defined(__STDC__) && __GNUC__ < 2\n"
- "/* Copy N bytes of SRC to DEST. */\n"
- "extern __ptr_t memcpy __P ((__ptr_t __dest, __const __ptr_t __src,\n"
- " size_t __n));\n"
- "#endif";
-};
-
-
/* 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++.
};
-/*
- * Apparently some SVR4 systems typedef longlong_t to long ?
- */
-#ifdef SVR4
-fix = {
- hackname = longlong_t;
- select = "typedef[ \t]+(unsigned[ \t]+)?long[ \t]+(u_)?longlong_t";
- c_fix = format;
- c_fix_arg = "typedef %1long long %2longlong_t";
- test_text = "typedef long longlong_t\n"
- "typedef unsigned long u_longlong_t";
-};
-#endif
-
/*
* Remove header file warning from sys/time.h. Autoconf's
* AC_HEADER_TIME recommends to include both sys/time.h and time.h
* Interface Definition), which conflicts with the class exception defined
* in the C++ file std/stdexcept.h. We redefine it to __math_exception.
* This is not a great fix, but I haven't been able to think of anything
- * better. Note that we have to put the #ifdef/#endif blocks at beginning
- * and end of file, because fixproto runs after us and may insert
- * additional references to struct exception.
+ * better.
*/
fix = {
hackname = math_exception;
* exception either. So currently we bypass only for glibc, based on a
* comment in the fixed glibc header. Ick.
*/
- bypass = 'We have a problem when using C\+\+|for C\+\+, _[a-z0-9A-Z_]+_exception; for C, exception';
+ bypass = 'We have a problem when using C\+\+|for C\+\+, '
+ '_[a-z0-9A-Z_]+_exception; for C, exception';
c_fix = wrap;
c_fix_arg = "#ifdef __cplusplus\n"
/*
- * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
+ * Some versions of NetBSD don't expect the C99 inline semantics.
*/
fix = {
- hackname = nested_motorola;
- mach = "m68k-motorola-sysv*";
- files = sys/limits.h;
- files = limits.h;
- select = "max # bytes atomic in write|error value returned by Math lib";
+ hackname = netbsd_c99_inline_1;
+ mach = "*-*-netbsd*";
+ files = signal.h;
+ select = "extern __inline int";
- sed = "s@^\\(#undef[ \t][ \t]*PIPE_BUF[ \t]*"
- "/\\* max # bytes atomic in write to a\\)$@\\1 */@";
- sed = "s@\\(/\\*#define\tHUGE_VAL\t3.[0-9e+]* \\)"
- "\\(/\\*error value returned by Math lib\\*/\\)$@\\1*/ \\2@";
+ c_fix = format;
+ c_fix_arg = "extern\n"
+ "#ifdef __GNUC_STDC_INLINE__\n"
+ "__attribute__((__gnu_inline__))\n"
+ "#endif\n"
+ "__inline int";
- test_text =
- "#undef PIPE_BUF /* max # bytes atomic in write to a\n"
- "\t\t/* PIPE */\n"
- "/*#define\tHUGE_VAL\t3.9e+9 /*error value returned by Math lib*/";
+ test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
};
-/*
- * Fixing nested comments in ISC <sys/limits.h>
- */
fix = {
- hackname = nested_sys_limits;
- files = sys/limits.h;
- select = CHILD_MAX;
- sed = "/CHILD_MAX/s,/\\* Max, Max,";
- sed = "/OPEN_MAX/s,/\\* Max, Max,";
- test_text = "/*\n#define CHILD_MAX 20 /* Max, Max, ... */ /*\n"
- "#define OPEN_MAX 20 /* Max, Max, ... */\n";
+ hackname = netbsd_c99_inline_2;
+ mach = "*-*-netbsd*";
+ files = signal.h;
+ select = "#define _SIGINLINE extern __inline";
+
+ c_fix = format;
+ c_fix_arg = <<- _EOArg_
+ #ifdef __GNUC_STDC_INLINE__
+ #define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline
+ #else
+ %0
+ #endif
+ _EOArg_;
+
+ test_text = "#define _SIGINLINE extern __inline";
};
*/
fix = {
hackname = netbsd_extra_semicolon;
- mach = *-*-netbsd*;
+ mach = "*-*-netbsd*";
files = sys/cdefs.h;
select = "#define[ \t]*__END_DECLS[ \t]*};";
};
+/* 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;
+ select = "@todo - Add support for wint_t types";
+ sed = "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@";
+ sed = "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@";
+ sed = "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@";
+ sed = "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@";
+ sed = "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@";
+ sed = "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@";
+ sed = 's@#define INT_FAST\([0-9]*\)_MIN.*@#define INT_FAST\1_MIN (-INT_FAST\1_MAX - 1)@';
+ sed = 's@#define INT_FAST\([0-9]*\)_MAX.*@#define INT_FAST\1_MAX __INT_FAST\1_MAX__@';
+ sed = 's@#define UINT_FAST\([0-9]*\)_MAX.*@#define UINT_FAST\1_MAX __UINT_FAST\1_MAX__@';
+ sed = "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@";
+ sed = "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
+ sed = "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@";
+ sed = "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@";
+ sed = "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@";
+ test_text = "/* @todo - Add support for wint_t types. */\n"
+ "#define INT32_MIN (-2147483647-1)\n"
+ "#define INT32_MAX 2147483647\n"
+ "#define UINT32_MAX 4294967295U\n"
+ "#define INT_LEAST32_MIN (-2147483647-1)\n"
+ "#define INT_LEAST32_MAX 2147483647\n"
+ "#define UINT_LEAST32_MAX 4294967295U\n"
+ "#define INT_FAST8_MIN INT8_MIN\n"
+ "#define INT_FAST8_MAX INT8_MAX\n"
+ "#define UINT_FAST8_MAX UINT8_MAX\n"
+ "#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)\n"
+ "#define PTRDIFF_MIN (-__STDINT_EXP(LONG_MAX) - 1L)\n"
+ "#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)\n"
+ "#define UINT8_C(x) x##U\n"
+ "#define UINT16_C(x) x##U";
+};
+
+
+fix = {
+ hackname = newlib_stdint_2;
+ files = stdint-newlib.h, stdint.h;
+ select = "@todo - Add support for wint_t types";
+ c_fix = format;
+ c_fix_arg = "#define INTMAX_MAX __INTMAX_MAX__\n"
+ "#define INTMAX_MIN (-INTMAX_MAX - 1)\n"
+ "#define UINTMAX_MAX __UINTMAX_MAX__\n"
+ "#define WCHAR_MAX __WCHAR_MAX__\n"
+ "#define WCHAR_MIN __WCHAR_MIN__\n"
+ "#define WINT_MAX __WINT_MAX__\n"
+ "#define WINT_MIN __WINT_MIN__\n\n"
+ "%0";
+ c_fix_arg = '/\*\* Macros for minimum-width integer constant expressions \*/';
+ test_text = "/* @todo - Add support for wint_t types. */\n"
+ "/** Macros for minimum-width integer constant expressions */";
+};
+
+
/*
* NeXT 3.2 adds const prefix to some math functions.
* These conflict with the built-in functions.
test_text = "char *na_addr\t";
};
+/*
+ * Fix OpenBSD's NULL definition.
+ */
+fix = {
+ hackname = openbsd_null_definition;
+ mach = "*-*-openbsd*";
+ files = locale.h, stddef.h, stdio.h, string.h,
+ time.h, unistd.h, wchar.h, sys/param.h;
+ select = "__GNUG__";
+ c_fix = format;
+ c_fix_arg = "#ifndef NULL\n"
+ "#ifdef __cplusplus\n"
+ "#ifdef __GNUG__\n"
+ "#define NULL\t__null\n"
+ "#else\t /* ! __GNUG__ */\n"
+ "#define NULL\t0L\n"
+ "#endif\t /* __GNUG__ */\n"
+ "#else\t /* ! __cplusplus */\n"
+ "#define NULL\t((void *)0)\n"
+ "#endif\t /* __cplusplus */\n"
+ "#endif\t /* !NULL */";
+
+ c_fix_arg = "^#ifndef[ \t]*NULL\n"
+ "^#ifdef[ \t]*__GNUG__\n"
+ "^#define[ \t]*NULL[ \t]*__null\n"
+ "^#else\n"
+ "^#define[ \t]*NULL[ \t]*0L\n"
+ "^#endif\n"
+ "^#endif";
+ test_text =
+ "#ifndef NULL\n"
+ "#ifdef __GNUG__\n"
+ "#define NULL __null\n"
+ "#else\n"
+ "#define NULL 0L\n"
+ "#endif\n"
+ "#endif\n";
+};
/*
* obstack.h used casts as lvalues.
test_text = "*((void **) (h)->next_free)++ = (aptr)";
};
+/*
+ * Fix OpenBSD's va_start define.
+ */
+fix = {
+ hackname = openbsd_va_start;
+ mach = "*-*-openbsd*";
+ files = stdarg.h;
+ select = '__builtin_stdarg_start';
+ c_fix = format;
+ c_fix_arg = __builtin_va_start;
+
+ test_text = "#define va_start(v,l) __builtin_stdarg_start((v),l)";
+};
/*
* sys/lc_core.h on some versions of OSF1/4.x pollutes the namespace by
/*
- * Fix __page_size* declarations in pthread.h AIX 4.1.[34].
- * The original ones fail if uninitialized externs are not common.
- * This is the default for all ANSI standard C++ compilers.
+ * On broken glibc-2.3.3 systems an array of incomplete structures is
+ * passed to __sigsetjmp. Fix that to take a pointer instead.
*/
fix = {
- hackname = pthread_page_size;
+ hackname = pthread_incomplete_struct_argument;
files = pthread.h;
- select = "^int __page_size";
+ select = "struct __jmp_buf_tag";
c_fix = format;
- c_fix_arg = "extern %0";
- test_text = "int __page_size;";
-};
-
-
-/*
- * On DYNIX/ptx, sys/mc_param.h has an embedded asm for the cpuid instruction
- * on the P5. This is not used by anything else so we ifdef it out.
- * Current GCC doesn't seem to complain about the asm, though.
- */
-#ifdef PTX
-fix = {
- hackname = ptx_sys_mc_param_h;
- files = sys/mc_param.h;
- sed = "/__asm/,/}/{"
- "/__asm/i\\\n"
- "#if !defined (__GNUC__) && !defined (__GNUG__)\n"
- "/}/a\\\n"
- "#endif\n"
- "}";
- test_text = "__asm\n"
- "int _CPUID()\n"
- "{\n"
- " non-GNU assembly here\n"
- "}";
+ c_fix_arg = "%1 *%2%3";
+ c_fix_arg = "^(extern int __sigsetjmp \\(struct __jmp_buf_tag) (__env)\\[1\\](.*)$";
+ test_text = "extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask);";
};
-#endif
-
/*
* Fix return type of fread and fwrite on sysV68
/*
- * On OpenServer and on UnixWare 7, <math.h> uses the native compiler
- * __builtin_generic. We fix that usage to use the GCC equivalent.
- * It also has a plethora of inline functions that conflict with libstdc++.
+ * Solaris 10+ complex.h defines _Complex_I and _Imaginary_I in terms of
+ * themselves, which are Sun Studio compiler intrinsics. Remove _Imaginary_I
+ * and imaginary definitions which are not supported by GCC.
*/
fix = {
- hackname = sco_math;
- files = math.h;
- files = ansi/math.h;
- files = posix/math.h;
- files = xpg4/math.h;
- files = xpg4v2/math.h;
- files = xpg4plus/math.h;
- files = ods_30_compat/math.h;
- files = oldstyle/math.h;
- select = "inline double abs";
- bypass = "__GNUG__";
- sed = "/#define.*__fp_class(a) \\\\/i\\\n"
- "#ifndef __GNUC__\n";
- sed =
-"/.*__builtin_generic/a\\\n"
-"#else\\\n"
-"#define __fp_class(a) \\\\\\\n"
-" __builtin_choose_expr(__builtin_types_compatible_p(typeof(a),long double),\\\\\\\n"
-" __fpclassifyl(a), \\\\\\\n"
-" __builtin_choose_expr(__builtin_types_compatible_p(typeof(a), float), \\\\\\\n"
-" __fpclassifyf(a),__fpclassify(a)))\\\n"
-"#endif";
-
- sed = "/extern \"C\\+\\+\"/N;"
- "/inline double abs/i\\\n"
- "#ifndef __GNUC__\n";
- sed = "/inline long double trunc/N;"
- "/inline long double trunc.*}.*extern \"C\\+\\+\"/a\\\n"
- "#endif /* ! __GNUC__ */";
-
- test_text =
- "#define __fp_class(a) \\\\\n"
- " __builtin_generic(a,\"ld:__fplcassifyl;f:__fpclassifyf;:__fpclassify\")\n";
-
+ hackname = solaris_complex;
+ mach = "*-*-solaris2.*";
+ files = complex.h;
+ select = "#define[ \t]_Complex_I[ \t]_Complex_I";
+ sed = "s/#define[ \t]_Complex_I[ \t]_Complex_I/"
+ "#define\t_Complex_I\t(__extension__ 1.0iF)/";
+ sed = "/#define[ \t]_Imaginary_I[ \t]_Imaginary_I/d";
+ sed = "/#define[ \t]imaginary[ \t]_Imaginary/d";
+ sed = "s/#define[ \t]I[ \t]\\{1,\\}_Imaginary_I/#define\tI\t\t_Complex_I/";
+ test_text = "#define _Complex_I _Complex_I\n"
+ "#define complex _Complex\n"
+ "#define _Imaginary_I _Imaginary_I\n"
+ "#define imaginary _Imaginary\n"
+ "#undef I\n"
+ "#define I _Imaginary_I";
};
/*
- * On SCO OpenServer prior to 5.0.7UP1, <sys/regset.h> and <ieeefp.h>
- * have a clash on struct _fpstate and struct fpstate.
+ * Sun Solaris 10 defines several C99 math macros in terms of
+ * builtins specific to the Studio compiler, in particular not
+ * compatible with the GNU compiler.
*/
fix = {
- hackname = sco_regset;
- files = sys/regset.h;
- mach = "*-*-sco3.2v5*";
- select = "(struct[ \t]+.*)fpstate";
- c_fix = format;
- c_fix_arg = "%1rsfpstate";
-
+ hackname = solaris_math_1;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
+ c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
test_text =
- "union u_fps {\n"
- " struct\tfpstate\n"
- " {\n"
- " int whatever;\n"
- " }\n"
- "};\n"
- "union _u_fps {\n"
- " struct _fpstate\n"
- " {\n"
- " int whatever;\n"
- " }\n"
- "};\n";
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef HUGE_VAL\n"
+ "#define HUGE_VAL __builtin_huge_val\n"
+ "#undef HUGE_VALF\n"
+ "#define HUGE_VALF __builtin_huge_valf\n"
+ "#undef HUGE_VALL\n"
+ "#define HUGE_VALL __builtin_huge_vall";
};
-
-/*
- * The static functions lstat() and fchmod() in <sys/stat.h>
- * cause G++ grief since they're not wrapped in "if __cplusplus".
- *
- * On SCO OpenServer 5.0.0 through (at least) 5.0.5 <sys/stat.h> contains
- * tiny static wrappers that aren't C++ safe.
- */
fix = {
- hackname = sco_static_func;
- files = sys/stat.h;
- mach = "i?86-*-sco3.2*";
- select = "^static int";
-
- sed = "/^static int/i\\\n"
- "#if __cplusplus\\\n"
- "extern \"C\" {\\\n"
- "#endif /* __cplusplus */";
-
- sed = "/^}$/a\\\n"
- "#if __cplusplus\\\n"
- " }\\\n"
- "#endif /* __cplusplus */";
-
+ hackname = solaris_math_2;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
+ c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
test_text =
- "#ifdef __STDC__\n"
- "static int\tstat(const char *__f, struct stat *__p) {\n"
- "\treturn __stat32(__f, __p);\n"
- "}\n\n# else /* !__STDC__ THIS FAILS ON BSD SYSTEMS */\n"
-
- "static int\tstat(__f, __p)\n"
- "\tchar *__f;\n"
- "\tstruct stat *__p;\n"
- "{\n"
- "\treturn __stat32(__f, __p);\n"
- "}\n"
- "#endif";
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef INFINITY\n"
+ "#define INFINITY __builtin_infinity";
};
-
-/*
- * Fix prototype declaration of utime in sys/times.h.
- * In 3.2v4.0 the const is missing.
- */
fix = {
- hackname = sco_utime;
- files = sys/times.h;
- mach = "i?86-*-sco3.2v4*";
-
- select = '\(const char \*, struct utimbuf \*\);';
- c_fix = format;
- c_fix_arg = '(const char *, const struct utimbuf *);';
+ hackname = solaris_math_3;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))";
+ c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
+ test_text =
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef NAN\n"
+ "#define NAN __builtin_nan";
+};
- test_text = "extern int utime(const char *, struct utimbuf *);";
+fix = {
+ hackname = solaris_math_4;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tfpclassify(x) \\\n"
+ " __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, (x))";
+ c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
+ test_text =
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef fpclassify\n"
+ "#define fpclassify(x) __builtin_fpclassify(x)";
};
+fix = {
+ hackname = solaris_math_8;
+ select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
+ "\t\t\t ? __builtin_signbitf(x) \\\n"
+ "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
+ "\t\t\t ? __builtin_signbitl(x) \\\n"
+ "\t\t\t : __builtin_signbit(x))";
+ c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
+ test_text = <<- _EOText_
+ #ident "@(#)math_c99.h 1.9 04/11/01 SMI"
+ #undef signbit
+ #define signbit(x) __builtin_signbit(x)
+ _EOText_;
+};
+
+fix = {
+ hackname = solaris_math_9;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
+ c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)";
+ test_text =
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef isgreater\n"
+ "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
+ "#undef isgreaterequal\n"
+ "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
+ "#undef isless\n"
+ "#define isless(x, y) ((x) __builtin_isless(y))\n"
+ "#undef islessequal\n"
+ "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
+ "#undef islessgreater\n"
+ "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
+ "#undef isunordered\n"
+ "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
+};
/*
- * Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER
- * incorrectly, so we replace them with versions that correspond to
- * the definition. We also explicitly name this fix "1" and the next
- * fix "2" because this one does not deal with the last field. This
- * fix needs to run before the next.
+ * 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_mutex_init_1;
- select = '@\(#\)pthread.h' "[ \t]+1.1[0-9][ \t]+9[567]/[0-9/]+ SMI";
- files = pthread.h;
- sed = "/define[ \t]*PTHREAD_MUTEX_INI/s/{0, 0,/{{{0}, 0}, {{{0}}},/\n"
- "/define[ \t]*PTHREAD_COND_INI/s/{0,/{{{0},0},/";
+ 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 =
- '#ident "@(#)pthread.h 1.16 97/05/05 SMI"'"\n"
- "#define PTHREAD_MUTEX_INITIALIZER\t{0, 0, 0}\n"
- "#define PTHREAD_COND_INITIALIZER\t{0, 0} /* */\n";
+ '#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); })";
};
-
/*
* Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
* "0" for the last field of the pthread_mutex_t structure, which is
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]*';
c_fix = format;
c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
"%0\n"
"#else\n"
- "%1, {0}}%3\n"
+ "%1, {0}}%4\n"
"#endif";
- c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+\\{.*)"
+ 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_RWLOCK_INITIALIZER\t"
- "{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
+ "#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}";
};
/*
- * Solaris 2.5.1 and 2.6 use an outdated prototype for send & recv
- * in sys/socket.h. This is corrected in Solaris 7 and up.
+ * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a "0" for some
+ * fields of the pthread_rwlock_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.
*/
fix = {
- hackname = solaris_socket;
- files = sys/socket.h;
- select = '@\(#\)socket.h' "[ \t]+1.[123][0-9][ \t]+9[567]/[0-9/]+ SMI";
+ hackname = solaris_rwlock_init_1;
+ select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = pthread.h;
+ mach = '*-*-solaris*';
c_fix = format;
- c_fix_arg = "extern int %1(int, %2void *, int, int);";
- c_fix_arg = '^extern int (recv|send)\(int,'
- ' (const )*char '
- '\*, int, int\);';
+ c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
+ "%0\n"
+ "#else\n"
+ "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
+ "#endif";
+ c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
+ "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \t]*$";
- test_text = '#ident "@(#)socket.h 1.30 97/01/20 SMI"'"\n"
- "extern int recv(int, char *, int, int);\n"
- "extern int send(int, const char *, int, int);";
+ test_text =
+ '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
+ "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
};
/*
- * Solaris 2.8 has what appears to be some gross workaround for
- * some old version of their c++ compiler. G++ doesn't want it
- * either, but doesn't want to be tied to SunPRO version numbers.
+ * 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_stdio_tag;
- files = stdio_tag.h;
+ 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}";
+};
- select = '__cplusplus < 54321L';
- /* In Solaris 10, the code in stdio_tag.h is conditionalized on
- "!defined(__GNUC__)" so we no longer need to fix it. */
- bypass = '__GNUC__';
- sed = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
- test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
+/*
+ * 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.5.1 doesn't define 'getpagesize' in <unistd.h>, as is done
- * on Solaris 2.6 and up.
+ * Sun Solaris 2 has a version of sys/int_const.h that defines
+ * UINT8_C and UINT16_C to unsigned constants.
*/
fix = {
- hackname = solaris_unistd;
- files = unistd.h;
- select = '@\(#\)unistd.h' "[ \t]+1.3[0-9][ \t]+9[567]/[0-9/]+ SMI";
- bypass = "getpagesize";
- c_fix = format;
- c_fix_arg = "extern int getpagesize();\n%0";
- c_fix_arg = '^extern (pid_t|int) getpgid\(.*\);';
- test_text = '#ident "@(#)unistd.h 1.33 95/08/28 SMI"'"\n"
- "extern pid_t getpgid(pid_t);\n"
- "extern int getpgid();";
+ 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";
};
/*
- * <widec.h> until Solaris 2.5.1 defines macros for a couple of <wchar.h>
- * functions, breaking their prototypes if that file is included afterwards.
- * Include <wchar.h> early to avoid this issue, as is done on Solaris 2.6
- * and up.
+ * Sun Solaris 2 has a version of sys/int_limits.h that defines
+ * SIZE_MAX as unsigned long.
*/
fix = {
- hackname = solaris_widec;
- files = widec.h;
- mach = '*-*-solaris2.[0-5]';
- mach = '*-*-solaris2.[0-5].*';
- bypass = "include.*wchar\\.h";
- select = "#include <euc.h>";
+ hackname = solaris_int_limits_3;
+ files = sys/int_limits.h;
+ mach = '*-*-solaris2*';
c_fix = format;
- c_fix_arg = "%0\n#include <wchar.h>";
- test_text = "#include <euc.h>";
+ c_fix_arg = "#define\tSIZE_MAX\t4294967295U";
+ select = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
+ test_text =
+ "#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";
+};
+
+
+/*
+ * Sun Solaris 8 has what appears to be some gross workaround for
+ * some old version of their c++ compiler. G++ doesn't want it
+ * either, but doesn't want to be tied to SunPRO version numbers.
+ */
+fix = {
+ hackname = solaris_stdio_tag;
+ files = stdio_tag.h;
+
+ select = '__cplusplus < 54321L';
+ /* In Solaris 10, the code in stdio_tag.h is conditionalized on
+ "!defined(__GNUC__)" so we no longer need to fix it. */
+ bypass = '__GNUC__';
+ sed = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
+
+ test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
};
* On Solaris 10, this fix is unncessary; <stdio.h> includes
* <iso/stdio_iso.h>, which includes <sys/va_list.h>.
*/
- mach = '*-*-solaris2.1[0-9]';
+ mach = '*-*-solaris2.1[0-9]*';
not_machine = true;
c_fix = wrap;
* <stdio.h> is guarded appropriately by the _XPG4 feature macro;
* there is therefore no need for this fix there.
*/
- mach = '*-*-solaris2.1[0-9]';
+ mach = '*-*-solaris2.1[0-9]*';
not_machine = true;
/*
/*
- * Conditionalize some of <sys/endian.h> on __GNUC__ and __GNUG__.
- * On some systems (UnixWare 2, UnixWare 7), the file is byteorder.h
- * but we still "hijack" it and redirect it to the GNU byteorder.h..
- */
-#ifdef SVR5
-fix = {
- hackname = svr4_endian;
- files = sys/endian.h;
-#ifdef LATER
- /*
- * since we emit our own sys/byteorder.h,
- * this fix can never be applied to that file.
- */
- files = sys/byteorder.h;
-#endif
- bypass = '__GNUC__';
-
- sed = "/#\tifdef\t__STDC__/i\\\n"
- "# if !defined (__GNUC__) && !defined (__GNUG__)\n";
-
- sed = "/#\t\tinclude\t<sys\\/byteorder.h>/s/\t\t/ /";
-
- sed = "/# include\t<sys\\/byteorder.h>/i\\\n"
- "# endif /* !defined (__GNUC__) && !defined (__GNUG__) */\n";
-};
-#endif /* SVR5 */
-
-
-/*
- * Remove useless extern keyword from struct forward declarations
- * in <sys/stream.h> and <sys/strsubr.h>
- */
-#ifdef SVR4
-fix = {
- hackname = svr4_extern_struct;
- files = sys/stream.h;
- files = sys/strsubr.h;
- select = 'extern struct [a-z_]*;';
- sed = 's/extern struct \([a-z][a-z_]*\)/struct \1/';
-};
-#endif
-
-/*
- * Fix declarations of `ftw' and `nftw' in <ftw.h>. On some/most SVR4
- * systems the file <ftw.h> contains extern declarations of these
- * functions followed by explicitly `static' definitions of these
- * functions... and that's not allowed according to ANSI C. (Note
- * however that on Solaris, this header file glitch has been pre-fixed by
- * Sun. In the Solaris version of <ftw.h> there are no static
- * definitions of any function so we don't need to do any of this stuff
- * when on Solaris.
- */
-#ifdef SVR4
-#ifndef SOLARIS
-fix = {
- hackname = svr4_ftw;
- files = ftw.h;
- select = '^extern int ftw\(const';
-
- sed = '/^extern int ftw(const/i' "\\\n"
- "#if !defined(_STYPES)\\\n"
- "static\\\n"
- "#else\\\n"
- "extern\\\n"
- "#endif";
- sed = 's/extern \(int ftw(const.*\)$/\1/';
- sed = "/^extern int nftw/i\\\n"
- "#if defined(_STYPES)\\\n"
- "static\\\n"
- "#else\\\n"
- "extern\\\n"
- "#endif";
- sed = 's/extern \(int nftw.*\)$/\1/';
- sed = "/^extern int ftw(),/c\\\n"
- "#if !defined(_STYPES)\\\n"
- "static\\\n"
- "#else\\\n"
- "extern\\\n"
- "#endif\\\n"
- " int ftw();\\\n"
- "#if defined(_STYPES)\\\n"
- "static\\\n"
- "#else\\\n"
- "extern\\\n"
- "#endif\\\n"
- " int nftw();";
-};
-#endif
-#endif
-
-
-/*
* Fix broken decl of getcwd present on some svr4 systems.
*/
fix = {
/*
- * Wrap some files on System V r4 and DYNIX/ptx systems with
- * #ifdef _KERNEL, presumably to prevent kernel headers from
- * leaking into userspace. This may not be necessary at all,
- * but it was in the old scripts, so it seems safest to keep it for now.
- */
-fix = {
- /* Can't name this with _kernel, or the test case will hit the bypass! */
- hackname = svr4_krnl;
- /* Since I'm rather unsure about the validity of this, limit it
- * to the specific systems it was operating on before. It should
- * also be bypassed for i?86-*-sysv4.3uw2, by that rule, but I didn't
- * see an easy way to do that. Hopefully it will be harmless
- * in any case. -- Nathanael */
- mach = '*-*-sysv4*';
- mach = 'i?86-sequent-ptx*';
- files = fs/rfs/rf_cache.h;
- files = sys/erec.h;
- files = sys/err.h;
- files = sys/char.h;
- files = sys/getpages.h;
- files = sys/map.h;
- files = sys/cmn_err.h;
- files = sys/kdebugger.h;
-
- /* This bypass will match _KERNEL, __KERNEL, __KERNEL__, etc.
- * It will also match SVR4_KERNEL_CHECK, which means that the
- * testsuite case will always be bypassed. Which is fine with me. */
- bypass = '_KERNEL';
-
- c_fix = wrap;
- c_fix_arg = "#ifdef _KERNEL\n";
- c_fix_arg = "#endif /* _KERNEL */\n";
-
- /* There's no reasonable test for this given that we don't know exactly
- * what problem inspired it in the first place. */
- test_text = "";
-};
-
-
-/*
- * Delete any #defines of `__i386' which may be present in <ieeefp.h>. They
- * tend to conflict with the compiler's own definition of this symbol. (We
- * will use the compiler's definition.)
- * Likewise __sparc, for Solaris, and __i860, and a few others
- * (guessing it is necessary for all of them).
- */
-#ifdef SVR4
-fix = {
- hackname = svr4_mach_defines;
- files = ieeefp.h;
- select = "#define[ \t]*__(i386|mips|sparc|m88k|m68k)[ \t]";
- sed = "/#define[ \t]*__\\(i386|mips|sparc|m88k|m68k\\)[ \t]/d";
-};
-#endif
-
-
-/*
- * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
- * They are declared as non-static then immediately redeclared as static.
- */
-#ifdef SVR5
-fix = {
- hackname = svr4_mkdev;
- files = sys/mkdev.h;
- select = '^static';
-
- sed = "/^dev_t makedev(/s/^/static /";
- sed = "/^major_t major(/s/^/static /";
- sed = "/^minor_t minor(/s/^/static /";
-};
-#endif /* SVR5 */
-
-
-/*
- * Fix reference to NC_NPI_RAW in <sys/netcspace.h>.
- * Also fix types of array initializers.
- */
-#ifdef SVR4
-fix = {
- hackname = svr4_netcspace;
- files = sys/netcspace.h;
- select = 'NC_NPI_RAW';
- sed = 's/NC_NPI_RAW/NC_TPI_RAW/g';
- sed = 's/NC_/(unsigned long) NC_/';
-};
-#endif
-
-/*
- * Fix reference to NMSZ in <sys/adv.h>.
- */
-#ifdef SVR4
-fix = {
- hackname = svr4_nmsz;
- files = sys/adv.h;
- select = '\[NMSZ\]';
- sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
-};
-#endif
-
-
-/*
- * Some SVR4 systems supposedly use these non-ANSI preprocessor directives.
- */
-#ifdef SVR4
-fix = {
- hackname = svr4_preproc_lint_on;
- select = '#lint\(on\)';
- c_fix = format;
- c_fix_arg = 'defined(lint)';
- test_text = "#if #lint(on)";
-};
-fix = {
- hackname = svr4_preproc_lint_off;
- select = '#lint\(off\)';
- c_fix = format;
- c_fix_arg = '!defined(lint)';
- test_text = "#if #lint(off)";
-};
-fix = {
- hackname = svr4_preproc_machine;
- select = '#(machine|system|cpu)\(([^)]*)\)';
- c_fix = format;
- c_fix_arg = 'defined(__%1__)';
- test_text = "#if #machine(i386) || #system(vax) || #cpu(sparc)";
-};
-#endif
-
-
-/*
* Fix broken decl of profil present on some svr4 systems.
*/
fix = {
/*
- * Convert functions to prototype form, and fix arg names in <sys/stat.h>.
- */
-#ifdef SVR4
-fix = {
- hackname = svr4_proto_form;
- files = sys/stat.h;
- select = 'const extern';
-
- sed = "/^stat([ \t]*[^c]/ {\nN\nN\n"
- "s/(.*)\\n/( /\n"
- "s/;\\n/, /\n"
- "s/;$/)/\n" "}";
-
- sed = "/^lstat([ \t]*[^c]/ {\nN\nN\n"
- "s/(.*)\\n/( /\n"
- "s/;\\n/, /\n"
- "s/;$/)/\n" "}";
-
- sed = "/^fstat([ \t]*[^i]/ {\nN\nN\n"
- "s/(.*)\\n/( /\n"
- "s/;\\n/, /\n"
- "s/;$/)/\n" "}";
-
- sed = "/^mknod([ \t]*[^c]/{\nN\nN\nN\n"
- "s/(.*)\\n/( /\n"
- "s/;\\n/, /g\n"
- "s/;$/)/\n" "}";
-
- sed = "1,$s/\\([^A-Za-z]\\)path\\([^A-Za-z]\\)/\\1__path\\2/g";
- sed = "1,$s/\\([^A-Za-z]\\)buf\\([^A-Za-z]\\)/\\1__buf\\2/g";
- sed = "1,$s/\\([^A-Za-z]\\)fd\\([^A-Za-z]\\)/\\1__fd\\2/g";
- sed = "1,$s/ret\\([^u]\\)/__ret\\1/g";
- sed = "1,$s/\\([^_]\\)mode\\([^_]\\)/\\1__mode\\2/g";
- sed = "1,$s/\\([^_r]\\)dev\\([^_]\\)/\\1__dev\\2/g";
-};
-#endif
-
-/*
- * Add a prototyped declaration of mmap to <sys/mman.h>.
- */
-#ifdef SVR4
-fix = {
- hackname = svr4_proto_mmap;
- files = sys/mman.h;
- select = '^extern caddr_t mmap();$';
- sed = '/^extern caddr_t mmap();$/c' "\\\n"
- "#ifdef __STDC__\\\n"
- "extern caddr_t mmap (caddr_t, size_t, int, int, int, off_t);\\\n"
- "#else /* !defined(__STDC__) */\\\n"
- "extern caddr_t mmap ();\\\n"
- "#endif /* !defined(__STDC__) */\\\n";
-};
-#endif
-
-/*
- * Add a #define of _SIGACTION_ into <sys/signal.h>.
- */
-#ifdef SVR4
-fix = {
- hackname = svr4_sigaction;
- files = sys/signal.h;
- sed = "/^struct sigaction {/i\\\n"
- "#define _SIGACTION_";
- sed = 's/(void *(\*)())/(void (*)(int))/';
-};
-#endif
-
-
-/*
* Correct types for signal handler constants like SIG_DFL; they might be
* void (*) (), and should be void (*) (int). C++ doesn't like the
* old style.
"#define SIG_IGN (void (*)())0\n";
};
-/*
- * Put storage class at start of decl, to avoid warning.
- */
-#ifdef SVR4
-fix = {
- hackname = svr4_storage_class;
- files = rpc/types.h;
- select = 'const extern';
- sed = 's/const extern/extern const/g';
-};
-#endif
-
/*
* Some SysV r4 systems, including Sequent's DYNIX/ptx, use the local
/*
- * Like svr4_mach_defines, but with newfangled syntax.
- * Source lines are of #define __i386 #machine(i386). Delete them.
- */
-#ifdef SVR5
-fix = {
- hackname = svr5_mach_defines;
- files = ieeefp.h;
- select = "#define[ \t]*__i386.*\(i386\)";
- sed = "/#define[ \t]*__i386.*/d";
-};
-#endif /* SVR5 */
-
-
-/*
* Fix return value of mem{ccpy,chr,cpy,set} and str{len,spn,cspn}
* in string.h on sysV68
* Correct the return type for strlen in string.h on Lynx.
/*
- * function parameter to atexit is missing "void" on VAX Ultrix 4.3.
- */
-fix = {
- hackname = ultrix_atexit_param;
- files = stdlib.h;
- select = 'atexit\(.*\(\)';
-
- c_fix = format;
- c_fix_arg = "atexit( void (*__func)( void )";
-
- test_text = "int atexit( void (*__func)() );\n";
-};
-
-
-/*
- * parameter to atof not const on DECstation Ultrix V4.0 and NEWS-OS 4.2R.
- */
-fix = {
- hackname = ultrix_atof_param;
- files = math.h;
- select = "atof\\([ \t]*char";
-
- c_fix = format;
- c_fix_arg = "atof(const char";
-
- test_text = "extern double atof( char *__nptr);\n";
-};
-
-
-/*
* parameters not const on DECstation Ultrix V4.0 and OSF/1.
*/
fix = {
/*
- * parameters not const on Ultrix V4.3.
- */
-fix = {
- hackname = ultrix_const3;
- files = stdio.h;
- select = 'fdopen\( .*, char \*';
-
- c_fix = format;
- c_fix_arg = "%1 const %3 *__";
- c_fix_arg = "([ \t*](fdopen)\\(.*)"
- "[ \t]+(char|void) \\*__";
-
- test_text =
- "extern FILE * fdopen( int __filedes, char *__type );\n";
-};
-
-
-/*
- * Ultrix V4.[35] puts the declaration of uname before the definition
- * of struct utsname, so the prototype (added by fixproto) causes havoc.
- */
-fix = {
- hackname = ultrix_fix_fixproto;
- files = sys/utsname.h;
- select = ULTRIX;
-
- c_fix = format;
- c_fix_arg = "struct utsname;\n%0";
- c_fix_arg = "^[ \t]*extern[ \t]*int[ \t]*uname\\(\\);";
-
- test_text =
- "/* ULTRIX's uname */\nextern\tint\tuname();";
-};
-
-
-/*
- * Check for bad #ifdef line (in Ultrix 4.1)
- */
-fix = {
- hackname = ultrix_ifdef;
- select = "^#ifdef KERNEL[ \t]+&&";
- files = sys/file.h;
-
- c_fix = format;
- c_fix_arg = "#if defined(KERNEL) &&";
-
- test_text =
- "#ifdef KERNEL\t&& defined( mumbojumbo )\nint oops;\n#endif";
-};
-
-
-/*
- * Add once-only latch to Ultrix V4.3 locale.h.
- */
-fix = {
- hackname = ultrix_locale;
- files = locale.h;
- select = "@\\(#\\)locale\\.h.*6\\.1.*\\(ULTRIX\\)";
- c_fix = wrap;
- test_text =
- "@(#)locale.h 6.1 (ULTRIX)\n";
-};
-
-
-/*
- * Strip "|| CC$gfloat" from Ultrix math headers.
- */
-fix = {
- hackname = ultrix_math_ifdef;
- files = sys/limits.h;
- files = float.h;
- files = math.h;
- select = "^(#if.*)\\|\\|[ \t]+CC\\$[a-z]+";
- c_fix = format;
- c_fix_arg = "%1";
-
- test_text = '#if defined(__GFLOAT) || CC\$gfloat';
-};
-
-
-/*
- * Avoid nested comments on Ultrix 4.3.
- */
-fix = {
- hackname = ultrix_nested_ioctl;
- files = sys/ioctl.h;
- select = "^/\\* #define SIOCSCREEN";
- sed = "/^\\/\\* #define SIOCSCREEN/s@/\\* screend@*//* screend@";
- test_text =
- "/* #define SIOCSCREENON _IOWR('i', 49, int)"
- "/* screend, net/gw_screen.h */\n";
-};
-
-
-fix = {
- hackname = ultrix_nested_svc;
- files = rpc/svc.h;
- select = "^ \\*[ \t]*int protocol; */\\*";
- sed = "s@^\\( \\*\tint protocol; \\)/\\*@\\1*/ /*@";
- test_text =
- " *\tint protocol; /* like TCP or UDP\n";
-};
-
-
-/*
- * Add missing prototype for lstat and define for S_ISLNK
- * in Ultrix V4.3 sys/stat.h.
- */
-fix = {
- hackname = ultrix_stat;
- files = sys/stat.h;
- select = "@\\(#\\)stat\\.h.*6\\.1.*\\(ULTRIX\\)";
- sed = "/^#define[ \t]S_IFPORT[ \t]*S_IFIFO$/a\\\n"
- "\\\n"
- "/* macro to test for symbolic link */\\\n"
- "#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)\\\n"
- "\n";
- sed = "/^[ \t]*fstat(),$/a\\\n"
- "\tlstat(),\n";
- test_text =
- "@(#)stat.h 6.1 (ULTRIX)\n"
- "#define S_IFPORT S_IFIFO\n"
- "\tfstat(),\n/* THE INSERTION LINE FAILS ON BSD SYSTEMS */";
-};
-
-
-/*
- * Check for superfluous `static' (in Ultrix 4.2)
- * On Ultrix 4.3, includes of other files (r3_cpu.h,r4_cpu.h) is broken.
- */
-fix = {
- hackname = ultrix_static;
- files = machine/cpu.h;
- select = '#include "r[34]_cpu';
- sed = "s/^static struct tlb_pid_state/struct tlb_pid_state/";
- sed = 's/^#include "r3_cpu\.h"$/#include <machine\/r3_cpu\.h>/';
- sed = 's/^#include "r4_cpu\.h"$/#include <machine\/r4_cpu\.h>/';
- test_text =
- "static struct tlb_pid_state {\n"
- "#include \"r3_cpu.h\"\n";
-};
-
-
-/*
- * Add missing declarations to Ultrix V4.3 stdlib.h.
- */
-fix = {
- hackname = ultrix_stdlib;
- files = stdlib.h;
- select = "@\\(#\\)stdlib\\.h.*6\\.1.*\\(ULTRIX\\)";
-
- sed = "/^char.*getenv( const char .* );.*$/a\\\n"
- "int\t\tsetenv( const char *__name, const char *__val, int __ovrwrt );\\\n"
- "void\t\tunsetenv( const char *__name );\\\n"
- "int\t\tputenv( char *__s );\n";
-
- sed = "/^char.*getenv();.*$/a\\\n"
- "int\tsetenv();\\\n"
- "void\tunsetenv();\\\n"
- "int\tputenv();\n";
-
- test_text =
- "@(#)stdlib.h 6.1 (ULTRIX)\n"
- "char * getenv( const char *__name );\n"
- "char *getenv();\n";
-};
-
-
-/*
- * Add once-only latch to Ultrix V4.3 strings.h.
- */
-fix = {
- hackname = ultrix_strings;
- files = strings.h;
- select = "@\\(#\\)strings\\.h.*6\\.1.*\\(ULTRIX\\)";
- c_fix = wrap;
- test_text =
- "@(#)strings.h 6.1 (ULTRIX)\n";
-};
-
-
-/*
- * Add missing declarations to Ultrix V4.3 strings.h.
- */
-fix = {
- hackname = ultrix_strings2;
- files = strings.h;
- select = "@\\(#\\)strings\\.h.*6\\.1.*\\(ULTRIX\\)";
-
- sed = "/^.*strncmp( const .* );.*/a\\\n"
- "\\\n"
- "extern int\\\n"
- "\tstrcasecmp( const char *__s1, const char *__s2),\\\n"
- "\tstrncasecmp( const char *__s1, const char *__s2, size_t __n );\n";
-
- sed = "/^.*strncmp();.*/a\\\n"
- "extern int\\\n"
- "\tstrcasecmp(),\\\n"
- "\tstrncasecmp();\n";
-
- test_text =
- "@(#)strings.h 6.1 (ULTRIX)\n"
- "\tstrncmp( const char *__s1, const char *__s2, size_t __n );\n"
- "\tstrncmp();\n";
-};
-
-
-/*
- * Add missing declarations to Ultrix V4.3 sys/time.h.
- */
-fix = {
- hackname = ultrix_sys_time;
- files = sys/time.h;
- select = "@\\(#\\)time\\.h.*6\\.1.*\\(ULTRIX\\)";
-
- sed = "/^extern.*time_t.*time( time_t .* );.*$/a\\\n"
- "\\\n"
- "extern int adjtime(struct timeval *, struct timeval *);\\\n"
- "extern int getitimer(int, struct itimerval *);\\\n"
- "extern int setitimer(int, struct itimerval *, struct itimerval *);\\\n"
- "extern int gettimeofday(struct timeval *, struct timezone *);\\\n"
- "extern int settimeofday(struct timeval *, struct timezone *);\\\n"
- "extern void profil(const void *, size_t, size_t, unsigned int);\\\n"
- "extern int stime(const time_t *);\\\n"
- "extern int utimes(const char *, const struct timeval[2]);\\\n"
- "extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);\n";
-
- sed = "/^extern.*double.*difftime();.*$/a\\\n"
- "extern\tint adjtime();\\\n"
- "extern\tint getitimer();\\\n"
- "extern\tint setitimer();\\\n"
- "extern\tint gettimeofday();\\\n"
- "extern\tint settimeofday();\\\n"
- "extern\tvoid profil();\\\n"
- "extern\tint stime();\\\n"
- "extern\tint utimes();\\\n"
- "extern\tint select();\n";
-
- test_text =
- "@(#)time.h 6.1 (ULTRIX)\n"
- "extern time_t time( time_t *__tloc );\n"
- "extern double difftime();\n";
-};
-
-
-/*
- * Add missing declarations to Ultrix V4.3 unistd.h.
- */
-fix = {
- hackname = ultrix_unistd;
- files = unistd.h;
- select = "@\\(#\\)unistd\\.h.*6\\.1.*\\(ULTRIX\\)";
-
- sed = "/^[ \t]*getgroups(),.*$/a\\\n"
- "\tgetpagesize(),\n";
-
- sed = "/^[ \t]*fork(),.*$/a\\\n"
- "\tvfork(),\n";
-
- test_text =
- "@(#)unistd.h 6.1 (ULTRIX)\n"
- "\tgetgroups(),\n"
- "\tfork(),\n";
-};
-
-
-/*
- * On Cray Unicos/Mk some standard headers use the C99 keyword "restrict"
- * which must be replaced by __restrict__ for GCC.
- */
-fix = {
- hackname = unicosmk_restrict;
- files = stdio.h;
- files = stdlib.h;
- files = wchar.h;
- mach = "*-*-unicosmk*";
- select = "(\\*[ \t]*)restrict([ \t]+)";
-
- c_fix = format;
- c_fix_arg = "%1__restrict__%2";
-
- test_text = "void f (char * restrict x);";
-};
-
-/*
- * If arpa/inet.h prototypes are incompatible with the ones we just
- * installed in <sys/byteorder.h>, just remove the protos.
- * Because of this close association, this patch must be applied only
- * on those systems where the replacement byteorder header is installed.
- */
-fix = {
- hackname = uw7_byteorder_fix;
- files = arpa/inet.h;
- select = "in_port_t";
- test = "-f sys/byteorder.h";
-#ifndef SVR5
- mach = "*-*-sysv4*";
- mach = "i?86-*-sysv5*";
- mach = "i?86-*-udk*";
- mach = "i?86-*-solaris2.[0-4]";
- mach = "powerpcle-*-solaris2.[0-4]";
- mach = "sparc-*-solaris2.[0-4]";
-#endif /* SVR5 */
-
- c_fix = format;
- c_fix_arg = "";
- c_fix_arg = "^extern.*[ \t](htons|ntohs).*\\(in_port_t\\).*;";
-
- test_text = "extern in_port_t\thtons __P((in_port_t));\n"
- "extern in_port_t\tntohs __P((in_port_t));"
- "`[ ! -d $DESTDIR/sys ] && mkdir $DESTDIR/sys\n"
- "echo '/* DUMMY */' >> sys/byteorder.h`";
-};
-
-
-/*
* Fix definitions of macros used by va-i960.h in VxWorks header file.
*/
fix = {
};
-/*
- * WindISS math.h headers include bogus extern declarations of
- * numerous math functions that conflict with libstdc++-v3.
- */
-fix = {
- hackname = windiss_math1;
- files = math.h;
- mach = "*-*-windiss";
- sed = "s|inline long double cosl.*|#ifndef __GNUC__|";
-
- test_text = "inline long double cosl(long double);";
-};
-
-fix = {
- hackname = windiss_math2;
- files = math.h;
- mach = "*-*-windiss";
- sed = "s|/\\* long double declarations \\*/|"
- "#endif /* __GNUC__ */|";
-
- test_text = "/* long double declarations */";
-};
-
-/*
- * WindISS headers include "diab/va_list.h" instead of "stdarg.h"
- */
-fix = {
- select = '(#include.*)diab/va_list.h';
- hackname = windiss_valist;
- sed = "s|diab/va_list.h|stdarg.h|";
- mach = "*-*-windiss";
-
- test_text = "#include <diab/va_list.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
sed = "/Widget\told, new;/i\\\n"
"#ifdef __cplusplus\\\n"
- "\tWidget\told, c_new;\\\n"
+ "\\\tWidget\told, c_new;\\\n"
"#else\n";
sed = "/Widget\told, new;/a\\\n"
sed = "s/Widget new,/Widget c_new,/g";
test_text =
"struct wedge {\n"
- " Widget\told, new; /* fixinc check FAILS ON BSD */\n"
+ " Widget\told, new;\n"
"};\nextern Wedged( Widget new, Widget old );";
};