pattern='^/\*$' \
trailer='^/\*EOF\*[/]' \
input=inclhack.def \
- key='hackname[ ]*=[ ]*(.*);'
+ key=$'hackname[ \t]*=[ \t]*(.*);'
Set up a debug test so we can make the templates emit special
code while debugging these fixes: */
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 AIX when _LARGE_FILES is defined fcntl.h defines open to
+ * open64 and creat to creat64. This fixes fcntl.h to
+ * undef those defines and use __asm__ to alias the symbols if
+ * building with g++ and -D_LARGE_FILES
+ */
+fix = {
+ hackname = AAB_aix_fcntl;
+ files = fcntl.h;
+ select = "define open[ \t]open64";
+ 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_fcntl_h_fix
+ #ifdef __need__aix_fcntl_h_fix
+ #undef open
+ #undef creat
+ #undef openat
+ /* Alias the symbols using asm */
+ extern "C" {
+ extern int open(const char *, int, ...) __asm__("open64");
+ extern int creat(const char *, mode_t) __asm__("creat64");
+ #if (_XOPEN_SOURCE >= 700)
+ extern int openat(int, const char *, int, ...) __asm__("open64at");
+ #endif
+ }
+ #endif
+ #endif
+
+ _EOArg_;
+};
/*
* On Mac OS 10.3.9, the 'long double' functions are available in
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 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_;
};
-
/*
* This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
*/
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
_EndOfHeader_;
};
-
/*
* This fixes __FD_ZERO bug for glibc-1.x
*/
_EndOfHeader_;
};
-
/*
* This fixes __FD_ZERO bug for glibc-2.0.x
*/
_EndOfHeader_;
};
-
/*
* Solaris <sys/varargs.h> is a DDK (aka kernel-land) header providing
* the same interface as <stdarg.h>. No idea why they couldn't have just
_EndOfHeader_;
};
-
/*
* Fix non-ANSI memcpy declaration that conflicts with gcc's builtin
* declaration on Sun OS 4.x. We must only fix this on Sun OS 4.x, because
extern int memcmp();
#endif /* __memory_h__ */
- _EndOfHeader;
-};
-
-
-/*
- * Completely replace <sys/varargs.h> with a file that includes gcc's
- * stdarg.h or varargs.h files as appropriate.
- */
-#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";
+ _EndOfHeader_;
};
-#endif
-
/*
- * Completely replace <sys/byteorder.h> with a file that implements gcc's
- * optimized byteswapping. (The original probably implemented some
- * incompatible optimized byteswapping.)
+ * Fix assert.h on VxWorks:
*/
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).
+ hackname = AAB_vxworks_assert;
+ files = assert.h;
+ mach = "*-*-vxworks*";
+
+ replace = <<- _EndOfHeader_
+ #ifndef _ASSERT_H
+ #define _ASSERT_H
- 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.
+ #ifdef assert
+ #undef assert
#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
+ #if defined(__STDC__) || defined(__cplusplus)
+ extern void __assert (const char*);
+ #else
+ extern void __assert ();
#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;
- }
+ #ifdef NDEBUG
+ #define assert(ign) ((void)0)
+ #else
- /* Convert a host short to a network short. */
+ #define ASSERT_STRINGIFY(str) ASSERT_STRINGIFY_HELPER(str)
+ #define ASSERT_STRINGIFY_HELPER(str) #str
- static __inline__ unsigned short
- htons (unsigned int __arg)
- {
- return __arg;
- }
+ #define assert(test) ((void) \
+ ((test) ? ((void)0) : \
+ __assert("Assertion failed: " ASSERT_STRINGIFY(test) ", file " \
+ __FILE__ ", line " ASSERT_STRINGIFY(__LINE__) "\n")))
- #endif /* big-endian */
+ #endif
- /* Convert a network long to a host long. */
+ #endif
+ _EndOfHeader_;
+};
- static __inline__ unsigned long
- ntohl (unsigned long __arg)
- {
- return htonl (__arg);
- }
+/*
+ * Add needed include to regs.h (NOT the gcc header) on VxWorks
+ */
- /* Convert a network short to a host short. */
+fix = {
+ hackname = AAB_vxworks_regs_vxtypes;
+ files = regs.h;
+ mach = "*-*-vxworks*";
- static __inline__ unsigned short
- ntohs (unsigned int __arg)
- {
- return htons (__arg);
- }
+ replace = <<- _EndOfHeader_
+ #ifndef _REGS_H
+ #define _REGS_H
+ #include <types/vxTypesOld.h>
+ #include_next <arch/../regs.h>
#endif
_EndOfHeader_;
};
-
/*
- * Cancel out ansi_compat.h on Ultrix. Replace it with an empty file.
+ * Make VxWorks stdint.h a bit more compliant - add typedefs
*/
fix = {
- hackname = AAB_ultrix_ansi_compat;
- files = ansi_compat.h;
- select = ULTRIX;
- replace = "/* This file intentionally left blank. */\n";
+ hackname = AAB_vxworks_stdint;
+ files = stdint.h;
+ mach = "*-*-vxworks*";
+
+ replace = <<- _EndOfHeader_
+ #ifndef _STDINT_H
+ #define _STDINT_H
+ /* get int*_t, uint*_t */
+ #include <types/vxTypes.h>
+
+ /* get legacy vxworks types for compatibility */
+ #include <types/vxTypesOld.h>
+
+ typedef long intptr_t;
+ typedef unsigned long uintptr_t;
+
+ typedef int64_t intmax_t;
+ typedef uint64_t uintmax_t;
+
+ typedef int8_t int_least8_t;
+ typedef int16_t int_least16_t;
+ typedef int32_t int_least32_t;
+ typedef int64_t int_least64_t;
+
+ typedef uint8_t uint_least8_t;
+ typedef uint16_t uint_least16_t;
+ typedef uint32_t uint_least32_t;
+ typedef uint64_t uint_least64_t;
+
+ typedef int8_t int_fast8_t;
+ typedef int int_fast16_t;
+ typedef int32_t int_fast32_t;
+ typedef int64_t int_fast64_t;
+
+ typedef uint8_t uint_fast8_t;
+ typedef unsigned int uint_fast16_t;
+ typedef uint32_t uint_fast32_t;
+ typedef uint64_t uint_fast64_t;
+
+ /* Ranges */
+ #define UINT8_MAX (~(uint8_t)0)
+ #define UINT8_MIN 0
+ #define UINT16_MAX (~(uint16_t)0)
+ #define UINT16_MIN 0
+ #define UINT32_MAX (~(uint32_t)0)
+ #define UINT32_MIN 0
+ #define UINT64_MAX (~(uint64_t)0)
+ #define UINT64_MIN 0
+
+ #define UINTPTR_MAX (~(uintptr_t)0)
+ #define UINTPTR_MIN 0
+
+ /* Need to do int_fast16_t as well, as type
+ size may be architecture dependent */
+ #define UINT_FAST16_MAX (~(uint_fast16_t)0)
+ #define UINT_FAST16_MAX 0
+
+ #define INT8_MAX (UINT8_MAX>>1)
+ #define INT8_MIN (INT8_MAX+1)
+ #define INT16_MAX (UINT16_MAX>>1)
+ #define INT16_MIN (INT16_MAX+1)
+ #define INT32_MAX (UINT32_MAX>>1)
+ #define INT32_MIN (INT32_MAX+1)
+ #define INT64_MAX (UINT64_MAX>>1)
+ #define INT64_MIN (INT64_MAX+1)
+
+ #define INTPTR_MAX (UINTPTR_MAX>>1)
+ #define INTPTR_MIN (INTPTR_MAX+1)
+
+ #define INT_FAST16_MAX (UINT_FAST16_MAX>>1)
+ #define INT_FAST16_MIN (INT_FAST16_MAX+1)
+
+ /* now define equiv. constants */
+ #define UINT_FAST8_MAX UINT8_MAX
+ #define UINT_FAST8_MIN UINT_FAST8_MIN
+ #define INT_FAST8_MAX INT8_MAX
+ #define INT_FAST8_MIN INT8_MIN
+ #define UINT_FAST32_MAX UINT32_MAX
+ #define UINT_FAST32_MIN UINT32_MIN
+ #define INT_FAST32_MAX INT32_MAX
+ #define INT_FAST32_MIN INT32_MIN
+ #define UINT_FAST64_MAX UINT64_MAX
+ #define UINT_FAST64_MIN UINT64_MIN
+ #define INT_FAST64_MAX INT64_MAX
+ #define INT_FAST64_MIN INT64_MIN
+
+ #define UINT_LEAST8_MAX UINT8_MAX
+ #define UINT_LEAST8_MIN UINT8_MIN
+ #define INT_LEAST8_MAX INT8_MAX
+ #define INT_LEAST8_MIN INT8_MIN
+ #define UINT_LEAST16_MAX UINT16_MAX
+ #define UINT_LEAST16_MIN UINT16_MIN
+ #define INT_LEAST16_MAX INT16_MAX
+ #define INT_LEAST16_MIN INT16_MIN
+ #define UINT_LEAST32_MAX UINT32_MAX
+ #define UINT_LEAST32_MIN UINT32_MIN
+ #define INT_LEAST32_MAX INT32_MAX
+ #define INT_LEAST32_MIN INT32_MIN
+ #define UINT_LEAST64_MAX UINT64_MAX
+ #define UINT_LEAST64_MIN UINT64_MIN
+ #define INT_LEAST64_MAX INT64_MAX
+ #define INT_LEAST64_MIN INT64_MIN
+
+ #define UINTMAX_MAX UINT64_MAX
+ #define UINTMAX_MIN UINT64_MIN
+ #define INTMAX_MAX INT64_MAX
+ #define INTMAX_MIN INT64_MIN
+
+ #endif
+ _EndOfHeader_;
};
-
/*
- * 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.
+ * This hack makes makes unistd.h more POSIX-compliant on VxWorks
*/
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 */
+ hackname = AAB_vxworks_unistd;
+ files = unistd.h;
+ mach = "*-*-vxworks*";
+
+ replace = <<- _EndOfHeader_
+ #ifndef _UNISTD_H
+ #define _UNISTD_H
+ #include_next <unistd.h>
+ #include <ioLib.h>
+ #ifndef STDIN_FILENO
+ #define STDIN_FILENO 0
+ #endif
+ #ifndef STDOUT_FILENO
+ #define STDOUT_FILENO 1
+ #endif
+ #ifndef STDERR_FILENO
+ #define STDERR_FILENO 2
+ #endif
+ #endif /* _UNISTD_H */
_EndOfHeader_;
};
+/*
+ * assert.h on AIX 7 redefines static_assert as _Static_assert without
+ * protecting C++.
+ */
+fix = {
+ hackname = aix_assert;
+ mach = "*-*-aix*";
+ files = assert.h;
+ select = "#define[ \t]static_assert[ \t]_Static_assert";
+ c_fix = format;
+ c_fix_arg = "#ifndef __cplusplus\n%0\n#endif";
+ test_text = "#define static_assert _Static_assert";
+};
+
+/*
+ * complex.h on AIX 5 and AIX 6 define _Complex_I and I in terms of __I,
+ * which only is provided by AIX xlc C99.
+ */
+fix = {
+ 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";
+};
/*
- * 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.
+ * malloc.h on AIX6 uses XLC++ specific builtin syntax
*/
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_malloc;
+ mach = "*-*-aix*";
+ files = "malloc.h";
+ select = "#ifdef __cplusplus";
+ c_fix = format;
+ c_fix_arg = "#if (defined(__cplusplus) && defined(__IBMCPP__))";
+ test_text = "#ifdef __cplusplus";
};
+/*
+ * net/if_arp.h defines a variable fc_softc instead of adding a
+ * typedef for the struct on AIX 5.2, 5.3, 6.1 and 7.1
+ */
+fix = {
+ hackname = aix_net_if_arp;
+ mach = "*-*-aix*";
+ files = "net/if_arp.h";
+ select = "^struct fc_softc \\{";
+ c_fix = format;
+ c_fix_arg = "typedef struct _fc_softc {";
+ test_text = "struct fc_softc {\n int a;\n};";
+};
/*
- * 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 AIX definition of NULL for G++.
*/
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_null;
+ mach = "*-*-aix*";
+ files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
+ time.h, unistd.h, wchar.h, sys/dir.h, sys/param.h, sys/types.h;
+ bypass = __null;
+ select = "#define[ \t]+NULL[ \t]+\\(*0L*\\)*";
+ c_fix = format;
+ c_fix_arg = <<- _EOFix_
+ #ifndef NULL
+ #ifdef __cplusplus
+ #ifdef __GNUG__
+ #define NULL __null
+ #else /* ! __GNUG__ */
+ #define NULL 0L
+ #endif /* __GNUG__ */
+ #else /* ! __cplusplus */
+ #define NULL ((void *)0)
+ #endif /* __cplusplus */
+ #endif /* !NULL */
+ _EOFix_;
+ test_text = "# define\tNULL \t(0L) /* typed NULL */";
+};
+
+/*
+ * pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER,
+ * PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough
+ * braces.
+ */
+fix = {
+ hackname = aix_once_init_1;
+ mach = "*-*-aix*";
+ files = "pthread.h";
+ select = "#define[ \t]PTHREAD_ONCE_INIT \\\\\n"
+ "\\{ \\\\\n";
+ c_fix = format;
+ c_fix_arg = "#define PTHREAD_ONCE_INIT \\\n"
+ "{{ \\\n";
+ test_text = "#define PTHREAD_ONCE_INIT \\\\\n"
+ "{ \\\\\n";
+};
+
+fix = {
+ hackname = aix_once_init_2;
+ mach = "*-*-aix*";
+ files = "pthread.h";
+ select = "[ \t]0 \\\\\n"
+ "\\}\n";
+ c_fix = format;
+ c_fix_arg = " 0 \\\n"
+ "}}\n";
+ test_text = " 0 \\\\\n"
+ "}\n";
+};
+
+fix = {
+ hackname = aix_mutex_initializer_1;
+ mach = "*-*-aix*";
+ files = "pthread.h";
+ select = "#define[ \t]PTHREAD_MUTEX_INITIALIZER \\\\\n"
+ "\\{ \\\\\n";
+ c_fix = format;
+ c_fix_arg = "#define PTHREAD_MUTEX_INITIALIZER \\\n"
+ "{{ \\\n";
+ test_text = "#define PTHREAD_MUTEX_INITIALIZER \\\\\n"
+ "{ \\\\\n";
};
+fix = {
+ hackname = aix_cond_initializer_1;
+ mach = "*-*-aix*";
+ files = "pthread.h";
+ select = "#define[ \t]PTHREAD_COND_INITIALIZER \\\\\n"
+ "\\{ \\\\\n";
+ c_fix = format;
+ c_fix_arg = "#define PTHREAD_COND_INITIALIZER \\\n"
+ "{{ \\\n";
+ test_text = "#define PTHREAD_COND_INITIALIZER \\\\\n"
+ "{ \\\\\n";
+};
+
+fix = {
+ hackname = aix_rwlock_initializer_1;
+ mach = "*-*-aix*";
+ files = "pthread.h";
+ select = "#define[ \t]PTHREAD_RWLOCK_INITIALIZER \\\\\n"
+ "\\{ \\\\\n";
+ c_fix = format;
+ c_fix_arg = "#define PTHREAD_RWLOCK_INITIALIZER \\\n"
+ "{{ \\\n";
+ test_text = "#define PTHREAD_RWLOCK_INITIALIZER \\\\\n"
+ "{ \\\\\n";
+};
/*
* pthread.h on AIX 4.3.3 tries to define a macro without whitspace
fix = {
hackname = aix_pthread;
files = "pthread.h";
- select = "(#define [A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
+ select = "(#define[\t ][A-Za-z_0-9]+)(\\\\\n[^A-Za-z_0-9 \t\n(])";
c_fix = format;
c_fix_arg = "%1 %2";
test_text = "#define PTHREAD_MUTEX_INITIALIZER\\\\\n"
"{...init stuff...}";
};
+/*
+ * AIX stdint.h fixes.
+ */
+fix = {
+ 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)";
+};
/*
- * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
- * in an otherwise harmless (and #ifed out) macro definition
+ * aix_stdint_2
*/
fix = {
- hackname = aix_sysmachine;
- files = sys/machine.h;
- select = "\\\\ +\n";
+ 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 = "\\\n";
- test_text = "#define FOO \\\n"
- " bar \\ \n baz \\ \n bat";
+ 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";
};
+/*
+ * aix_stdint_3
+ */
+fix = {
+ 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";
+};
/*
- * 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.
+ * aix_stdint_4
*/
fix = {
- hackname = aix_syswait;
- files = sys/wait.h;
- select = "^extern pid_t wait3\\(\\);\n";
- select = "bos325,";
+ 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 = "struct rusage;\n%0";
- test_text = "/* bos325, */\n"
- "extern pid_t wait3();\n"
- "\t/* pid_t wait3(int *, int, struct rusage *); */";
+ 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";
};
+/*
+ * aix_stdint_5
+ */
+fix = {
+ 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 = "#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)";
+};
+
+/*
+ * stdlib.h on AIX 4.3 declares strtof() with a non-const first argument.
+ */
+fix = {
+ hackname = aix_strtof_const;
+ files = stdlib.h;
+ select = "((extern[ \t]+)?float[ \t]+strtof)\\(char \\*, char \\*\\*\\);";
+ c_fix = format;
+ c_fix_arg = "%1(const char *, char **);";
+ test_text = "extern float strtof(char *, char **);";
+};
+
+/*
+ * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline
+ * in an otherwise harmless (and #ifed out) macro definition
+ */
+fix = {
+ hackname = aix_sysmachine;
+ files = sys/machine.h;
+ select = "\\\\ +\n";
+ c_fix = format;
+ c_fix_arg = "\\\n";
+ test_text = "#define FOO \\\n"
+ " bar \\ \n baz \\ \n bat";
+};
/*
* sys/wait.h on AIX 5.2 defines macros that have both signed and
select = '\? (\(\(\(\(unsigned[^)]*\)[^)]*\) >> [^)]*\) \& 0xff\) : -1)';
c_fix = format;
c_fix_arg = "? (int)%1";
- test_text = "#define WSTOPSIG(__x) (int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
+ test_text = "#define WSTOPSIG(__x) "
+ "(int)(WIFSTOPPED(__x) ? ((((unsigned int)__x) >> 8) & 0xff) : -1)";
};
-
/*
* sys/signal.h on some versions of AIX uses volatile in the typedef of
* sig_atomic_t, which causes gcc to generate a warning about duplicate
test_text = "typedef volatile int sig_atomic_t;";
};
-
/*
* Fix __assert declaration in assert.h on Alpha OSF/1.
*/
test_text = 'extern void __assert(char *, char *, int);';
};
-
-/*
- * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 headers.
- */
-fix = {
- hackname = alpha___extern_prefix;
- select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n"
- "(#[ \t]*pragma[ \t]*extern_prefix.*)";
-
- mach = "alpha*-dec-osf*";
- c_fix = format;
- c_fix_arg = "%1 (defined(__DECC) || defined(__PRAGMA_EXTERN_PREFIX))\n%3";
-
- test_text = "#ifdef __DECC\n"
- "#pragma extern_prefix \"_P\"\n"
- "# if defined(__DECC)\n"
- "# pragma extern_prefix \"_E\"\n"
- "# if !defined(_LIBC_POLLUTION_H_) && defined(__DECC)\n"
- "# pragma extern_prefix \"\"";
-};
-
-
-/*
- * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V4/5 <standards.h>.
- */
-fix = {
- hackname = alpha___extern_prefix_standards;
- files = standards.h;
- select = ".*!defined\\(_LIBC_POLLUTION_H_\\) && !defined\\(__DECC\\)";
-
- mach = "alpha*-dec-osf*";
- c_fix = format;
- c_fix_arg = "%0 && !defined(__PRAGMA_EXTERN_PREFIX)";
-
- test_text = "#if (_ISO_C_SOURCE>=19990L) "
- "&& !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)";
-};
-
-
-/*
- * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX V5 <sys/mount.h> and
- * <sys/stat.h>. The tests for __DECC are special in various ways, so
- * alpha__extern_prefix cannot be used.
- */
-fix = {
- hackname = alpha___extern_prefix_sys_stat;
- files = sys/stat.h;
- files = sys/mount.h;
- select = "#[ \t]*if[ \t]*defined\\(__DECC\\)";
-
- mach = "alpha*-dec-osf5*";
- c_fix = format;
- c_fix_arg = "%0 || defined(__PRAGMA_EXTERN_PREFIX)";
-
- test_text = "# if defined(__DECC)";
-};
-
-
/*
* Fix assert macro in assert.h on Alpha OSF/1.
* The superfluous int cast breaks C++.
fix = {
hackname = alpha_assert;
files = "assert.h";
- select = '(#define assert\(EX\).*)\(\(int\) \(EX\)\)';
+ select = "(#[ \t]*" '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__))';
};
-
-/*
- * Fix #defines under Alpha OSF/1:
- * The following files contain '#pragma extern_prefix "_FOO"' followed by
- * a '#define something(x,y,z) _FOOsomething(x,y,z)'. The intent of these
- * statements is to reduce namespace pollution. While these macros work
- * properly in most cases, they don't allow you to take a pointer to the
- * "something" being modified. To get around this limitation, change these
- * statements to be of the form '#define something _FOOsomething'.
- *
- * sed ain't egrep, lesson 2463: sed can use self-referential
- * regular expressions. In the substitute expression below,
- * "\\1" and "\\2" refer to subexpressions found earlier in the
- * same match. So, we continue to use sed. "extern_prefix" will
- * be a rare match anyway...
- */
-fix = {
- hackname = alpha_bad_lval;
-
- select = "^[ \t]*#[ \t]*pragma[ \t]+extern_prefix";
- mach = "alpha*-dec-osf*";
-
- sed =
- "s/^[ \t]*#[ \t]*define[ \t][ \t]*\\([^(]*\\)\\(([^)]*)\\)[ \t]*"
- "\\(_.*\\)\\1\\2[ \t]*$/#define \\1 \\3\\1/";
-
- test_text = '#pragma extern_prefix "_FOO"'"\n"
- "#define something(x,y,z) _FOOsomething(x,y,z)\n"
- "#define mumble _FOOmumble";
-};
-
-
/*
* Fix getopt declarations in stdio.h and stdlib.h on Alpha OSF/1 and AIX.
*/
test_text = 'extern int getopt(int, char *[], char *);';
};
+/*
+ * 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.
test_text = "#ifndef(__mips64) /* bogus */\nextern int foo;\n#endif";
};
-
-/*
- * Obey __PRAGMA_EXTERN_PREFIX for Tru64 UNIX <pthread.h>.
- */
-fix = {
- hackname = alpha_pthread;
- files = pthread.h;
- 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";
-
- test_text = "# if defined (_PTHREAD_ENV_DECC) "
- "|| defined (_PTHREAD_ENV_EPCC)\n"
- "# define _PTHREAD_USE_PTDNAM_\n"
- "# endif\n"
- "# ifdef _PTHREAD_ENV_DECC\n"
- "# define _PTHREAD_USE_PTDNAM_\n"
- "# endif";
-};
-
-
-/*
- * Recognize GCC in Tru64 UNIX V5.1B <pthread.h>.
- */
-fix = {
- hackname = alpha_pthread_gcc;
- files = pthread.h;
- select = "#else\n# error <pthread.h>: unrecognized compiler.";
-
- mach = "alpha*-dec-osf*";
- c_fix = format;
- c_fix_arg = "#elif defined (__GNUC__)\n"
- "# define _PTHREAD_ENV_GCC\n"
- "%0";
-
- test_text = "# define _PTHREAD_ENV_INTELC\n"
- "#else\n"
- "# error <pthread.h>: unrecognized compiler.\n"
- "#endif";
-};
-
-/*
- * Compaq Tru64 v5.1 defines all of its PTHREAD_*_INITIALIZER macros
- * incorrectly, specifying less fields in the initializers than are
- * defined in the corresponding structure types. Use of these macros
- * in user code results in spurious warnings.
- */
-fix = {
- hackname = alpha_pthread_init;
- files = pthread.h;
- select = ' \* @\(#\).RCSfile: pthread\.h,v \$'
- ' .Revision: 1\.1\.33\.21 \$ \(DEC\)'
- ' .Date: 2000/08/15 15:30:13 \$';
- mach = "alpha*-dec-osf*";
- sed = "s@MVALID\\(.*\\)A}@MVALID\\1A, 0, 0, 0, 0, 0, 0 }@\n"
- "s@MVALID\\(.*\\)_}@MVALID\\1_, 0, 0, 0, 0 }@\n"
- "s@CVALID\\(.*\\)A}@CVALID\\1A, 0, 0, 0, 0 }@\n"
- "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";
-};
-
/*
* Fix return value of sbrk in unistd.h on Alpha OSF/1 V2.0
* And OpenBSD.
test_text = "extern char* sbrk(ptrdiff_t increment);";
};
-
-/*
- * Change external names of wcstok/wcsftime via asm instead of macros on
- * Tru64 UNIX V4.0.
- */
-fix = {
- hackname = alpha_wchar;
- files = wchar.h;
-
- 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\");@";
- test_text = "#define wcstok wcstok_r\n"
- "#define wcsftime __wcsftime_isoc";
-};
-
-
/*
* For C++, avoid any typedef or macro definition of bool,
* and use the built in type instead.
test_text = "# define bool\t char \n";
};
-
+/*
+ * avoid_bool_type
+ */
fix = {
hackname = avoid_bool_type;
files = curses.h;
test_text = "typedef unsigned int\tbool \t; /* bool\n type */";
};
-
/*
* For C++, avoid any typedef definition of wchar_t,
* and use the built in type instead.
test_text = "typedef unsigned short\twchar_t \t; /* wchar_t\n type */";
};
-
/*
* Fix `typedef struct term;' on hppa1.1-hp-hpux9.
*/
test_text = 'typedef struct term;';
};
-
/*
* Fix one other error in this file:
* a mismatched quote not inside a C comment.
test_text = "/* doesn't have matched single quotes */";
};
-
/*
* check for broken assert.h that needs stdio.h
*/
test_text = "extern FILE* stderr;";
};
-
/*
* check for broken assert.h that needs stdlib.h
*/
test_text = "extern void exit ( int );";
};
-
/*
* 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 = {
"#else\n"
"extern double cabs();\n"
"#endif\n"
- "extern double cabs ( _Complex z );\n"
- "extern double cabs(); /* This is a comment\n"
- " and it ends here. */\n"
- "extern double cabs(struct __cabs_s);\n"
- "extern long double cabsl( struct __cabsl_s );";
+ "extern double cabs ( _Complex z );";
};
/*
* Fixup Darwin's broken check for __builtin_nanf.
- */
-
+ */
fix = {
hackname = broken_nan;
/*
*/
files = "architecture/ppc/math.h";
files = "architecture/*/math.h";
- select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
+ 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)";
-};
-
+};
/*
* Various systems derived from BSD4.4 contain a macro definition
*/
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;
test_text = '#define vfscanf __svfscanf';
};
-
/*
* Fix various macros used to define ioctl numbers.
* The traditional syntax was:
test_text = "#define _CTRL(c) ('c'&037)";
};
+/*
+ * Fix various macros used to define ioctl numbers.
+ */
fix = {
hackname = ctrl_quotes_use;
select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+CTRL[ \t]*\\( *[^,']";
test_text = "#define TCTRLFOO BSD43_CTRL(T, 1)";
};
-
/*
* sys/mman.h on HP/UX is not C++ ready,
* even though NO_IMPLICIT_EXTERN_C is defined on HP/UX.
test_text = "extern void* malloc( size_t );";
};
+/*
+ * For the AAB_darwin7_9_long_double_funcs fix to be useful,
+ * you have to not use "" includes.
+ */
+fix = {
+ hackname = darwin_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"';
+};
/*
* On darwin8 and earlier, mach-o/swap.h isn't properly guarded
test_text = "extern void swap_fat_header();\n";
};
-
/*
* AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of
* bad __GNUC__ tests.
*/
-
fix = {
hackname = darwin_gcc4_breakage;
mach = "*-*-darwin*";
"(__GNUC_MINOR__ >= 1)\n";
};
-
/*
* __private_extern__ doesn't exist in FSF GCC. Even if it did,
* why would you ever put it in a system header file?
*/
fix = {
- hackname = darwin_private_extern;
- mach = "*-*-darwin*";
- files = mach-o/dyld.h;
- select = "__private_extern__ [a-z_]+ _dyld_";
- c_fix = format;
- c_fix_arg = "extern";
- c_fix_arg = "__private_extern__";
- test_text = "__private_extern__ int _dyld_func_lookup(\n"
- "const char *dyld_func_name,\n"
- "unsigned long *address);\n";
+ hackname = darwin_private_extern;
+ mach = "*-*-darwin*";
+ files = mach-o/dyld.h;
+ select = "__private_extern__ [a-z_]+ _dyld_";
+ c_fix = format;
+ c_fix_arg = "extern";
+ c_fix_arg = "__private_extern__";
+ test_text = "__private_extern__ int _dyld_func_lookup(\n"
+ "const char *dyld_func_name,\n"
+ "unsigned long *address);\n";
+};
+
+/*
+ * 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,
"};\n#pragma intrinsic( dasm )\n/* END ASM TEST*/";
};
-
/*
* Fix typo in <wchar.h> on DJGPP 2.03.
*/
"extern __DJ_wint_t x;\n";
};
-
/*
* Fix these Sun OS files to avoid an invalid identifier in an #ifdef.
*/
test_text = "#ifdef ecd.cursor\n#error bogus\n#endif /* ecd+cursor */";
};
-
/*
- * 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.
+ * Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
+ * that fails when compiling for SSE-less 32-bit x86.
*/
fix = {
- hackname = exception_structure;
- files = math.h;
+ hackname = feraiseexcept_nosse_divbyzero;
+ mach = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+ files = bits/fenv.h, '*/bits/fenv.h';
+ select = "^([\t ]*)__asm__ __volatile__ \\(\"divss %1, %0 *\" : "
+ ": \"x\" \\(__f\\), \"x\" \\(__g\\)\\);$";
+ bypass = "\"fdivp .*; fwait\"";
+
+ c_fix = format;
+ c_fix_arg = <<- _EOText_
+ # ifdef __SSE_MATH__
+ %0
+ # else
+ %1__asm__ __volatile__ ("fdivp %%%%st, %%%%st(1); fwait"
+ %1 : "=t" (__f) : "0" (__f), "u" (__g) : "st(1)");
+ # endif
+ _EOText_;
- /* If matherr has a prototype already, the header needs no fix. */
- bypass = 'matherr.*(struct exception|__MATH_EXCEPTION|[ \t]*__FP_EXCEPTION[ \t]*\*[ \t]*)';
- select = matherr;
+ test_text = <<- _EOText_
+ __asm__ __volatile__ ("divss %1, %0" : : "x" (__f), "x" (__g));
+ _EOText_;
+};
- c_fix = wrap;
- c_fix_arg = "struct exception;\n";
+/*
+ * Incorrect feraiseexcept extern inline in bits/fenv.h on x86_64
+ * that fails when compiling for SSE-less 32-bit x86.
+ */
+fix = {
+ hackname = feraiseexcept_nosse_invalid;
+ mach = 'i[34567]86-*-linux*', 'x86*-linux*', 'amd64-*-linux*';
+ files = bits/fenv.h, '*/bits/fenv.h';
+ select = "^([\t ]*)__asm__ __volatile__ \\(\"divss %0, %0 *\" : "
+ ": \"x\" \\(__f\\)\\);$";
+ bypass = "\"fdiv .*; fwait\"";
+
+ c_fix = format;
+ c_fix_arg = <<- _EOText_
+ # ifdef __SSE_MATH__
+ %0
+ # else
+ %1__asm__ __volatile__ ("fdiv %%%%st, %%%%st(0); fwait"
+ %1 : "=t" (__f) : "0" (__f));
+ # endif
+ _EOText_;
- test_text = "extern int matherr();";
+ test_text = <<- _EOText_
+ __asm__ __volatile__ ("divss %0, %0" : : "x" (__f));
+ _EOText_;
};
-
/*
* Between 8/24/1998 and 2/17/2001, FreeBSD system headers presume
* neither the existence of GCC 3 nor its exact feature set yet break
*/
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)';
test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7';
};
-
/*
* Some releases of FreeBSD 4 and FreeBSD 5.0 and 5.1 system headers presume
* neither the existence of GCC 4 nor its exact feature set yet break
*/
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;
test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
};
-
/*
* Some versions of glibc don't expect the C99 inline semantics.
*/
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;
+ #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
hackname = glibc_c99_inline_2;
files = sys/stat.h, '*/sys/stat.h';
select = "extern __inline__ int";
- sed = "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/"
+ 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 __REDIRECT\\(_NTH\\|\\) (\\(stat\\|lstat\\|fstat\\)/"
+ 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/"
EOT;
};
-
+/*
+ * glibc_c99_inline_3
+ */
fix = {
hackname = glibc_c99_inline_3;
files = bits/string2.h, '*/bits/string2.h';
select = "extern __inline";
- bypass = "__STDC_VERSION__";
+ bypass = "__extern_inline|__GNU_STDC_INLINE__";
c_fix = format;
c_fix_arg = "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
c_fix_arg = "^# ifdef __cplusplus$";
EOT;
};
-
+/*
+ * glibc_c99_inline_4
+ */
fix = {
hackname = glibc_c99_inline_4;
- files = sys/sysmacros.h, '*/sys/sysmacros.h';
- bypass = "__STDC_VERSION__";
- select = "extern __inline";
+ files = sys/sysmacros.h, '*/sys/sysmacros.h', wchar.h, '*/wchar.h',
+ pthread.h, '*/pthread.h';
+ bypass = "__extern_inline|__gnu_inline__";
+ select = "(^| )extern __inline";
c_fix = format;
- c_fix_arg = "\n#ifdef __GNUC_GNU_INLINE__\nextern\n#endif\n";
- c_fix_arg = '(^| )extern ';
+ c_fix_arg = "%0 __attribute__ ((__gnu_inline__))";
test_text = <<-EOT
__extension__ extern __inline unsigned int
- __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.
hackname = glibc_mutex_init;
files = pthread.h;
select = '\{ *\{ *0, *\} *\}';
- sed = "/define[ \t]\\+PTHREAD_MUTEX_INITIALIZER[ \t]*\\\\/,+1"
- "s/{ { 0, } }/{ { 0, 0, 0, 0, 0, 0 } }/";
- sed = "s/{ \\(0, 0, 0, 0, PTHREAD_MUTEX_\\(RECURSIVE\\|ERRORCHECK\\|ADAPTIVE\\)_NP\\) }/{ \\1, 0 }/";
- sed = "s/{ \\(0, 0, 0, PTHREAD_MUTEX_\\(RECURSIVE\\|ERRORCHECK\\|ADAPTIVE\\)_NP\\) }/{ \\1, 0, 0 }/";
- sed = "/define[ \t]\\+PTHREAD_RWLOCK_INITIALIZER[ \t]*\\\\/"
+ 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]\\+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"
+ "\\(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]\\+PTHREAD_COND_INITIALIZER/"
+ 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_;
+ #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, '*/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
"typedef ushort_t wchar_t; /* ushort_t */";
};
-
/*
* Fix HP & Sony's use of "../machine/xxx.h"
* to refer to: <machine/xxx.h>
test_text = ' # include "../machine/mumble.h"';
};
-
/*
* Check for (...) in C++ code in HP/UX sys/file.h.
*/
test_text = "extern void foo(...); /* HPUX_SOURCE - bad varargs */";
};
+/*
+ * 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
" }\n";
};
-
-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 = "#endif /* _INCLUDE_HPUX_SOURCE */\n\n#if defined(_INCLUDE_HPUX_SOURCE) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L))\n%0#endif\n\n#ifdef _INCLUDE_HPUX_SOURCE\n";
-
- 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";
-};
-
-
/*
* Fix hpux 10.X missing ctype declarations 1
*/
test_text = "# define _toupper(__c) __toupper(__c)\n";
};
-
/*
* Fix hpux 10.X missing ctype declarations 2
*/
" extern unsigned int *__SB_masks;\n";
};
-
/*
* Fix hpux 10.X missing stdio declarations
*/
test_text = "# define _iob __iob\n";
};
-
/*
* Make sure hpux defines abs in header.
*/
fix = {
hackname = hpux11_abs;
- mach = ia64-hp-hpux11*;
+ mach = "*-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 hpux11 __LWP_RWLOCK_VALID define
+ */
+fix = {
+ hackname = hpux11_lwp_rwlock_valid;
+ mach = "*-hp-hpux11*";
+ files = sys/pthread.h;
+ select = "#define __LWP_RWLOCK_VALID[ \t]*0x8c91";
+ c_fix = format;
+ c_fix_arg = "#define __LWP_RWLOCK_VALID -29551";
+ test_text = "#define __LWP_RWLOCK_VALID 0x8c91";
+};
+
+/*
+ * hpux sendfile()
+ */
+fix = {
+ hackname = hpux11_extern_sendfile;
+ mach = "*-hp-hpux11.[12]*";
+ files = sys/socket.h;
+ select = "^[ \t]*extern sbsize_t sendfile.*\n.*, int\\)\\);\n";
+ c_fix = format;
+ c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
+ test_text = " extern sbsize_t sendfile __((int, int, off_t, bsize_t,\n"
+ " const struct iovec *, int));\n";
+};
+
+/*
+ * hpux sendpath()
+ */
+fix = {
+ hackname = hpux11_extern_sendpath;
+ mach = "*-hp-hpux11.[12]*";
+ files = sys/socket.h;
+ select = "^[ \t]*extern sbsize_t sendpath.*\n.*, int\\)\\);\n";
+ c_fix = format;
+ c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
+ test_text = " extern sbsize_t sendpath __((int, int, off_t, bsize_t,\n"
+ " const struct iovec *, int));\n";
+};
/*
* Keep HP-UX 11 from stomping on C++ math namespace
"#endif";
};
+/*
+ * 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
" extern int getpwuid_r( char *, __size_t, struct passwd **);\n";
};
-
/*
* Fix hpux 11.00 broken snprintf declaration
* (third argument is char *, needs to be const char * to prevent
"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
*/
' __va__list);';
};
-
/*
* get rid of bogus inline definitions in HP-UX 8.0
*/
"inline double sqr(double v) { return v**0.5; }";
};
+/*
+ * hpux intptr
+ */
+fix = {
+ hackname = hpux_c99_intptr;
+ mach = "*-hp-hpux11.3*";
+ files = stdint-hpux11.h, stdint.h;
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MAX[ \t]*"
+ "INT32_MAX[ \t]*$@#define PTRDIFF_MAX (2147483647l)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*PTRDIFF_MIN[ \t]*"
+ "INT32_MIN[ \t]*$@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MAX[ \t]*"
+ "INT32_MAX[ \t]*$@#define INTPTR_MAX (2147483647l)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INTPTR_MIN[ \t]*"
+ "INT32_MIN[ \t]*$@#define INTPTR_MIN (-INTPTR_MAX - 1)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINTPTR_MAX[ \t]*"
+ "UINT32_MAX[ \t]*$@#define UINTPTR_MAX (4294967295ul)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*SIZE_MAX[ \t]*"
+ "UINT32_MAX[ \t]*$@#define SIZE_MAX (4294967295ul)@";
+ test_text = "#define PTRDIFF_MAX INT32_MAX\n"
+ "#define PTRDIFF_MIN INT32_MIN\n"
+ "#define INTPTR_MAX INT32_MAX\n"
+ "#define INTPTR_MIN INT32_MIN\n"
+ "#define UINTPTR_MAX UINT32_MAX\n"
+ "#define SIZE_MAX UINT32_MAX\n";
+};
+
+/*
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ */
+fix = {
+ hackname = hpux_c99_inttypes;
+ mach = "*-hp-hpux11.[23]*";
+ files = inttypes.h;
+ files = stdint-hpux11.h, stdint.h;
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*"
+ "__CONCAT_U__(__c)[ \t]*$@#define UINT8_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*"
+ "__CONCAT_U__(__c)[ \t]*$@#define UINT16_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INT32_C(__c)[ \t]*"
+ "__CONCAT__(__c,l)[ \t]*$@#define INT32_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT32_C(__c)[ \t].*$@"
+ "#define UINT32_C(__c) __CONCAT__(__c,u)@";
+ test_text = "#define UINT8_C(__c) __CONCAT_U__(__c)\n"
+ "#define UINT16_C(__c) __CONCAT_U__(__c)\n"
+ "#define INT32_C(__c) __CONCAT__(__c,l)\n"
+ "#define UINT32_C(__c) __CONCAT__(__c,ul)\n";
+};
+
+/*
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ */
+fix = {
+ hackname = hpux_c99_inttypes2;
+ mach = "*-hp-hpux11.2*";
+ files = stdint-hpux11.h, stdint.h;
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INT8_C(__c)[ \t]*"
+ "((signed char)(__c))[ \t]*$@#define INT8_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT8_C(__c)[ \t]*"
+ "((unsigned char)(__c))[ \t]*$@#define UINT8_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*INT16_C(__c)[ \t]*"
+ "((short)(__c))[ \t]*$@#define INT16_C(__c) (__c)@";
+ sed = "s@^[ \t]*#[ \t]*define[ \t]*UINT16_C(__c)[ \t]*"
+ "((unsigned short)(__c))[ \t]*$@#define UINT16_C(__c) (__c)@";
+ test_text = "# define INT8_C(__c) ((signed char)(__c))\n"
+ "# define UINT8_C(__c) ((unsigned char)(__c))\n"
+ "# define INT16_C(__c) ((short)(__c))\n"
+ "# define UINT16_C(__c) ((unsigned short)(__c))\n";
+};
/*
* Fix hpux broken ctype macros
"# define isalpha(__c) (__SB_masks ? __SB_masks[__c] & _IS\n";
};
+/*
+ * hpux errno()
+ */
+fix = {
+ hackname = hpux_extern_errno;
+ mach = "*-hp-hpux10.*";
+ mach = "*-hp-hpux11.[0-2]*";
+ files = errno.h;
+ select = "^[ \t]*extern int errno;$";
+ c_fix = format;
+ c_fix_arg = "#ifdef __cplusplus\n"
+ "extern \"C\" {\n"
+ "#endif\n"
+ "%0\n"
+ "#ifdef __cplusplus\n"
+ "}\n"
+ "#endif";
+ test_text = " extern int errno;\n";
+};
/*
* Fix hpux broken #ifndef _XOPEN_SOURCE_EXTENDED conditional on htonl etc.
fix = {
hackname = hpux_htonl;
files = netinet/in.h;
- select = "#ifndef _XOPEN_SOURCE_EXTENDED\n"
+ select = "#ifndef _XOPEN_SOURCE_EXTENDED[ \t]*\n"
"(/\\*\n"
" \\* Macros for number representation conversion\\.\n"
" \\*/\n"
"#endif /* ! _XOPEN_SOURCE_EXTENDED */";
};
-
-/*
- * HP-UX long_double
- */
-fix = {
- hackname = hpux_long_double;
- files = stdlib.h;
- select = "extern[ \t]long_double[ \t]strtold";
- bypass = "long_double_t";
- sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
- sed = "s/long_double/long double/g";
-
- test_text = "# ifndef _LONG_DOUBLE\n"
- "# define _LONG_DOUBLE\n"
- " typedef struct {\n"
- " unsigned int word1, word2, word3, word4;\n"
- " } long_double;\n"
- "# endif /* _LONG_DOUBLE */\n"
- "extern long_double strtold(const char *, char **);\n";
-};
-
-
/*
- * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
*/
fix = {
- hackname = hpux_systime;
- files = sys/time.h;
- select = "^extern struct sigevent;";
-
+ hackname = hpux_imaginary_i;
+ mach = "ia64-hp-hpux11.*";
+ files = complex.h;
+ select = "^[ \t]*#[ \t]*define[ \t]*_Complex_I.*";
c_fix = format;
- c_fix_arg = "struct sigevent;";
-
- test_text = 'extern struct sigevent;';
+ c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)";
+ test_text = "#define _Complex_I (0.f+_Imaginary_I)\n";
};
-
/*
- * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
- * type and mpinfou is only defined when _KERNEL is set.
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
*/
-fix = {
- hackname = hpux_spu_info;
- mach = "*-hp-hpux*";
- files = ia64/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";
+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 = "#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";
+ c_fix_arg = "typedef signed char int%18_t;";
+ test_text = "typedef char int_least8_t;\n"
+ "typedef char int8_t;\n";
};
+/*
+ * HP-UX long_double
+ */
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";
+ hackname = hpux_long_double;
+ mach = "*-*-hpux10*";
+ mach = "*-*-hpux11.[012]*";
+ files = stdlib.h;
+ select = "extern[ \t]long_double[ \t]strtold";
+ bypass = "long_double_t";
+ sed = "/^#[ \t]*ifndef _LONG_DOUBLE/,/\\/\\* _LONG_DOUBLE \\*\\//D";
+ sed = "s/long_double/long double/g";
+
+ test_text = "# ifndef _LONG_DOUBLE\n"
+ "# define _LONG_DOUBLE\n"
+ " typedef struct {\n"
+ " unsigned int word1, word2, word3, word4;\n"
+ " } long_double;\n"
+ "# endif /* _LONG_DOUBLE */\n"
+ "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_extern_errno;
- mach = "*-hp-hpux10.*";
- mach = "*-hp-hpux11.[0-2]*";
- files = errno.h;
- select = "^[ \t]*extern int errno;$";
+ 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 = "#ifdef __cplusplus\nextern \"C\" {\n#endif\n%0\n#ifdef __cplusplus\n}\n#endif";
- test_text = " extern int errno;\n";
+ c_fix_arg = "# if !defined(_PROTOTYPES) || defined(_LONG_DOUBLE_STRUCT)";
+
+ test_text = "# if !defined(__ia64) || "
+ "!defined(_PROTOTYPES) || "
+ "defined(_LONG_DOUBLE_STRUCT)\n";
};
/*
"}\n";
};
+/*
+ * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
+ * type and mpinfou is only defined when _KERNEL is set.
+ */
+fix = {
+ hackname = hpux_spu_info;
+ mach = "*-hp-hpux*";
+ /*
+ * It is tempting to omit the first "files" entry. Do not.
+ * The testing machinery will take the first "files" entry as the name
+ * of a test file to play with. It would be a nuisance to have a directory
+ * with the name "*".
+ */
+ files = "ia64/sys/getppdp.h";
+ files = "*/sys/getppdp.h";
+ select = "^.*extern.*spu_info.*";
+
+ c_fix = format;
+ c_fix_arg = "#ifdef _KERNEL\n%0\n#endif";
+
+ test_text = "extern union mpinfou spu_info[];";
+};
+
+/*
+ * These hacks are need in inttypes.h on 11.23 and in stdint.h on 11.31.
+ */
+fix = {
+ hackname = hpux_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 hpux10.20 <sys/time.h> to avoid invalid forward decl
+ */
+fix = {
+ hackname = hpux_systime;
+ files = sys/time.h;
+ select = "^extern struct sigevent;";
+
+ c_fix = format;
+ c_fix_arg = "struct sigevent;";
+
+ test_text = 'extern struct sigevent;';
+};
+
/*
* Fix glibc definition of HUGE_VAL in terms of hex floating point constant
*/
fix = {
hackname = huge_val_hex;
- files = bits/huge_val.h;
+ files = bits/huge_val.h, '*/bits/huge_val.h';
select = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
bypass = "__builtin_huge_val";
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;
+ files = bits/huge_val.h, '*/bits/huge_val.h';
select = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
bypass = "__builtin_huge_valf";
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;
+ files = bits/huge_val.h, '*/bits/huge_val.h';
select = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
bypass = "__builtin_huge_vall";
test_text = "# define HUGE_VALL (__extension__ 0x1.0p32767L)";
};
-
/*
* Fix return type of abort and free
*/
"extern int exit(void*);";
};
-
/*
* Fix various macros used to define ioctl numbers.
* The traditional syntax was:
"#define XX_IO(x) ('x'<<8|256)";
};
+/*
+ * Fix the usage of the ioctl macro numbers.
+ */
fix = {
hackname = io_quotes_use;
select = "define[ \t]+[A-Z0-9_]+[ \t]+[A-Z0-9_]+IO[A-Z]*[ \t]*"
"BSD43__IOWR(T, 1) /* Some are multi-line */";
};
-
/*
* Check for missing ';' in struct
*/
"}; /* mumbled struct */\n";
};
-
-/*
- * IRIX 6.5.1[89] <internal/sgimacros.h> unconditionally defines
- * __restrict as restrict iff __c99. This is wrong for C++, which
- * needs many C99 features, but only supports __restrict.
- */
-fix = {
- hackname = irix___restrict;
- files = internal/sgimacros.h;
- select = "(#ifdef __c99\n)(#[ \t]*define __restrict restrict)";
-
- mach = "mips-sgi-irix6.5";
- c_fix = format;
- c_fix_arg = "%1"
- "# ifndef __cplusplus\n%2\n# endif";
-
- test_text = "#ifdef __c99\n# define __restrict restrict";
-};
-
-/*
- * IRIX 6.5.22 <internal/math_core.h> uses the SGI c99 __generic() intrinsic
- * to define the fpclasify, isfinite, isinf, isnan, isnormal and signbit
- * functions.
- *
- * This was probably introduced around IRIX 6.5.18
- */
-fix = {
- hackname = irix___generic1;
- files = internal/math_core.h;
- mach = "mips-sgi-irix6.5";
- select = "#define ([a-z]+)\\(x\\) *__generic.*";
-
- c_fix = format;
- c_fix_arg = "extern int %1(double);\n"
- "extern int %1f(float);\n"
- "extern int %1l(long double);\n"
- "#define %1(x) (sizeof(x) == sizeof(double) ? _%1(x) \\\n"
- " : sizeof(x) == sizeof(float) ? _%1f(x) \\\n"
- " : _%1l(x))\n";
-
- test_text =
- "#define isnan(x) __generic(x,,, _isnan, _isnanf, _isnanl,,,)(x)\n";
-};
-
-
-/* Likewise <internal/math_core.h> on IRIX 6.5.19 and later uses the SGI
- compiler's __generic intrinsic to define isgreater, isgreaterequal,
- isless, islessequal, islessgreater and isunordered functions. */
-fix = {
- hackname = irix___generic2;
- files = internal/math_core.h;
- mach = "mips-sgi-irix6.5";
- select = "#define ([a-z]+)\\(x,y\\) *__generic.*";
-
- c_fix = format;
- c_fix_arg = "#define %1(x,y) \\\n"
- " ((sizeof(x)<=4 && sizeof(y)<=4) ? _%1f(x,y) \\\n"
- " : (sizeof(x)<=8 && sizeof(y)<=8) ? _%1(x,y) \\\n"
- " : _%1l(x,y))\n";
-
- test_text =
- "#define isless(x,y) __generic(x,y,, _isless, _islessf, _islessl,,,)(x,y)";
-};
-
-
-/*
- * IRIX 5.2's <sys/asm.h> contains an asm comment with a contraction
- * that causes the assembly preprocessor to complain about an
- * unterminated character constant.
- */
-fix = {
- hackname = irix_asm_apostrophe;
- files = sys/asm.h;
-
- select = "^[ \t]*#.*[Ww]e're";
- c_fix = format;
- c_fix_arg = "%1 are";
- c_fix_arg = "^([ \t]*#.*[Ww]e)'re";
- test_text = "\t# and we're on vacation";
-};
-
-
/*
* Non-traditional "const" declaration in Irix's limits.h.
*/
test_text = "extern const char limit; /* test limits */";
};
-
-/*
- * IRIX 6.5.1[78] <sys/socket.h> has a broken definition of socklen_t.
- * Various socket function prototypes use different types instead,
- * depending on the API in use (BSD, XPG4/5), but the socklen_t
- * definition doesn't reflect this (SGI Bug Id 864477, fixed in
- * IRIX 6.5.19).
- */
-fix = {
- hackname = irix_socklen_t;
- files = sys/socket.h;
- select = "(#define _SOCKLEN_T\n)(typedef u_int32_t socklen_t;)";
-
- mach = "mips-sgi-irix6.5";
- c_fix = format;
- c_fix_arg = "%1"
- "#if _NO_XOPEN4 && _NO_XOPEN5\n"
- "typedef int socklen_t;\n"
- "#else\n"
- "%2\n"
- "#endif /* _NO_XOPEN4 && _NO_XOPEN5 */";
-
- test_text = "#define _SOCKLEN_T\ntypedef u_int32_t socklen_t;";
-};
-
-/*
- * IRIX 6.5 <stdint.h> only works with ISO C99 and errors out
- * otherwise.
- */
-fix = {
- hackname = irix_stdint_c99;
- 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 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
- * some functions that take a va_list as
+ * IRIX 5.x's stdio.h declares some functions that take a va_list as
* taking char *. However, GCC uses void * for va_list, so
* calling vfprintf with a va_list fails in C++. */
fix = {
hackname = irix_stdio_va_list;
files = stdio.h;
- files = internal/stdio_core.h;
select = '/\* va_list \*/ char \*';
c_fix = format;
"extern int printf( const char *, /* va_list */ char * );";
};
-
-/*
- * IRIX 6.5.19 <internal/wchar_core.h> provides the XPG4 variant of
- * wcsftime by default. ISO C99 requires the XPG5 variant instead.
- */
-fix = {
- hackname = irix_wcsftime;
- files = internal/wchar_core.h;
- select = "#if _NO_XOPEN5\n(extern size_t[ \t]+wcsftime.*const char \*.*)";
-
- mach = "mips-sgi-irix6.5";
- c_fix = format;
- 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";
-};
-
-
/*
* These files in Sun OS 4.x and ARM/RISCiX and BSD4.3
* use / * * / to concatenate tokens.
test_text = "#define __CONCAT__(a,b) a/**/b";
};
-
-/*
- * 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
+ * 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++.
*/
"\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
};
-
-/*
- * 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
test_text = "#warning Using <time.h> instead of <sys/time.h>";
};
-
/*
* Add missing declaration for putenv.
*/
test_text = "extern char *getenv _AP((const char *));";
};
-
/*
* Fix BSD machine/ansi.h to use __builtin_va_list to define _BSD_VA_LIST_.
*
test_text = " # define _BSD_VA_LIST_\tchar**";
};
-
/*
* Fix non-ansi machine name defines
*/
"\n/* no uniform test, so be careful :-) */";
};
-
/*
* Some math.h files define struct exception (it's in the System V
* 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;
files = math.h;
select = "struct exception";
/*
- * This should be bypassed on __cplusplus, but some supposedly C++ C++
+ * This should be bypassed on __cplusplus, but some supposedly C++
* aware headers, such as Solaris 8 and 9, don't wrap their struct
* 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';
+ /* The Solaris 10 headers already get this right. */
+ mach = '*-*-solaris2.1[0-9]*';
+ not_machine = true;
c_fix = wrap;
c_fix_arg = "#ifdef __cplusplus\n"
test_text = "typedef struct exception t_math_exception;";
};
-
/*
* This looks pretty broken to me. ``dbl_max_def'' will contain
* "define DBL_MAX " at the start, when what we really want is just
"#define HUGE_VAL DBL_MAX";
};
-
/*
* nested comment
*/
test_text = "/*#include <rpc/auth_des.h> /* skip this */";
};
-
-/*
- * Fix nested comments in Motorola's <limits.h> and <sys/limits.h>
- */
-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";
-
- 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@";
-
- 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*/";
-};
-
-
-/*
- * 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";
-};
-
-
/*
* Some versions of NetBSD don't expect the C99 inline semantics.
*/
fix = {
hackname = netbsd_c99_inline_1;
- mach = *-*-netbsd*;
+ mach = "*-*-netbsd*";
files = signal.h;
select = "extern __inline int";
c_fix = format;
- c_fix_arg = "extern\n#ifdef __GNUC_STDC_INLINE__\n__attribute__((__gnu_inline__))\n#endif\n__inline int";
+ c_fix_arg = "extern\n"
+ "#ifdef __GNUC_STDC_INLINE__\n"
+ "__attribute__((__gnu_inline__))\n"
+ "#endif\n"
+ "__inline int";
test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
};
-
+/*
+ * netbsd_c99_inline_2
+ */
fix = {
hackname = netbsd_c99_inline_2;
- mach = *-*-netbsd*;
+ mach = "*-*-netbsd*";
files = signal.h;
select = "#define _SIGINLINE extern __inline";
test_text = "#define _SIGINLINE extern __inline";
};
-
/*
* NetBSD has a semicolon after the ending '}' for some extern "C".
*/
fix = {
hackname = netbsd_extra_semicolon;
- mach = *-*-netbsd*;
+ mach = "*-*-netbsd*";
files = sys/cdefs.h;
select = "#define[ \t]*__END_DECLS[ \t]*};";
test_text = "#define __END_DECLS };";
};
+/*
+ * newlib's stdint.h has several failures to conform to C99. The fix
+ * for these removed a comment that can be matched to identify unfixed
+ * versions.
+ */
+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";
+};
+
+/*
+ * newlib_stdint_2
+ */
+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.
test_text = "extern\tdouble\t__const__\tmumble();";
};
-
/*
* NeXT 3.2 uses the word "template" as a parameter for some
* functions. GCC reports an invalid use of a reserved key word
test_text = "extern mumble( char * template); /* fix */";
};
-
/*
* NeXT 3.2 includes the keyword volatile in the abort() and exit()
* function prototypes. That conflicts with the built-in functions.
test_text = "extern\tvolatile\tvoid\tabort();";
};
-
/*
* NeXT 2.0 defines 'int wait(union wait*)', which conflicts with Posix.1.
* Note that version 3 of the NeXT system has wait.h in a different directory,
test_text = "extern pid_d wait(union wait*);";
};
-
/*
* a missing semi-colon at the end of the nodeent structure definition.
*/
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
test_text = "#include <reg_types.h>";
};
-
-/*
- * 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.
- */
-fix = {
- hackname = pthread_page_size;
- files = pthread.h;
- select = "^int __page_size";
- c_fix = format;
- c_fix_arg = "extern %0";
- test_text = "int __page_size;";
-};
-
/*
* On broken glibc-2.3.3 systems an array of incomplete structures is
* passed to __sigsetjmp. Fix that to take a pointer instead.
select = "struct __jmp_buf_tag";
c_fix = format;
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);";
-};
-
-/*
- * 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 = "^(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
test_text = "extern int\tfclose(), fflush(), fread(), fwrite(), foo();";
};
-
/*
* Fix casts as lvalues in glibc's <rpc/xdr.h>.
*/
"\t((long)ntohl((u_long)*__extension__((u_int32_t*)(buf))++))";
};
-
+/*
+ * rpc_xdr_lvalue_cast_b
+ */
fix = {
hackname = rpc_xdr_lvalue_cast_b;
files = rpc/xdr.h;
"\t(*__extension__((u_int32_t*)(buf))++ = (long)htonl((u_long)(v)))";
};
-
/*
* function class(double x) conflicts with C++ keyword on rs/6000
*/
test_text = "extern int class();";
};
-
/*
* Wrong fchmod prototype on RS/6000.
*/
test_text = "extern int fchmod(char *, mode_t);";
};
-
/*
* parameters conflict with C++ new on rs/6000
*/
test_text = 'extern int rename(const char *old, const char *new);';
};
-
/*
- * 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+ <sys/feature_tests.h> defines _RESTRICT_KYWD as restrict
+ * for C99. This is wrong for C++, which needs many C99 features, but
+ * only supports __restrict.
*/
fix = {
- hackname = sco_math;
- files = math.h, '*/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___restrict;
+ files = sys/feature_tests.h;
+ select = "#define[ \t]*_RESTRICT_KYWD[ \t]*restrict";
+ mach = "*-*-solaris2*";
+ c_fix = format;
+ c_fix_arg = "#ifdef __cplusplus\n#define\t_RESTRICT_KYWD\t__restrict\n"
+ "#else\n%0\n#endif";
+ test_text = "#define _RESTRICT_KYWD restrict";
+};
+/*
+ * 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 = 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";
};
+/*
+ * Solaris 10+ <complex.h> is wrapped in #ifndef __cplusplus. Wrap in
+ * extern "C" instead so libstdc++ can use it.
+ */
+fix = {
+ hackname = solaris_complex_cxx;
+ mach = "*-*-solaris2.*";
+ files = complex.h;
+ sed = "/#if[ \t]*!defined(__cplusplus)/c\\\n"
+ "#ifdef\t__cplusplus\\\nextern \"C\" {\\\n#endif";
+ sed = "/#endif[ \t]*\\/\\* !defined(__cplusplus) \\*\\//c\\\n"
+ "#ifdef\t__cplusplus\\\n}\\\n#endif";
+ test_text = "#if !defined(__cplusplus)\n"
+ "#endif /* !defined(__cplusplus) */";
+};
/*
- * On SCO OpenServer prior to 5.0.7UP1, <sys/regset.h> and <ieeefp.h>
- * have a clash on struct _fpstate and struct fpstate.
+ * g++ rejects functions declared with both C and C++ linkage.
*/
fix = {
- hackname = sco_regset;
- files = sys/regset.h;
- mach = "*-*-sco3.2v5*";
- select = "(struct[ \t]+.*)fpstate";
+ hackname = solaris_cxx_linkage;
+ mach = '*-*-solaris2*';
+ files = "iso/stdlib_iso.h";
+ select = "(#if __cplusplus >= 199711L)\n"
+ "(extern \"C\\+\\+\" \\{\n)"
+ "(.*(bsearch|qsort).*)";
c_fix = format;
- c_fix_arg = "%1rsfpstate";
+ c_fix_arg = "%1 && !__GNUG__\n%2%3";
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";
+ "#if __cplusplus >= 199711L\n"
+ "extern \"C++\" {\n"
+ " void *bsearch(const void *, const void *, size_t, size_t,";
};
-
/*
- * 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.
+ * Solaris <iso/stdio_iso.h> doesn't declare getc for C++ with
+ * _STRICT_STDC, but uses it.
*/
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_getc_strict_stdc;
+ mach = "*-*-solaris2*";
+ files = "iso/stdio_iso.h";
+ select = "(.*&& )!defined\\(_STRICT_STDC\\)(.*)";
+ c_fix = format;
+ c_fix_arg = "%1(!defined(_STRICT_STDC) || (__cplusplus >= 199711L))%2";
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";
+ "#if !defined(_REENTRANT) && !defined(_LP64) && !defined(_STRICT_STDC)";
};
+/*
+ * Sun Solaris 2 has a version of sys/int_const.h that defines
+ * UINT8_C and UINT16_C to unsigned constants.
+ */
+fix = {
+ hackname = solaris_int_const;
+ files = sys/int_const.h;
+ mach = '*-*-solaris2*';
+ c_fix = format;
+ c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
+ "%1\n"
+ "#define\tUINT16_C(c)\t(c)";
+ select = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
+ "(/\*.*\*/)\n"
+ "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
+ test_text =
+ "#define UINT8_C(c) __CONCAT__(c,u)\n"
+ "/* CSTYLED */\n"
+ "#define UINT16_C(c) __CONCAT__(c,u)";
+};
/*
- * Fix prototype declaration of utime in sys/times.h.
- * In 3.2v4.0 the const is missing.
+ * Sun Solaris 2 has a version of sys/int_limits.h that defines
+ * UINT8_MAX and UINT16_MAX to unsigned constants.
*/
fix = {
- hackname = sco_utime;
- files = sys/times.h;
- mach = "i?86-*-sco3.2v4*";
+ 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)";
+};
- select = '\(const char \*, struct utimbuf \*\);';
+/*
+ * 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 = '(const char *, const struct utimbuf *);';
+ 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";
+};
- test_text = "extern int utime(const char *, struct utimbuf *);";
+/*
+ * Sun Solaris 2 has a version of sys/int_limits.h that defines
+ * SIZE_MAX as unsigned long.
+ */
+fix = {
+ hackname = solaris_int_limits_3;
+ files = sys/int_limits.h;
+ mach = '*-*-solaris2*';
+ c_fix = format;
+ c_fix_arg = "#define\tSIZE_MAX\t4294967295U";
+ select = "^#define[ \t]+SIZE_MAX[ \t]+4294967295UL";
+ test_text =
+ "#define SIZE_MAX 4294967295UL";
};
/*
"#define HUGE_VALL __builtin_huge_vall";
};
+/*
+ * On Solaris 11, if you do isinf(NaN) you'll get a floating point
+ * exception. Provide an alternative using GCC's builtin.
+ */
+fix = {
+ hackname = solaris_math_10;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tisinf(x) __builtin_isinf(x)";
+ c_fix_arg = "^#define[ \t]+isinf\\(x\\)[ \t]+__extension__\\([ \t]*\\\\\n"
+ "[ \t]*\\{[ \t]*__typeof\\(x\\)[ \t]*__x_i[ \t]*=[ \t]*\\(x\\);"
+ "[ \t]*\\\\\n"
+ "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
+ "INFINITY[ \t]*\\|\\|[ \t]*\\\\\n"
+ "[ \t]*__x_i[ \t]*==[ \t]*\\(__typeof\\(__x_i\\)\\)[ \t]*"
+ "\\(-INFINITY\\);[ \t]*\\}\\)";
+ test_text =
+ '#pragma ident "@(#)math_c99.h 1.12 07/01/21 SMI"'"\n"
+ "#undef isinf\n"
+ "#define isinf(x) __extension__( \\\\\n"
+ " { __typeof(x) __x_i = (x); \\\\\n"
+ " __x_i == (__typeof(__x_i)) INFINITY || \\\\\n"
+ " __x_i == (__typeof(__x_i)) (-INFINITY); })";
+};
+
+/*
+ * Solaris math INFINITY
+ */
fix = {
hackname = solaris_math_2;
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
"#define INFINITY __builtin_infinity";
};
+/*
+ * Solaris math NAN
+ */
fix = {
hackname = solaris_math_3;
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
"#define NAN __builtin_nan";
};
+/*
+ * Solaris math fpclassify
+ */
fix = {
hackname = solaris_math_4;
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
files = iso/math_c99.h;
c_fix = format;
c_fix_arg = "#define\tfpclassify(x) \\\n"
- " __extension__ ({ const __typeof(x) __x_fp = (x); \\\n"
- "\t\t isnan(__x_fp) \\\n"
- "\t\t ? FP_NAN \\\n"
- "\t\t : isinf(__x_fp) \\\n"
- "\t\t ? FP_INFINITE \\\n"
- "\t\t : isnormal(__x_fp) \\\n"
- "\t\t\t ? FP_NORMAL \\\n"
- "\t\t\t : __x_fp == 0.0 \\\n"
- "\t\t\t ? FP_ZERO \\\n"
- "\t\t\t : FP_SUBNORMAL; })";
+ " __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"
"#define fpclassify(x) __builtin_fpclassify(x)";
};
+/*
+ * Solaris math signbit
+ */
fix = {
hackname = solaris_math_8;
- select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ SMI";
bypass = "__GNUC__";
files = iso/math_c99.h;
c_fix = format;
"\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 =
- '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
- "#undef signbit\n"
- "#define signbit(x) __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_;
};
+/*
+ * Solaris math comparison macros
+ */
fix = {
hackname = solaris_math_9;
select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
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\\)\\)";
+ 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"
};
/*
- * 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.
+ * Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing
+ * warnings.
*/
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},/";
- 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";
+ hackname = solaris_math_11;
+ select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ ";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = << _EOArg_
+#undef signbit
+#define signbit(x) (sizeof(x) == sizeof(float) \
+ ? __builtin_signbitf(x) \
+ : sizeof(x) == sizeof(long double) \
+ ? __builtin_signbitl(x) \
+ : __builtin_signbit(x))
+_EOArg_;
+ c_fix_arg = << _EOArg_
+^#undef[ ]+signbit
+#if defined\(__sparc\)
+#define[ ]+signbit\(x\)[ ]+__extension__\( \\
+[ ]+\{[ ]*__typeof\(x\)[ ]*__x_s[ ]*=[ ]*\(x\);[ ]*\\
+[ ]+\(int\)[ ]*\(\*\(unsigned[ ]*\*\)[ ]*\&__x_s[ ]*>>[ ]*31\);[ ]*\}\)
+#elif defined\(__i386\) \|\| defined\(__amd64\)
+#define[ ]+signbit\(x\)[ ]+__extension__\( \\
+[ ]+\{ __typeof\(x\) __x_s = \(x\); \\
+[ ]+\(sizeof \(__x_s\) == sizeof \(float\) \? \\
+[ ]+\(int\) \(\*\(unsigned \*\) \&__x_s >> 31\) : \\
+[ ]+sizeof \(__x_s\) == sizeof \(double\) \? \\
+[ ]+\(int\) \(\(\(unsigned \*\) \&__x_s\)\[1\] >> 31\) : \\
+[ ]+\(int\) \(\(\(unsigned short \*\) \&__x_s\)\[4\] >> 15\)\); \}\)
+#endif
+_EOArg_;
+ test_text = << _EOText_
+/* @(#)math_c99.h 1.14 13/03/27 */
+#undef signbit
+#if defined(__sparc)
+#define signbit(x) __extension__( \\
+ { __typeof(x) __x_s = (x); \\
+ (int) (*(unsigned *) &__x_s >> 31); })
+#elif defined(__i386) || defined(__amd64)
+#define signbit(x) __extension__( \\
+ { __typeof(x) __x_s = (x); \\
+ (sizeof (__x_s) == sizeof (float) ? \\
+ (int) (*(unsigned *) &__x_s >> 31) : \\
+ sizeof (__x_s) == sizeof (double) ? \\
+ (int) (((unsigned *) &__x_s)[1] >> 31) : \\
+ (int) (((unsigned short *) &__x_s)[4] >> 15)); })
+#endif
+_EOText_;
};
-
/*
- * Sun Solaris defines PTHREAD_MUTEX_INITIALIZER with a trailing
- * "0" for the last field of the pthread_mutex_t structure, which is
- * of type upad64_t, which itself is typedef'd to int64_t, but with
- * __STDC__ defined (e.g. by -ansi) it is a union. So change the
- * initializer to "{0}" instead
+ * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
+ * structure. As such, it need two levels of brackets, but only
+ * contains one. Wrap the macro definition in an extra layer.
*/
fix = {
- hackname = solaris_mutex_init_2;
+ hackname = solaris_once_init_1;
select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
files = pthread.h;
- /*
- * On Solaris 10, this fix is unnecessary because upad64_t is
- * always defined correctly regardless of the definition of the
- * __STDC__ macro. The first "mach" pattern matches up to
- * solaris9. The second "mach" pattern will not match any two (or
- * more) digit solaris version, but it will match e.g. 2.5.1.
- */
- mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
+ mach = '*-*-solaris*';
c_fix = format;
- c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
- "%0\n"
- "#else\n"
- "%1, {0}}%4\n"
- "#endif";
- c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+"
- "(|/\*.*\*/[ \t]*\\\\\n[ \t]*)\\{.*)"
- ",[ \t]*0\\}" "(|[ \t].*)$";
+ c_fix_arg = "%1{%2}%3";
+ c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
test_text =
- '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
- "#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
- "#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
- "#define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \\\\\n"
- " {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}\n"
- "#define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \\\\\n"
- " {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}";
+ '#pragma ident "@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
+ "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
};
-
/*
- * 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.
+ * Solaris 10+ <spawn.h> uses char *const argv[_RESTRICT_KYWD] in the
+ * posix_spawn declarations, which doesn't work with C++.
*/
fix = {
- 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 = "#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]*$";
-
+ hackname = solaris_posix_spawn_restrict;
+ files = spawn.h;
+ mach = '*-*-solaris2*';
+ c_fix = format;
+ c_fix_arg = "%1*_RESTRICT_KYWD %2%3";
+ select = "(.*[ \t]+)([a-z]+)\\[_RESTRICT_KYWD\\](.*)";
test_text =
- '#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}}";
+ "char *const argv[_RESTRICT_KYWD],\n"
+ "char *const envp[_RESTRICT_KYWD]);";
};
-
/*
- * 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.
+ * The pow overloads with int were removed in C++ 2011 DR 550.
*/
fix = {
- hackname = solaris_once_init_1;
- select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
- files = pthread.h;
- mach = '*-*-solaris*';
- c_fix = format;
- c_fix_arg = "%1{%2}%3";
- c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
+ hackname = solaris_pow_int_overload;
+ mach = '*-*-solaris2*';
+ files = "iso/math_iso.h";
+ select = "^[ \t]*inline [a-z ]* pow\\([^()]*, int [^()]*\\)"
+ " *\\{[^{}]*\n[^{}]*\\}";
+ c_fix = format;
+ c_fix_arg = "#if __cplusplus < 201103L\n%0\n#endif";
+
test_text =
- '#pragma ident "@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
- "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
+ " inline long double pow(long double __X, int __Y) { return\n"
+ " __powl(__X, (long double) (__Y)); }";
};
-
/*
- * Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
- * fields of the pthread_once_t structure, which are of type
+ * 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. This test relies on solaris_once_init_1.
+ * to "{0}" instead.
*/
fix = {
- hackname = solaris_once_init_2;
+ hackname = solaris_rwlock_init_1;
select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
files = pthread.h;
- /*
- * On Solaris 10, this fix is unnecessary because upad64_t is
- * always defined correctly regardless of the definition of the
- * __STDC__ macro. The first "mach" pattern matches up to
- * solaris9. The second "mach" pattern will not match any two (or
- * more) digit solaris version, but it will match e.g. 2.5.1.
- */
- mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
+ mach = '*-*-solaris*';
c_fix = format;
c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
"%0\n"
"#else\n"
- "%1{0}, {0}, {0}, {%3}%4\n"
+ "%1{0, 0, 0, {{0}, {0}, {0}}, {{0}, {0}}, {{0}, {0}}}\n"
"#endif";
- c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{\\{)"
- "(0, 0, 0, )(PTHREAD_[A-Z_]+)(\\}\\})[ \t]*$";
+ c_fix_arg = "(^#define[ \t]+PTHREAD_RWLOCK_INITIALIZER[ \t]+)"
+ "\\{0, 0, 0, \\{0, 0, 0\\}, \\{0, 0\\}, \\{0, 0\\}\\}[ \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";
+ "#define PTHREAD_RWLOCK_INITIALIZER\t{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 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.
+ * Before Solaris 10, <stdio.h> lacks declarations of std::__filbuf and
+ * std::__flsbuf, but <iso/stdio_iso.h> uses them.
*/
fix = {
- hackname = solaris_socket;
- files = sys/socket.h;
- select = '@\(#\)socket.h' "[ \t]+1.[123][0-9][ \t]+9[567]/[0-9/]+ SMI";
- 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\);';
+ hackname = solaris_std___filbuf;
+ files = stdio.h;
+ mach = '*-*-solaris2*';
+ bypass = "using std::__filbuf";
+ select = "(using std::perror;\n)(#endif)";
+ c_fix = format;
+ c_fix_arg = "%1#ifndef _LP64\n"
+ "using std::__filbuf;\n"
+ "using std::__flsbuf;\n"
+ "#endif\n%2";
- 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 = "using std::perror;\n"
+ "#endif";
};
-
/*
- * Solaris 2.8 has what appears to be some gross workaround for
+ * 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.
*/
test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
};
-
-/*
- * Sun Solaris 2.5.1 doesn't define 'getpagesize' in <unistd.h>, as is done
- * on Solaris 2.6 and up.
- */
-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();";
-};
-
-
-/*
- * <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.
- */
-fix = {
- hackname = solaris_widec;
- files = widec.h;
- mach = '*-*-solaris2.[0-5]';
- mach = '*-*-solaris2.[0-5].*';
- bypass = "include.*wchar\\.h";
- select = "#include <euc.h>";
- c_fix = format;
- c_fix_arg = "%0\n#include <wchar.h>";
- test_text = "#include <euc.h>";
-};
-
-
/*
* a missing semi-colon at the end of the statsswtch structure definition.
*/
test_text = "struct statswtch {\n int boottime\n};";
};
-
/*
* Arrange for stdio.h to use stdarg.h to define __gnuc_va_list.
* On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's
test_text = "";
};
-
/*
* Don't use or define the name va_list in stdio.h. This is for
* ANSI. Note _BSD_VA_LIST_ is dealt with elsewhere. The presence
* of __gnuc_va_list, __DJ_va_list, or _G_va_list is taken to
* indicate that the header knows what it's doing -- under SUSv2,
* stdio.h is required to define va_list, and we shouldn't break
- * that. On IRIX 6.5, internal/wchar_core.h used to get its
- * definition of va_list from stdio.h. Since this doesn't happen any
- * longer, use __gnuc_va_list there, too.
+ * that.
*/
fix = {
hackname = stdio_va_list;
files = stdio.h;
- files = internal/stdio_core.h;
- files = internal/wchar_core.h;
bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
/*
* On Solaris 10, the definition in
test_text = "extern void mumble( va_list);";
};
-
/*
* Fix headers that use va_list from stdio.h to use the updated
* va_list from the stdio_va_list change. Note _BSD_VA_LIST_ is
test_text = "extern void mumble( va_list);";
};
-
/*
* "!__STDC__" or "__STDC__==0" or "__STDC__!=1" or "__STDC__-0==0"
* is "!defined( __STRICT_ANSI__ )"
"int foo;\n#endif";
};
-
/*
* "__STDC__!=0" or "__STDC__==1" or "__STDC__-0==1"
* is "defined( __STRICT_ANSI__ )"
test_text = "#if __STDC__ == 1 /* is std C\n */\nint foo;\n#endif";
};
-
/*
* IRIX 4.0.5 <rpc/xdr.h> uses struct __file_s
* in prototype without previous definition.
test_text = "extern void xdrstdio_create( struct __file_s* );";
};
-
/*
* IRIX 4.0.5 <rpc/auth.h> uses struct sockaddr
* in prototype without previous definition.
test_text = "extern AUTH* authdes_create( struct sockaddr* );";
};
-
/*
* Apply fix this to all OSs since this problem seems to effect
* more than just SunOS.
"};";
};
-
/*
* Fix bogus #ifdef on SunOS 4.1.
*/
test_text = "#ifdef __i386__ || __vax__ || __sun4c__";
};
-
/*
* Fix the CAT macro in SunOS memvar.h.
*/
"#define CAT(a,b)\ta/**/b";
};
-
/*
* Fix return type of free and {c,m,re}alloc in <malloc.h> on SunOS 4.1.
* Also fix return type of {m,re}alloc in <malloc.h> on sysV68
"char*\trealloc();";
};
-
/*
* Check for yet more missing ';' in struct (in SunOS 4.0.x)
*/
test_text = "struct mumble\n int _cnt\n};";
};
-
/*
* signal.h on SunOS defines signal using (),
* which causes trouble when compiling with g++ -pedantic.
"void\t(*signal(...))(...);\n"
"#else\n%0\n#endif";
- test_text = "void\t(*signal())();";
-};
-
-
-/*
- * Correct the return type for strlen in strings.h in SunOS 4.
- */
-fix = {
- hackname = sunos_strlen;
- files = strings.h;
- select = "int[ \t]*strlen\\(\\);(.*)";
- c_fix = format;
- c_fix_arg = "__SIZE_TYPE__ strlen();%1";
- test_text = " int\tstrlen(); /* string length */";
-};
-
-
-/*
- * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
- * that is visible to any ANSI compiler using this include. Simply
- * delete the lines that #define some string functions to internal forms.
- */
-fix = {
- hackname = svr4_disable_opt;
- files = string.h;
- select = '#define.*__std_hdr_';
- sed = '/#define.*__std_hdr_/d';
- test_text = "#define strlen __std_hdr_strlen\n";
-};
-
-
-/*
- * 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 = {
- hackname = svr4_getcwd;
- files = stdlib.h;
- files = unistd.h;
- files = prototypes.h;
- select = 'getcwd\(char \*, int\)';
-
- c_fix = format;
- c_fix_arg = "getcwd(char *, size_t)";
-
- test_text = "extern char* getcwd(char *, int);";
-};
-
-
-/*
- * 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 = "";
+ test_text = "void\t(*signal())();";
};
-
/*
- * 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).
+ * Correct the return type for strlen in strings.h in SunOS 4.
*/
-#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";
+ hackname = sunos_strlen;
+ files = strings.h;
+ select = "int[ \t]*strlen\\(\\);(.*)";
+ c_fix = format;
+ c_fix_arg = "__SIZE_TYPE__ strlen();%1";
+ test_text = " int\tstrlen(); /* string length */";
};
-#endif
-
/*
- * Fix declarations of `makedev', `major', and `minor' in <sys/mkdev.h>.
- * They are declared as non-static then immediately redeclared as static.
+ * Linux kernel's vt.h breaks C++
*/
-#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 */
+ hackname = suse_linux_vt_cxx;
+ files = linux/vt.h;
+ select = "^[ \t]*unsigned int new;";
+ c_fix = format;
+ c_fix_arg = "unsigned int newev;";
-/*
- * 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_/';
+ test_text = " unsigned int new; /* New console (if changing) */";
};
-#endif
/*
- * Fix reference to NMSZ in <sys/adv.h>.
+ * Disable apparent native compiler optimization cruft in SVR4.2 <string.h>
+ * that is visible to any ANSI compiler using this include. Simply
+ * delete the lines that #define some string functions to internal forms.
*/
-#ifdef SVR4
fix = {
- hackname = svr4_nmsz;
- files = sys/adv.h;
- select = '\[NMSZ\]';
- sed = 's/\[NMSZ\]/\[RFS_NMSZ\]/g';
+ hackname = svr4_disable_opt;
+ files = string.h;
+ select = '#define.*__std_hdr_';
+ sed = '/#define.*__std_hdr_/d';
+ test_text = "#define strlen __std_hdr_strlen\n";
};
-#endif
-
/*
- * Some SVR4 systems supposedly use these non-ANSI preprocessor directives.
+ * Fix broken decl of getcwd present on some svr4 systems.
*/
-#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)\(([^)]*)\)';
+ hackname = svr4_getcwd;
+ files = stdlib.h;
+ files = unistd.h;
+ files = prototypes.h;
+ select = 'getcwd\(char \*, int\)';
+
c_fix = format;
- c_fix_arg = 'defined(__%1__)';
- test_text = "#if #machine(i386) || #system(vax) || #cpu(sparc)";
-};
-#endif
+ c_fix_arg = "getcwd(char *, size_t)";
+ test_text = "extern char* getcwd(char *, int);";
+};
/*
* Fix broken decl of profil present on some svr4 systems.
select =
'profil\(unsigned short \*, unsigned int, unsigned int, unsigned int\)';
- /* The fix is wrong on IRIX 5/6 and creates a conflict with another
- prototype in <sys/profil.h>. */
- bypass = 'Silicon Graphics';
c_fix = format;
c_fix_arg = 'profil(unsigned short *, size_t, int, unsigned int)';
'profil(unsigned short *, unsigned int, unsigned int, unsigned int);';
};
-
-/*
- * 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
"#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
* function 'getrnge' in <regexp.h> before they declare it. For these
"{}";
};
-
-/*
- * 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
"\tstrlen(), strspn();";
};
-
/*
* Fix return type of calloc, malloc, realloc, bsearch and exit
*/
"extern char*\tbsearch(void*,size_t,size_t);\n";
};
-
/*
* __thread is now a keyword.
*/
fix = {
hackname = thread_keyword;
files = "pthread.h";
- files = "bits/sigthread.h";
+ files = bits/sigthread.h, '*/bits/sigthread.h';
select = "([* ])__thread([,)])";
c_fix = format;
c_fix_arg = "%1__thr%2";
test_text = "#ifdef _cplusplus\nint bogus;\n#endif";
};
-
-/*
- * 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.
*/
"extern int scanf( char *__format, ...);\n";
};
-
/*
* parameters not const on DECstation Ultrix V4.0 and OSF/1.
*/
"extern char *tempnam(char*,char*);\n";
};
-
-/*
- * 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 definitions of macros used by va-i960.h in VxWorks header file.
*/
fix = {
- hackname = ultrix_fix_fixproto;
- files = sys/utsname.h;
- select = ULTRIX;
+ hackname = va_i960_macro;
+ files = arch/i960/archI960.h;
+ select = "__(vsiz|vali|vpad|alignof__)";
c_fix = format;
- c_fix_arg = "struct utsname;\n%0";
- c_fix_arg = "^[ \t]*extern[ \t]*int[ \t]*uname\\(\\);";
+ c_fix_arg = "__vx%1";
test_text =
- "/* ULTRIX's uname */\nextern\tint\tuname();";
+ "extern int __vsiz vsiz;\n"
+ "extern int __vali vali;\n"
+ "extern int __vpad vpad;\n"
+ "#define __alignof__(x) ...";
};
-
/*
- * Check for bad #ifdef line (in Ultrix 4.1)
+ * On VMS, add missing braces around sigset_t constants.
*/
fix = {
- hackname = ultrix_ifdef;
- select = "^#ifdef KERNEL[ \t]+&&";
- files = sys/file.h;
-
+ hackname = vms_add_missing_braces;
+ select = "(_SIG_[A-Z]+_SET[ \t]+= \\{)(0x[0F]+, 0x[0F]+)";
+ mach = "*-*-*vms*";
+ files = "rtldef/signal.h";
c_fix = format;
- c_fix_arg = "#if defined(KERNEL) &&";
-
- test_text =
- "#ifdef KERNEL\t&& defined( mumbojumbo )\nint oops;\n#endif";
-};
+ c_fix_arg = '%1 {%2} ';
-/*
- * 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";
+ test_text = "static const __sigset_t _SIG_EMPTY_SET = "
+ "{0x00000000, 0x00000000},\n"
+ " _SIG_FULL_SET = {0xFFFFFFFF, 0xFFFFFFFF};\n";
};
-
/*
- * Strip "|| CC$gfloat" from Ultrix math headers.
+ * On VMS, some DEC-C builtins are directly used.
*/
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";
+ hackname = vms_decc_builtin;
+ select = "(__MEMSET|__MEMMOVE|__MEMCPY|__STRLEN|__STRCPY)";
+ mach = "*-*-*vms*";
+ files = rtldef/string.h, rtldef/time.h, rtldef/strings.h,
+ rtldef/socket.h;
+ sed = "s@__MEMSET@memset@";
+ sed = "s@__MEMMOVE@memmove@";
+ sed = "s@__MEMCPY@memcpy@";
+ sed = "s@__STRLEN@strlen@";
+ sed = "s@__STRCPY@strcpy@";
- test_text = '#if defined(__GFLOAT) || CC\$gfloat';
+ test_text = "define FD_ZERO(__p) __MEMSET((__p), 0, sizeof(*(__p)))\n";
};
-
/*
- * Avoid nested comments on Ultrix 4.3.
+ * Define __CAN_USE_EXTERN_PREFIX on vms.
*/
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";
-};
+ hackname = vms_define_can_use_extern_prefix;
+ files = "rtldef/decc$types.h";
+ select = "#[ \t]*else\n"
+ "#[ \t]*if defined\\(__DECCXX\\)\n"
+ "#[ \t]*define __CAN_USE_EXTERN_PREFIX 1\n";
+ mach = "*-*-*vms*";
+ c_fix = format;
+ c_fix_arg = "%0"
+ "# elif defined (__GNUC__)\n"
+ "#\tdefine __CAN_USE_EXTERN_PREFIX 1\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";
+ test_text = "# else\n"
+ "# if defined(__DECCXX)\n"
+ "#\tdefine __CAN_USE_EXTERN_PREFIX 1\n"
+ "# endif\n"
+ "# endif\n";
};
-
/*
- * Add missing prototype for lstat and define for S_ISLNK
- * in Ultrix V4.3 sys/stat.h.
+ * On VMS, disable the use of dec-c string builtins
*/
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 */";
-};
+ hackname = vms_disable_decc_string_builtins;
+ select = "#if !defined\\(__VAX\\)\n";
+ mach = "*-*-*vms*";
+ files = "rtldef/string.h";
+ c_fix = format;
+ c_fix_arg = "#if !defined(__VAX) && !defined(__GNUC__)\n";
-/*
- * 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";
+ test_text = "#if !defined(__VAX)\n";
};
-
/*
- * Add missing declarations to Ultrix V4.3 stdlib.h.
+ * On VMS, fix incompatible redeclaration of hostalias.
*/
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";
-};
+ hackname = vms_do_not_redeclare_hostalias;
+ select = "(void[ \t]+fp_nquery \\(const u_char \\*, int, FILE \\*\\);)\n"
+ "(__char_ptr32[ \t]+hostalias \\(const char \\*\\);)";
+ mach = "*-*-*vms*";
+ files = "rtldef/resolv.h";
+ c_fix = format;
+ c_fix_arg = "%1\n"
+ "/* %2 */";
-/*
- * 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";
+ test_text = "void fp_nquery (const u_char *, int, FILE *);\n"
+ "__char_ptr32 hostalias (const char *);\n";
};
-
/*
- * Add missing declarations to Ultrix V4.3 strings.h.
+ * On VMS, forward declare structure before referencing them in prototypes.
*/
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";
+ hackname = vms_forward_declare_struct;
+ select = "(/\\* forward decls for C\\+\\+ \\*/\n)"
+ "#ifdef __cplusplus\n";
+ mach = "*-*-*vms*";
+ files = rtldef/if.h;
+ c_fix = format;
- sed = "/^.*strncmp();.*/a\\\n"
- "extern int\\\n"
- "\tstrcasecmp(),\\\n"
- "\tstrncasecmp();\n";
+ c_fix_arg = "%1"
+ "#if defined (__cplusplus) || defined (__GNUC__)\n";
- test_text =
- "@(#)strings.h 6.1 (ULTRIX)\n"
- "\tstrncmp( const char *__s1, const char *__s2, size_t __n );\n"
- "\tstrncmp();\n";
+ test_text = "/* forward decls for C++ */\n"
+ "#ifdef __cplusplus\n"
+ "struct foo;\n"
+ "#endif\n";
};
-
/*
- * Add missing declarations to Ultrix V4.3 sys/time.h.
+ * On VMS, do not declare getopt and al if pointers are 64 bit.
*/
fix = {
- hackname = ultrix_sys_time;
- files = sys/time.h;
- select = "@\\(#\\)time\\.h.*6\\.1.*\\(ULTRIX\\)";
+ hackname = vms_no_64bit_getopt;
+ select = "^[ \t]*(extern[ \t]*)?(int[ \t]*(getopt|optind|opterr|optopt)"
+ "|(char \\*optarg))([ \t]*\\(.*\\))?;\n";
+ mach = "*-*-*vms*";
+ files = rtldef/stdio.h, rtldef/unistd.h;
+ c_fix = format;
- 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";
+ c_fix_arg = <<- _EOArg_
+ #if __INITIAL_POINTER_SIZE != 64 /* getopt is short ptr only. */
+ %0#endif
- 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";
+ _EOArg_;
- test_text =
- "@(#)time.h 6.1 (ULTRIX)\n"
- "extern time_t time( time_t *__tloc );\n"
- "extern double difftime();\n";
+ test_text = "int getopt (int, char * const [], const char *);";
};
-
/*
- * Add missing declarations to Ultrix V4.3 unistd.h.
+ * On VMS, force the use of fast setjmp, as the normal setjmp uses conditions
+ * which is not yet fully supported by gcc.
*/
fix = {
- hackname = ultrix_unistd;
- files = unistd.h;
- select = "@\\(#\\)unistd\\.h.*6\\.1.*\\(ULTRIX\\)";
-
- sed = "/^[ \t]*getgroups(),.*$/a\\\n"
- "\tgetpagesize(),\n";
+ hackname = vms_use_fast_setjmp;
+ select = "(#[ \t]*if[ \t]*defined\\(__FAST_SETJMP\\)[ \t]*\\|\\|)";
+ mach = "*-*-*vms*";
+ files = rtldef/setjmp.h;
+ c_fix = format;
- sed = "/^[ \t]*fork(),.*$/a\\\n"
- "\tvfork(),\n";
+ c_fix_arg = "%0 defined (__GNUC__) ||";
- test_text =
- "@(#)unistd.h 6.1 (ULTRIX)\n"
- "\tgetgroups(),\n"
- "\tfork(),\n";
+ test_text = "# if defined(__FAST_SETJMP) || defined(__UNIX_SETJMP)";
};
-
/*
- * On Cray Unicos/Mk some standard headers use the C99 keyword "restrict"
- * which must be replaced by __restrict__ for GCC.
+ * On VMS, use pragma extern_model instead of VAX-C keywords.
*/
fix = {
- hackname = unicosmk_restrict;
- files = stdio.h;
- files = stdlib.h;
- files = wchar.h;
- mach = "*-*-unicosmk*";
- select = "(\\*[ \t]*)restrict([ \t]+)";
-
+ hackname = vms_use_pragma_extern_model;
+ select = "#if defined\\(__DECC\\) \\|\\| defined\\(__DECCXX\\)\n"
+ "# pragma extern_model __save\n";
+ mach = "*-*-*vms*";
c_fix = format;
- c_fix_arg = "%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\\).*;";
+ c_fix_arg = "#if defined(__DECC) || defined(__DECCXX) || defined(__GNUC__)\n"
+ "# pragma extern_model __save\n";
- 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`";
+ test_text = "#if defined(__DECC) || defined(__DECCXX)\n"
+ "# pragma extern_model __save\n"
+ "# pragma extern_model strict_refdef\n"
+ " extern struct x zz$yy;\n"
+ "# pragma extern_model __restore\n"
+ "#endif\n";
};
-
/*
- * Fix definitions of macros used by va-i960.h in VxWorks header file.
+ * On VMS, change <resource.h> to <sys/resource.h> to avoid a
+ * conflict while building gcc. Likewise for <builtins.h>
*/
fix = {
- hackname = va_i960_macro;
- files = arch/i960/archI960.h;
- select = "__(vsiz|vali|vpad|alignof__)";
-
+ hackname = vms_use_quoted_include;
+ select = "(#[ \t]*include[ \t]+)<(resource|builtins)\\.h>";
+ mach = "*-*-*vms*";
+ files = rtldef/wait.h, starlet_c/pthread.h;
c_fix = format;
- c_fix_arg = "__vx%1";
- test_text =
- "extern int __vsiz vsiz;\n"
- "extern int __vali vali;\n"
- "extern int __vpad vpad;\n"
- "#define __alignof__(x) ...";
-};
+ c_fix_arg = '%1<sys/%2.h>';
+ test_text = "# include <resource.h>";
+};
/*
* AIX and Interix headers define NULL to be cast to a void pointer,
*/
fix = {
hackname = void_null;
- files = curses.h;
- files = dbm.h;
- files = locale.h;
- files = stdio.h;
- files = stdlib.h;
- files = string.h;
- files = time.h;
- files = unistd.h;
- files = sys/dir.h;
- files = sys/param.h;
- files = sys/types.h;
+ files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h,
+ time.h, unistd.h, sys/dir.h, sys/param.h, sys/types.h;
/* avoid changing C++ friendly NULL */
bypass = __cplusplus;
+ bypass = __null;
select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
c_fix = format;
- c_fix_arg = "#define NULL 0";
+ c_fix_arg = <<- _EOFix_
+ #ifndef NULL
+ #ifdef __cplusplus
+ #ifdef __GNUG__
+ #define NULL __null
+ #else /* ! __GNUG__ */
+ #define NULL 0L
+ #endif /* __GNUG__ */
+ #else /* ! __cplusplus */
+ #define NULL ((void *)0)
+ #endif /* __cplusplus */
+ #endif /* !NULL */
+ _EOFix_;
test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
};
-
/*
* Make VxWorks header which is almost gcc ready fully gcc ready.
*/
"#endif /* __GNUC_TYPEOF_FEATURE_BROKEN_USE_DEFAULT_UNTIL_FIXED__ */\n";
};
+/*
+ * Wrap VxWorks ioctl to keep everything pretty
+ */
+fix = {
+ hackname = vxworks_ioctl_macro;
+ files = ioLib.h;
+ mach = "*-*-vxworks*";
+
+ c_fix = format;
+ c_fix_arg = "%0\n"
+ "#define ioctl(fd, func, arg) (ioctl)(fd, func, (int)(arg))\n";
+ c_fix_arg = "extern[\t ]+int[\t ]+ioctl[\t ]*\\([\t ,[:alnum:]]*\\);";
+
+ test_text = "extern int ioctl ( int asdf1234, int jkl , int qwerty ) ;";
+};
+
+/*
+ * Wrap VxWorks mkdir to be posix compliant
+ */
+fix = {
+ hackname = vxworks_mkdir_macro;
+ files = sys/stat.h;
+ mach = "*-*-vxworks*";
+
+ c_fix = format;
+ c_fix_arg = "%0\n"
+ "#define mkdir(dir, ...) ((void)0, ##__VA_ARGS__, (mkdir)(dir))\n";
+ c_fix_arg = "extern[\t ]+STATUS[\t ]+mkdir[\t ]*"
+ "\\([\t ]*const[\t ]+char[\t ]*\\*[\t ]*" /* arg type */
+ "(|[_[:alpha:]][_[:alnum:]]*)" /* arg name (optional) */
+ "\\)[\t ]*;";
+
+ test_text = "extern STATUS mkdir (const char * _qwerty) ;";
+};
/*
* Fix VxWorks <time.h> to not require including <vxTypes.h>.
test_text = "uint_t\t_clocks_per_sec;";
};
-
/*
* Fix VxWorks <sys/stat.h> to not require including <vxWorks.h>.
*/
"# define\t__INCstath <sys/stat.h>";
};
+/*
+ * Make it so VxWorks does not include gcc/regs.h accidentally
+ */
+fix = {
+ hackname = vxworks_regs;
+ mach = "*-*-vxworks*";
+
+ select = "#[\t ]*include[\t ]+[<\"]regs.h[>\"]";
+ c_fix = format;
+ c_fix_arg = "#include <arch/../regs.h>";
+
+ test_text = "#include <regs.h>\n";
+};
/*
* Another bad dependency in VxWorks 5.2 <time.h>.
"#define VOIDFUNCPTR (void(*)())";
};
-
-/*
- * 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"
+ * This hack makes write const-correct on VxWorks
*/
fix = {
- select = '(#include.*)diab/va_list.h';
- hackname = windiss_valist;
- sed = "s|diab/va_list.h|stdarg.h|";
- mach = "*-*-windiss";
+ hackname = vxworks_write_const;
+ files = ioLib.h;
+ mach = "*-*-vxworks*";
+
+ c_fix = format;
+ c_fix_arg = "extern int write (int, const char*, size_t);";
+ c_fix_arg = "extern[\t ]+int[\t ]+write[\t ]*\\("
+ "[\t ]*int[\t ]*,"
+ "[\t ]*char[\t ]*\\*[\t ]*,"
+ "[\t ]*size_t[\t ]*\\)[\t ]*;";
- test_text = "#include <diab/va_list.h>";
+ test_text = "extern int write ( int , char * , size_t ) ;";
};
/*
"} mumble;\n";
};
-
/*
* class in Xm/BaseClassI.h
*/
test_text = "extern mumble (int class);\n";
};
-
/*
* new in Xm/Traversal.h
*/
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 );";
};
-
/*
* Incorrect sprintf declaration in X11/Xmu.h
*/
test_text = "extern char *\tsprintf();";
};
-
/*EOF*/