FIXINC_DEBUG = yes;
#endif
+
+/*
+ * On Mac OS 10.3.9, the 'long double' functions are available in
+ * libSystem, but are not prototyped in math.h.
+ */
+fix = {
+ hackname = AAB_darwin7_9_long_double_funcs;
+ mach = "*-*-darwin7.9*";
+ files = architecture/ppc/math.h;
+ bypass = "powl";
+ replace = <<- _EndOfHeader_
+/* This file prototypes the long double functions available on Mac OS
+ 10.3.9. */
+#ifndef __MATH__
+# undef __APPLE_CC__
+# define __APPLE_CC__ 1345
+# include_next <architecture/ppc/math.h>
+# undef __APPLE_CC__
+# define __APPLE_CC__ 1
+# ifndef __LIBMLDBL_COMPAT
+# ifdef __LONG_DOUBLE_128__
+# define __LIBMLDBL_COMPAT(sym) __asm("_" #sym "$LDBL128")
+# else
+# define __LIBMLDBL_COMPAT(sym)
+# endif /* __LONG_DOUBLE_128__ */
+# endif /* __LIBMLDBL_COMPAT */
+# ifdef __cplusplus
+ extern "C" {
+# endif
+ extern long double acosl( long double ) __LIBMLDBL_COMPAT(acosl);
+ extern long double asinl( long double ) __LIBMLDBL_COMPAT(asinl);
+ extern long double atanl( long double ) __LIBMLDBL_COMPAT(atanl);
+ extern long double atan2l( long double, long double ) __LIBMLDBL_COMPAT(atan2l);
+ extern long double cosl( long double ) __LIBMLDBL_COMPAT(cosl);
+ extern long double sinl( long double ) __LIBMLDBL_COMPAT(sinl);
+ extern long double tanl( long double ) __LIBMLDBL_COMPAT(tanl);
+ extern long double acoshl( long double ) __LIBMLDBL_COMPAT(acoshl);
+ extern long double asinhl( long double ) __LIBMLDBL_COMPAT(asinhl);
+ extern long double atanhl( long double ) __LIBMLDBL_COMPAT(atanhl);
+ extern long double coshl( long double ) __LIBMLDBL_COMPAT(coshl);
+ extern long double sinhl( long double ) __LIBMLDBL_COMPAT(sinhl);
+ extern long double tanhl( long double ) __LIBMLDBL_COMPAT(tanhl);
+ extern long double expl( long double ) __LIBMLDBL_COMPAT(expl);
+ extern long double exp2l( long double ) __LIBMLDBL_COMPAT(exp2l);
+ extern long double expm1l( long double ) __LIBMLDBL_COMPAT(expm1l);
+ extern long double logl( long double ) __LIBMLDBL_COMPAT(logl);
+ extern long double log10l( long double ) __LIBMLDBL_COMPAT(log10l);
+ extern long double log2l( long double ) __LIBMLDBL_COMPAT(log2l);
+ extern long double log1pl( long double ) __LIBMLDBL_COMPAT(log1pl);
+ extern long double logbl( long double ) __LIBMLDBL_COMPAT(logbl);
+ extern long double modfl( long double, long double * ) __LIBMLDBL_COMPAT(modfl);
+ extern long double ldexpl( long double, int ) __LIBMLDBL_COMPAT(ldexpl);
+ extern long double frexpl( long double, int * ) __LIBMLDBL_COMPAT(frexpl);
+ extern int ilogbl( long double ) __LIBMLDBL_COMPAT(ilogbl);
+ extern long double scalbnl( long double, int ) __LIBMLDBL_COMPAT(scalbnl);
+ extern long double scalblnl( long double, long int ) __LIBMLDBL_COMPAT(scalblnl);
+ extern long double fabsl( long double ) __LIBMLDBL_COMPAT(fabsl);
+ extern long double cbrtl( long double ) __LIBMLDBL_COMPAT(cbrtl);
+ extern long double hypotl( long double, long double ) __LIBMLDBL_COMPAT(hypotl);
+ extern long double powl( long double, long double ) __LIBMLDBL_COMPAT(powl);
+ extern long double sqrtl( long double ) __LIBMLDBL_COMPAT(sqrtl);
+ extern long double erfl( long double ) __LIBMLDBL_COMPAT(erfl);
+ extern long double erfcl( long double ) __LIBMLDBL_COMPAT(erfcl);
+ extern long double lgammal( long double ) __LIBMLDBL_COMPAT(lgammal);
+ extern long double tgammal( long double ) __LIBMLDBL_COMPAT(tgammal);
+ extern long double ceill( long double ) __LIBMLDBL_COMPAT(ceill);
+ extern long double floorl( long double ) __LIBMLDBL_COMPAT(floorl);
+ extern long double nearbyintl( long double ) __LIBMLDBL_COMPAT(nearbyintl);
+ extern long double rintl( long double ) __LIBMLDBL_COMPAT(rintl);
+ extern long int lrintl( long double ) __LIBMLDBL_COMPAT(lrintl);
+ extern long long int llrintl( long double ) __LIBMLDBL_COMPAT(llrintl);
+ extern long double roundl( long double ) __LIBMLDBL_COMPAT(roundl);
+ extern long int lroundl( long double ) __LIBMLDBL_COMPAT(lroundl);
+ extern long long int llroundl( long double ) __LIBMLDBL_COMPAT(llroundl);
+ extern long double truncl( long double ) __LIBMLDBL_COMPAT(truncl);
+ extern long double fmodl( long double, long double) __LIBMLDBL_COMPAT(fmodl);
+ extern long double remainderl( long double, long double ) __LIBMLDBL_COMPAT(remainderl);
+ extern long double remquol( long double, long double, int * ) __LIBMLDBL_COMPAT(remquol);
+ extern long double copysignl( long double, long double ) __LIBMLDBL_COMPAT(copysignl);
+ extern long double nanl( const char * ) __LIBMLDBL_COMPAT(nanl);
+ extern long double nextafterl( long double, long double ) __LIBMLDBL_COMPAT(nextafterl);
+ extern long double nexttowardl( long double, long double ) __LIBMLDBL_COMPAT(nexttowardl);
+ extern long double fdiml( long double, long double ) __LIBMLDBL_COMPAT(fdiml);
+ extern long double fmaxl( long double, long double ) __LIBMLDBL_COMPAT(fmaxl);
+ extern long double fminl( long double, long double ) __LIBMLDBL_COMPAT(fminl);
+ extern long double fmal( long double, long double, long double ) __LIBMLDBL_COMPAT(fmal);
+# ifdef __cplusplus
+ }
+# endif
+#endif /* __MATH__ */
+_EndOfHeader_;
+};
+
+
+/*
+ * ... and for the previous fix to be useful, you have to not use ""
+ * includes.
+ */
+fix = {
+ hackname = AAB_darwin7_9_long_double_funcs_2;
+ mach = "*-*-darwin7.9*";
+ files = math.h;
+ select = '#include[ \t]+\"';
+ c_fix = format;
+ c_fix_arg = "%1<%2.h>";
+
+ c_fix_arg = '([ \t]*#[ \t]*include[ \t]+)"([a-z0-9/]+)\.h"';
+
+ test_text = '#include "architecture/ppc/math.h"';
+};
+
+
/*
* This fixes __FD_ZERO bug for linux 2.x.y (x <= 2 && y <= some n)
*/
files = asm/posix_types.h;
mach = 'i[34567]86-*-linux*';
bypass = '} while';
+ bypass = 'x86_64';
/*
* Define _POSIX_TYPES_H_WRAPPER at the end of the wrapper, not
#if defined(__FD_ZERO) && !defined(__GLIBC__)
#undef __FD_ZERO
- # define __FD_ZERO(fdsetp) \\
- do { \\
- int __d0, __d1; \\
- __asm__ __volatile__("cld ; rep ; stosl" \\
- : "=&c" (__d0), "=&D" (__d1) \\
- : "a" (0), "0" (__FDSET_LONGS), \\
- "1" ((__fd_set *) (fdsetp)) :"memory"); \\
+ # define __FD_ZERO(fdsetp) \
+ do { \
+ int __d0, __d1; \
+ __asm__ __volatile__("cld ; rep ; stosl" \
+ : "=&c" (__d0), "=&D" (__d1) \
+ : "a" (0), "0" (__FDSET_LONGS), \
+ "1" ((__fd_set *) (fdsetp)) :"memory"); \
} while (0)
#endif
*/
fix = {
hackname = alpha___extern_prefix;
- select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n(#[ \t]*pragma[ \t]*extern_prefix.*)";
+ select = "(.*)(defined\\(__DECC\\)|def[ \t]*__DECC)[ \t]*\n"
+ "(#[ \t]*pragma[ \t]*extern_prefix.*)";
mach = "alpha*-dec-osf*";
c_fix = format;
c_fix = format;
c_fix_arg = "%0 && !defined(__PRAGMA_EXTERN_PREFIX)";
- test_text = "#if (_ISO_C_SOURCE>=19990L) && !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)";
+ test_text = "#if (_ISO_C_SOURCE>=19990L) "
+ "&& !defined(_LIBC_POLLUTION_H_) && !defined(__DECC)";
};
select = '(#define assert\(EX\).*)\(\(int\) \(EX\)\)';
c_fix = format;
c_fix_arg = "%1(EX)";
- test_text = '#define assert(EX) (((int) (EX)) ? (void)0 : __assert(#EX, __FILE__, __LINE__))';
+ test_text = '#define assert(EX) (((int) (EX)) ? (void)0 '
+ ': __assert(#EX, __FILE__, __LINE__))';
};
fix = {
hackname = alpha_pthread;
files = pthread.h;
- select = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)|def _PTHREAD_ENV_DECC)(.*))\n"
+ select = "((#[ \t]*if)([ \t]*defined[ \t]*\\(_PTHREAD_ENV_DECC\\)"
+ "|def _PTHREAD_ENV_DECC)(.*))\n"
"(#[ \t]*define _PTHREAD_USE_PTDNAM_)";
mach = "alpha*-dec-osf*";
c_fix = format;
- c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 || defined (__PRAGMA_EXTERN_PREFIX)\n%5";
+ c_fix_arg = "%2 defined (_PTHREAD_ENV_DECC)%4 "
+ "|| defined (__PRAGMA_EXTERN_PREFIX)\n%5";
- test_text = "# if defined (_PTHREAD_ENV_DECC) || defined (_PTHREAD_ENV_EPCC)\n"
+ test_text = "# if defined (_PTHREAD_ENV_DECC) "
+ "|| defined (_PTHREAD_ENV_EPCC)\n"
"# define _PTHREAD_USE_PTDNAM_\n"
"# endif\n"
"# ifdef _PTHREAD_ENV_DECC\n"
"#endif";
};
+/*
+ * Compaq Tru64 v5.1 defines all of its PTHREAD_*_INITIALIZER macros
+ * incorrectly, specifying less fields in the initializers than are
+ * 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
mach = "alpha*-dec-osf4*";
select = "#define wcstok wcstok_r";
- sed = "s@#define wcstok wcstok_r@extern wchar_t *wcstok __((wchar_t *, const wchar_t *, wchar_t **)) __asm__(\"wcstok_r\");@";
- sed = "s@#define wcsftime __wcsftime_isoc@extern size_t wcsftime __((wchar_t *, size_t, const wchar_t *, const struct tm *)) __asm__(\"__wcsftime_isoc\");@";
+ sed = "s@#define wcstok wcstok_r@"
+ "extern wchar_t *wcstok __((wchar_t *, const wchar_t *, "
+ "wchar_t **)) __asm__(\"wcstok_r\");@";
+ sed = "s@#define wcsftime __wcsftime_isoc@"
+ "extern size_t wcsftime __((wchar_t *, size_t, const wchar_t *"
+ ", const struct tm *)) __asm__(\"__wcsftime_isoc\");@";
test_text = "#define wcstok wcstok_r\n"
"#define wcsftime __wcsftime_isoc";
};
/*
* Remove `extern double cabs' declarations from math.h.
* This conflicts with C99. Discovered on AIX.
+ * IRIX 5 and IRIX 6 before 6.5.18 (where C99 support was introduced)
+ * declares cabs() to take a struct __cabs_s argument.
* SunOS4 has its cabs() declaration followed by a comment which
* terminates on the following line.
* Darwin hides its broken cabs in architecture-specific subdirs.
*/
fix = {
hackname = broken_cabs;
- files = "math.h";
- files = "architecture/ppc/math.h";
- files = "architecture/i386/math.h";
- select = '^extern[ \t]+double[ \t]+cabs';
+ files = math.h, "architecture/*/math.h";
+ select = "^extern[ \t]+double[ \t]+cabs";
- c_fix = format;
- c_fix_arg = "";
- c_fix_arg = "^extern[ \t]+double[ \t]+cabs[ \t]*\\([^\\)]*\\);";
+ sed = "s/^extern[ \t]*double[ \t]*cabs[ \t]*\([^\\\)]*\);//";
+ sed = "s/^extern[ \t]*long[ \t]*double[ \t]*cabsl[ \t]*\([^\\\)]*\);//";
test_text = "#ifdef __STDC__\n"
"extern double cabs(struct dbl_hypot);\n"
"#endif\n"
"extern double cabs ( _Complex z );\n"
"extern double cabs(); /* This is a comment\n"
- " and it ends here. */";
+ " and it ends here. */\n"
+ "extern double cabs(struct __cabs_s);\n"
+ "extern long double cabsl( struct __cabsl_s );";
};
+/*
+ * Fixup Darwin's broken check for __builtin_nanf.
+ */
+
+fix = {
+ hackname = broken_nan;
+ /*
+ * It is tempting to omit the first "files" entry. Do not.
+ * The testing machinery will take the first "files" entry as the name
+ * of a test file to play with. It would be a nuisance to have a directory
+ * with the name "*".
+ */
+ files = "architecture/ppc/math.h";
+ files = "architecture/*/math.h";
+ select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
+ bypass = "powl";
+ c_fix = format;
+ c_fix_arg = "#if 1";
+ test_text = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
+};
+
/*
* 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;
/*
+ * On darwin8 and earlier, mach-o/swap.h isn't properly guarded
+ * by 'extern "C"'. On darwin7 some mach/ headers aren't properly guarded.
+ */
+fix = {
+ hackname = darwin_externc;
+ mach = "*-*-darwin*";
+ files = mach-o/swap.h;
+ files = mach/mach_time.h;
+ files = mach/mach_traps.h;
+ files = mach/message.h;
+ files = mach/mig.h;
+ files = mach/semaphore.h;
+ bypass = "extern \"C\"";
+ bypass = "__BEGIN_DECLS";
+ c_fix = wrap;
+ c_fix_arg = "#ifdef __cplusplus\n"
+ "extern \"C\" {\n"
+ "#endif\n";
+ c_fix_arg = "#ifdef __cplusplus\n"
+ "}\n"
+ "#endif\n";
+ test_text = "extern void swap_fat_header();\n";
+};
+
+
+/*
+ * AvailabilityMacros.h on Darwin breaks with GCC 4.0, because of
+ * bad __GNUC__ tests.
+ */
+
+fix = {
+ hackname = darwin_gcc4_breakage;
+ mach = "*-*-darwin*";
+ files = AvailabilityMacros.h;
+ select = "\\(__GNUC__ >= 3\\) && \\(__GNUC_MINOR__ >= 1\\)";
+ c_fix = format;
+ c_fix_arg = "((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))";
+ test_text = "#if defined(__GNUC__) && (__GNUC__ >= 3) && "
+ "(__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?
*/
files = math.h;
/* If matherr has a prototype already, the header needs no fix. */
- bypass = 'matherr.*(struct exception|__MATH_EXCEPTION)';
+ bypass = 'matherr.*(struct exception|__MATH_EXCEPTION|[ \t]*__FP_EXCEPTION[ \t]*\*[ \t]*)';
select = matherr;
c_fix = wrap;
*/
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)';
/*
+ * 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
+ * (by design?) when __GNUC__ is set beyond 3.
+ */
+fix = {
+ hackname = freebsd_gcc4_breakage;
+ mach = "*-*-freebsd*";
+ files = sys/cdefs.h;
+ select = '^#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 \|\| __GNUC__ == 3$';
+ c_fix = format;
+ c_fix_arg = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3';
+ test_text = '#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3';
+};
+
+
+/*
+ * Some versions of glibc don't expect the C99 inline semantics.
+ */
+fix = {
+ hackname = glibc_c99_inline_1;
+ files = features.h, '*/features.h';
+ select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
+ c_fix = format;
+ c_fix_arg = "%0 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)";
+ test_text = <<-EOT
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ \
+ && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
+# define __USE_EXTERN_INLINES 1
+#endif
+EOT;
+};
+
+
+/*
+ * Similar, but a version that didn't have __NO_INLINE__
+ */
+fix = {
+ hackname = glibc_c99_inline_1a;
+ files = features.h, '*/features.h';
+ select = "(\\) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__)\n"
+ "(#[ \t]*define[ \t]*__USE_EXTERN_INLINES[ \t]*1)";
+ c_fix = format;
+ c_fix_arg = "%1 && (defined __extern_inline || defined __GNUC_GNU_INLINE__)\n%2";
+ test_text = <<-EOT
+#if __GNUC_PREREQ (2, 7) && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__
+# define __USE_EXTERN_INLINES 1
+#endif
+EOT;
+};
+
+
+/*
+ * The glibc_c99_inline_1 fix should have fixed everything. Unfortunately
+ * there are many glibc headers which do not respect __USE_EXTERN_INLINES.
+ * The remaining glibc_c99_inline_* fixes deal with some of those headers.
+ */
+fix = {
+ hackname = glibc_c99_inline_2;
+ files = sys/stat.h, '*/sys/stat.h';
+ select = "extern __inline__ int";
+ sed = "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/"
+ "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
+ "__inline__ int \\1/";
+ sed = "s/extern int __REDIRECT\\(_NTH\\|\\) (\\(stat\\|lstat\\|fstat\\)/"
+ "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
+ "__inline__ int __REDIRECT\\1 (\\2/";
+ sed = "s/^extern __inline__ int/"
+ "#ifdef __GNUC_GNU_INLINE__\\\nextern\\\n#endif\\\n"
+ "__inline__ int/";
+ test_text = <<-EOT
+ extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
+ extern __inline__ int
+ __NTH (fstat64 (int __fd, struct stat64 *__statbuf))
+ {}
+ EOT;
+};
+
+
+fix = {
+ hackname = glibc_c99_inline_3;
+ files = bits/string2.h, '*/bits/string2.h';
+ select = "extern __inline";
+ bypass = "__extern_inline|__GNU_STDC_INLINE__";
+ c_fix = format;
+ c_fix_arg = "# if defined(__cplusplus) || defined(__GNUC_STDC_INLINE__)";
+ c_fix_arg = "^# ifdef __cplusplus$";
+ test_text = <<-EOT
+ # ifdef __cplusplus
+ # define __STRING_INLINE inline
+ # else
+ # define __STRING_INLINE extern __inline
+ # endif
+ EOT;
+};
+
+
+fix = {
+ hackname = glibc_c99_inline_4;
+ files = sys/sysmacros.h, '*/sys/sysmacros.h', wchar.h, '*/wchar.h';
+ bypass = "__extern_inline|__gnu_inline__";
+ select = "(^| )extern __inline";
+ c_fix = format;
+ c_fix_arg = "%0 __attribute__ ((__gnu_inline__))";
+ test_text = <<-EOT
+ __extension__ extern __inline unsigned int
+ extern __inline unsigned int
+ EOT;
+};
+
+
+/* glibc-2.3.5 defines pthread mutex initializers incorrectly,
+ * so we replace them with versions that correspond to the
+ * definition.
+ */
+fix = {
+ hackname = glibc_mutex_init;
+ files = pthread.h;
+ select = '\{ *\{ *0, *\} *\}';
+ sed = "/define[ \t]\\+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]*\\\\/"
+ "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"
+ "# endif/";
+ sed = "s/{ \\(0, 0, 0, 0, 0, 0, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP\\) }/{ \\1, 0 }/";
+ sed = "/define[ \t]\\+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_;
+};
+
+
+/*
* Fix these files to use the types we think they should for
* ptrdiff_t, size_t, and wchar_t.
*
bypass = '_GCC_(PTRDIFF|SIZE|WCHAR)_T';
select = "^[ \t]*typedef[ \t]+.*[ \t](ptrdiff|size|wchar)_t;";
c_fix = gnu_type;
+ /* The Solaris 10 headers already define these types correctly. */
+ mach = '*-*-solaris2.1[0-9]*';
+ not_machine = true;
test_text = "typedef long int ptrdiff_t; /* long int */\n"
"typedef uint_t size_t; /* uint_t */\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
*/
*/
fix = {
hackname = hpux11_abs;
- mach = ia64-hp-hpux11*;
+ mach = "ia64-hp-hpux11*";
files = stdlib.h;
select = "ifndef _MATH_INCLUDED";
c_fix = format;
hackname = hpux8_bogus_inlines;
files = math.h;
select = inline;
+ bypass = "__GNUG__";
sed = "s@inline int abs(int [a-z][a-z]*) {.*}"
"@extern \"C\" int abs(int);@";
sed = "s@inline double abs(double [a-z][a-z]*) {.*}@@";
/*
+ * 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"
+ "(/\\*\n"
+ " \\* Macros for number representation conversion\\.\n"
+ " \\*/\n"
+ "#ifndef ntohl)";
+ c_fix = format;
+ c_fix_arg = "#if 1\n%1";
+
+ test_text = "#ifndef _XOPEN_SOURCE_EXTENDED\n"
+ "/*\n"
+ " * Macros for number representation conversion.\n"
+ " */\n"
+ "#ifndef ntohl\n"
+ "#define ntohl(x) (x)\n"
+ "#define ntohs(x) (x)\n"
+ "#define htonl(x) (x)\n"
+ "#define htons(x) (x)\n"
+ "#endif\n"
+ "#endif /* ! _XOPEN_SOURCE_EXTENDED */";
+};
+
+
+/*
* HP-UX long_double
*/
fix = {
/*
- * HPUX 10.x sys/param.h defines MAXINT which clashes with values.h
+ * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
*/
fix = {
- hackname = hpux_maxint;
- files = sys/param.h;
- files = values.h;
- select = "^#[ \t]*define[ \t]+MAXINT[ \t]";
- bypass = "^#[ \t]*ifndef[ \t]+MAXINT";
- test =
- "-n \"`egrep '#[ \t]*define[ \t]+MAXINT[ \t]' sys/param.h`\"";
+ hackname = hpux_systime;
+ files = sys/time.h;
+ select = "^extern struct sigevent;";
c_fix = format;
- c_fix_arg = "#ifndef MAXINT\n%0\n#endif";
- c_fix_arg = "^#[ \t]*define[ \t]+MAXINT[ \t].*";
+ c_fix_arg = "struct sigevent;";
- test_text = '#define MAXINT 0x7FFFFFFF';
+ test_text = 'extern struct sigevent;';
};
/*
- * Fix hpux10.20 <sys/time.h> to avoid invalid forward decl
+ * Wrap spu_info in ifdef _KERNEL. GCC cannot handle an array of unknown
+ * type and mpinfou is only defined when _KERNEL is set.
*/
fix = {
- hackname = hpux_systime;
- files = sys/time.h;
- select = "^extern struct sigevent;";
+ hackname = hpux_spu_info;
+ mach = "*-hp-hpux*";
+ files = ia64/sys/getppdp.h;
+ select = "^.*extern.*spu_info.*";
c_fix = format;
- c_fix_arg = "struct sigevent;";
+ c_fix_arg = "#ifdef _KERNEL\n%0\n#endif";
- test_text = 'extern struct sigevent;';
+ test_text = "extern union mpinfou spu_info[];";
+};
+
+fix = {
+ hackname = hpux11_extern_sendfile;
+ mach = "*-hp-hpux11.[12]*";
+ files = sys/socket.h;
+ select = "^[ \t]*extern sbsize_t sendfile.*\n.*, int\\)\\);\n";
+ c_fix = format;
+ c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
+ test_text = " extern sbsize_t sendfile __((int, int, off_t, bsize_t,\n const struct iovec *, int));\n";
+};
+
+fix = {
+ hackname = hpux11_extern_sendpath;
+ mach = "*-hp-hpux11.[12]*";
+ files = sys/socket.h;
+ select = "^[ \t]*extern sbsize_t sendpath.*\n.*, int\\)\\);\n";
+ c_fix = format;
+ c_fix_arg = "#ifndef _APP32_64BIT_OFF_T\n%0#endif\n";
+ test_text = " extern sbsize_t sendpath __((int, int, off_t, bsize_t,\n const struct iovec *, int));\n";
+};
+
+fix = {
+ hackname = hpux_extern_errno;
+ mach = "*-hp-hpux10.*";
+ mach = "*-hp-hpux11.[0-2]*";
+ files = errno.h;
+ select = "^[ \t]*extern int errno;$";
+ c_fix = format;
+ c_fix_arg = "#ifdef __cplusplus\nextern \"C\" {\n#endif\n%0\n#ifdef __cplusplus\n}\n#endif";
+ test_text = " extern int errno;\n";
+};
+
+/*
+ * 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)";
+};
+
+/*
+ * Add missing braces to pthread initializer defines.
+ */
+fix = {
+ hackname = hpux_pthread_initializers;
+ mach = "*-hp-hpux11.[0-3]*";
+ files = sys/pthread.h;
+ sed = "s@^[ \t]*1, 1, 1, 1,[ \t]*\\\\"
+ "@\t{ 1, 1, 1, 1 },\t\t\t\t\t\t\t\\\\@";
+ sed = "s@^[ \t]*1,[ \t]*\\\\"
+ "@\t{ 1, 0 }@";
+ sed = "/^[ \t]*0$/d";
+ sed = "s@__PTHREAD_MUTEX_VALID, 0"
+ "@{ __PTHREAD_MUTEX_VALID, 0 }@";
+ sed = "s@^[ \t]*0, 0, -1, 0,[ \t]*\\\\"
+ "@\t{ 0, 0, -1, 0 },\t\t\t\t\t\t\\\\@";
+ sed = "s@0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,[ \t]*\\\\"
+ "@{ 0, __LWP_MTX_VALID }, { 0, 1, 1, 1, 1 },\t\t\t\\\\@";
+ sed = "s@^[ \t]*__LWP_MTX_VALID, 0, 1, 1, 1, 1,[ \t]*\\\\"
+ "@\t{ 0, __LWP_MTX_VALID }, { 0, 1, 1, 1, 1 },\t\t\t\\\\@";
+ sed = "s@^[ \t]*0, 0[ \t]*\\\\"
+ "@\t{ 0, 0 }\t\t\t\t\t\t\t\\\\@";
+ sed = "s@__PTHREAD_COND_VALID, 0"
+ "@{ __PTHREAD_COND_VALID, 0 }@";
+ sed = "s@__LWP_COND_VALID, 0,[ \t]*\\\\"
+ "@{ __LWP_COND_VALID, 0 },\t\t\t\t\t\\\\@";
+ sed = "s@__PTHREAD_RWLOCK_VALID, 0"
+ "@{ __PTHREAD_RWLOCK_VALID, 0 }@";
+ sed = "s@__LWP_RWLOCK_VALID, 0,[ \t]*\\\\"
+ "@{ __LWP_RWLOCK_VALID, 0 },\t\t\t\t\t\\\\@";
+ sed = "s@^[ \t]*0, 0, 0, 0, 0, 0, 0[ \t]*\\\\"
+ "@\t{ 0, 0, 0, 0, 0 }, { 0, 0}\t\t\t\t\t\\\\@";
+ test_text = "#define PTHREAD_MUTEX_INITIALIZER {\t\t\t\t\t\\\\\n"
+ "\t__PTHREAD_MUTEX_VALID, 0,\t\t\t\t\t\\\\\n"
+ "\t(PTHREAD_MUTEX_DEFAULT | PTHREAD_PROCESS_PRIVATE),\t\t\\\\\n"
+ "\t__SPNLCK_INITIALIZER,\t\t\t\t\t\t\\\\\n"
+ "\t0, 0, -1, 0,\t\t\t\t\t\t\t\\\\\n"
+ "\t0, __LWP_MTX_VALID, 0, 1, 1, 1, 1,\t\t\t\t\\\\\n"
+ "\t0, 0\t\t\t\t\t\t\t\t\\\\\n"
+ "}\n";
+};
+
+/*
+ * Fix glibc definition of HUGE_VAL in terms of hex floating point constant
+ */
+fix = {
+ hackname = huge_val_hex;
+ files = bits/huge_val.h;
+ select = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
+ bypass = "__builtin_huge_val";
+
+ c_fix = format;
+ c_fix_arg = "#define HUGE_VAL (__builtin_huge_val())\n";
+
+ test_text = "# define HUGE_VAL\t(__extension__ 0x1.0p2047)";
+};
+
+
+/*
+ * Fix glibc definition of HUGE_VALF in terms of hex floating point constant
+ */
+fix = {
+ hackname = huge_valf_hex;
+ files = bits/huge_val.h;
+ select = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
+ bypass = "__builtin_huge_valf";
+
+ c_fix = format;
+ c_fix_arg = "#define HUGE_VALF (__builtin_huge_valf())\n";
+
+ test_text = "# define HUGE_VALF (__extension__ 0x1.0p255f)";
+};
+
+
+/*
+ * Fix glibc definition of HUGE_VALL in terms of hex floating point constant
+ */
+fix = {
+ hackname = huge_vall_hex;
+ files = bits/huge_val.h;
+ select = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
+ bypass = "__builtin_huge_vall";
+
+ c_fix = format;
+ c_fix_arg = "#define HUGE_VALL (__builtin_huge_vall())\n";
+
+ test_text = "# define HUGE_VALL (__extension__ 0x1.0p32767L)";
};
hackname = int_abort_free_and_exit;
files = stdlib.h;
select = "int[ \t]+(abort|free|exit)[ \t]*\\(";
+ bypass = "_CLASSIC_ANSI_TYPES";
c_fix = format;
c_fix_arg = "void\t%1(";
};
/*
+ * 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
* taking char *. However, GCC uses void * for va_list, so
fix = {
hackname = kandr_concat;
files = "sparc/asm_linkage.h";
- files = "sun3/asm_linkage.h";
- files = "sun3x/asm_linkage.h";
- files = "sun4/asm_linkage.h";
- files = "sun4c/asm_linkage.h";
- files = "sun4m/asm_linkage.h";
- files = "sun4c/debug/asm_linkage.h";
- files = "sun4m/debug/asm_linkage.h";
+ files = "sun*/asm_linkage.h";
files = "arm/as_support.h";
files = "arm/mc_type.h";
files = "arm/xcb.h";
};
-/*
- * In limits.h, put #ifndefs around things that are supposed to be defined
- * in float.h to avoid redefinition errors if float.h is included first.
- * On HP/UX this patch does not work, because on HP/UX limits.h uses
- * multi line comments and the inserted #endif winds up inside the
- * comment. Fortunately, HP/UX already uses #ifndefs in limits.h; if
- * we find a #ifndef FLT_MIN we assume that all the required #ifndefs
- * are there, and we do not add them ourselves.
- *
- * QNX Software Systems also guards the defines, but doesn't define
- * FLT_MIN. Therefore, bypass the fix for *either* guarded FLT_MIN
- * or guarded FLT_MAX.
+/* 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++.
*/
fix = {
- hackname = limits_ifndefs;
- files = "sys/limits.h";
- files = "limits.h";
- select = "^[ \t]*#[ \t]*define[ \t]+"
- "((FLT|DBL)_(MIN|MAX|DIG))[ \t].*";
- bypass = "ifndef[ \t]+FLT_(MIN|MAX)";
-
- c_fix = format;
- c_fix_arg = "#ifndef %1\n%0\n#endif";
- /* Second arg is select expression */
- test_text = " #\tdefine\tDBL_DIG \t 0 /* somthin' */";
+ hackname = linux_ia64_ucontext;
+ files = "sys/ucontext.h";
+ mach = "ia64-*-linux*";
+ select = '\(\(\(char \*\) &\(\(struct sigcontext \*\) 0\)'
+ '->sc_gr\[0\]\) - \(char \*\) 0\)';
+ c_fix = format;
+ c_fix_arg = "__builtin_offsetof \(struct sigcontext, sc_gr[0]\)";
+ test_text = "# define _SC_GR0_OFFSET\t\\\\\n"
+ "\t(((char *) &((struct sigcontext *) 0)->sc_gr[0]) - (char *) 0)\n";
};
};
#endif
-
-/*
- * Delete the '#define void int' line from curses.h on Lynx
+/*
+ * Remove header file warning from sys/time.h. Autoconf's
+ * AC_HEADER_TIME recommends to include both sys/time.h and time.h
+ * which causes warning on LynxOS. Remove the warning.
*/
fix = {
- hackname = lynx_void_int;
- files = curses.h;
- select = "#[ \t]*define[ \t]+void[ \t]+int[ \t]*";
+ hackname = lynxos_no_warning_in_sys_time_h;
+ files = sys/time.h;
+ select = "#warning[ \t]+Using <time.h> instead of <sys/time.h>";
c_fix = format;
c_fix_arg = "";
- test_text = "# define\tvoid\tint \t/* curses foiled again */";
+ test_text = "#warning Using <time.h> instead of <sys/time.h>";
};
-/*
- * Fix fcntl prototype in fcntl.h on LynxOS.
+/*
+ * Add missing declaration for putenv.
*/
fix = {
- hackname = lynxos_fcntl_proto;
- files = fcntl.h;
- select = "fcntl[ \t]*" '\(int, int, int\)';
+ hackname = lynxos_missing_putenv;
+ mach = '*-*-lynxos*';
+ files = stdlib.h;
+ bypass = 'putenv[ \t]*\\(';
+ select = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
c_fix = format;
- c_fix_arg = '%1...)';
- c_fix_arg = "(fcntl[ \t]*" '\(int, int, )int\)';
- test_text = "extern int fcntl(int, int, int);";
+ c_fix_arg = "%0\n"
+ "extern int putenv _AP((char *));";
+ c_fix_arg = "extern char \\*getenv[ \t]*_AP\\(\\(const char \\*\\)\\);";
+ test_text = "extern char *getenv _AP((const char *));";
};
* 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\+\+';
+ bypass = 'We have a problem when using C\+\+|for C\+\+, _[a-z0-9A-Z_]+_exception; for C, exception';
c_fix = wrap;
c_fix_arg = "#ifdef __cplusplus\n"
/*
- * In any case, put #ifndef .. #endif around #define HUGE_VAL in math.h.
- */
-fix = {
- hackname = math_huge_val_ifndef;
- files = math.h;
- files = math/math.h;
- select = "define[ \t]+HUGE_VAL";
-
- c_fix = format;
- c_fix_arg = "#ifndef HUGE_VAL\n%0\n#endif";
- c_fix_arg = "^[ \t]*#[ \t]*define[ \t]+HUGE_VAL[ \t].*";
-
- test_text = "# define\tHUGE_VAL 3.4e+40";
-};
-
-
-/*
* nested comment
*/
fix = {
/*
+ * Some versions of NetBSD don't expect the C99 inline semantics.
+ */
+fix = {
+ hackname = netbsd_c99_inline_1;
+ 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";
+
+ test_text = "extern __inline int\nsigaddset(sigset_t *set, int signo)\n{}";
+};
+
+
+fix = {
+ hackname = netbsd_c99_inline_2;
+ mach = "*-*-netbsd*";
+ files = signal.h;
+ select = "#define _SIGINLINE extern __inline";
+
+ c_fix = format;
+ c_fix_arg = <<- _EOArg_
+ #ifdef __GNUC_STDC_INLINE__
+ #define _SIGINLINE extern __attribute__((__gnu_inline__)) __inline
+ #else
+ %0
+ #endif
+ _EOArg_;
+
+ test_text = "#define _SIGINLINE extern __inline";
+};
+
+
+/*
* 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 = "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.
+ */
+fix = {
+ hackname = pthread_incomplete_struct_argument;
+ files = pthread.h;
+ 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
*/
fix = {
hackname = sco_math;
- files = math.h;
- files = ansi/math.h;
- files = posix/math.h;
- files = xpg4/math.h;
- files = xpg4v2/math.h;
- files = xpg4plus/math.h;
- files = ods_30_compat/math.h;
- files = oldstyle/math.h;
+ files = math.h, '*/math.h';
select = "inline double abs";
+ bypass = "__GNUG__";
sed = "/#define.*__fp_class(a) \\\\/i\\\n"
"#ifndef __GNUC__\n";
sed =
test_text = "extern int utime(const char *, struct utimbuf *);";
};
+/*
+ * Sun Solaris 10 defines several C99 math macros in terms of
+ * builtins specific to the Studio compiler, in particular not
+ * compatible with the GNU compiler.
+ */
+fix = {
+ hackname = solaris_math_1;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tHUGE_VA%1\t(__builtin_huge_va%2())";
+ c_fix_arg = "^#define[ \t]+HUGE_VA([LF]+)[ \t]+__builtin_huge_va([lf]+)";
+ test_text =
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef HUGE_VAL\n"
+ "#define HUGE_VAL __builtin_huge_val\n"
+ "#undef HUGE_VALF\n"
+ "#define HUGE_VALF __builtin_huge_valf\n"
+ "#undef HUGE_VALL\n"
+ "#define HUGE_VALL __builtin_huge_vall";
+};
+
+fix = {
+ hackname = solaris_math_2;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tINFINITY\t(__builtin_inff())";
+ c_fix_arg = "^#define[ \t]+INFINITY[ \t]+__builtin_infinity";
+ test_text =
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef INFINITY\n"
+ "#define INFINITY __builtin_infinity";
+};
+
+fix = {
+ hackname = solaris_math_3;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tNAN\t\t(__builtin_nanf(\"\"))";
+ c_fix_arg = "^#define[ \t]+NAN[ \t]+__builtin_nan";
+ test_text =
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef NAN\n"
+ "#define NAN __builtin_nan";
+};
+
+fix = {
+ hackname = solaris_math_4;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tfpclassify(x) \\\n"
+ " __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; })";
+ c_fix_arg = "^#define[ \t]+fpclassify\\(x\\)[ \t]+__builtin_fpclassify\\(x\\)";
+ test_text =
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef fpclassify\n"
+ "#define fpclassify(x) __builtin_fpclassify(x)";
+};
+
+fix = {
+ hackname = solaris_math_8;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
+ "\t\t\t ? __builtin_signbitf(x) \\\n"
+ "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
+ "\t\t\t ? __builtin_signbitl(x) \\\n"
+ "\t\t\t : __builtin_signbit(x))";
+ c_fix_arg = "^#define[ \t]+signbit\\(x\\)[ \t]+__builtin_signbit\\(x\\)";
+ test_text =
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef signbit\n"
+ "#define signbit(x) __builtin_signbit(x)";
+};
+
+fix = {
+ hackname = solaris_math_9;
+ select = '@\(#\)math_c99.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ bypass = "__GNUC__";
+ files = iso/math_c99.h;
+ c_fix = format;
+ c_fix_arg = "#define\t%1(x, y)%2__builtin_%1(x, y)";
+ c_fix_arg = "^#define[ \t]+([a-z]+)\\(x, y\\)([ \t]+)\\(\\(x\\) __builtin_[a-z]+\\(y\\)\\)";
+ test_text =
+ '#ident "@(#)math_c99.h 1.9 04/11/01 SMI"'"\n"
+ "#undef isgreater\n"
+ "#define isgreater(x, y) ((x) __builtin_isgreater(y))\n"
+ "#undef isgreaterequal\n"
+ "#define isgreaterequal(x, y) ((x) __builtin_isgreaterequal(y))\n"
+ "#undef isless\n"
+ "#define isless(x, y) ((x) __builtin_isless(y))\n"
+ "#undef islessequal\n"
+ "#define islessequal(x, y) ((x) __builtin_islessequal(y))\n"
+ "#undef islessgreater\n"
+ "#define islessgreater(x, y) ((x) __builtin_islessgreater(y))\n"
+ "#undef isunordered\n"
+ "#define isunordered(x, y) ((x) __builtin_isunordered(y))";
+};
/*
* Sun Solaris 2.5.1, 2.6 defines PTHREAD_{MUTEX|COND}_INITIALIZER
hackname = solaris_mutex_init_2;
select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
files = pthread.h;
+ /*
+ * On Solaris 10, this fix is unnecessary because upad64_t is
+ * always defined correctly regardless of the definition of the
+ * __STDC__ macro. The first "mach" pattern matches up to
+ * solaris9. The second "mach" pattern will not match any two (or
+ * more) digit solaris version, but it will match e.g. 2.5.1.
+ */
+ mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
c_fix = format;
c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
"%0\n"
"#else\n"
- "%1, {0}}%3\n"
+ "%1, {0}}%4\n"
"#endif";
- c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+\\{.*)"
+ c_fix_arg = "(^#define[ \t]+PTHREAD_(MUTEX|COND)_INITIALIZER[ \t]+"
+ "(|/\*.*\*/[ \t]*\\\\\n[ \t]*)\\{.*)"
",[ \t]*0\\}" "(|[ \t].*)$";
test_text =
'#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
"#define PTHREAD_MUTEX_INITIALIZER\t{{{0},0}, {{{0}}}, 0}\n"
"#define PTHREAD_COND_INITIALIZER\t{{{0}, 0}, 0}\t/* DEFAULTCV */\n"
- "#define PTHREAD_RWLOCK_INITIALIZER\t"
- "{0, 0, 0, {0, 0, 0}, {0, 0}, {0, 0}}";
+ "#define PTHREAD_MUTEX_INITIALIZER /* = DEFAULTMUTEX */ \\\\\n"
+ " {{0, 0, 0, DEFAULT_TYPE, _MUTEX_MAGIC}, {{{0}}}, 0}\n"
+ "#define PTHREAD_COND_INITIALIZER /* = DEFAULTCV */ \\\\\n"
+ " {{{0, 0, 0, 0}, DEFAULT_TYPE, _COND_MAGIC}, 0}";
+};
+
+
+/*
+ * Sun Solaris defines PTHREAD_RWLOCK_INITIALIZER with a "0" for some
+ * fields of the pthread_rwlock_t structure, which are of type
+ * upad64_t, which itself is typedef'd to int64_t, but with __STDC__
+ * defined (e.g. by -ansi) it is a union. So change the initializer
+ * to "{0}" instead.
+ */
+fix = {
+ hackname = solaris_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]*$";
+
+ 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}}";
+};
+
+
+/*
+ * Sun Solaris defines PTHREAD_ONCE_INIT as an array containing a
+ * structure. As such, it need two levels of brackets, but only
+ * contains one. Wrap the macro definition in an extra layer.
+ */
+fix = {
+ hackname = solaris_once_init_1;
+ select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = pthread.h;
+ mach = '*-*-solaris*';
+ c_fix = format;
+ c_fix_arg = "%1{%2}%3";
+ c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{)([^}]+)(\\})[ \t]*$";
+ test_text =
+ '#pragma ident "@(#)pthread.h 1.37 04/09/28 SMI"'"\n"
+ "#define PTHREAD_ONCE_INIT\t{0, 0, 0, PTHREAD_ONCE_NOTDONE}";
+};
+
+
+/*
+ * Sun Solaris defines PTHREAD_ONCE_INIT with a "0" for some
+ * fields of the pthread_once_t structure, which are of type
+ * upad64_t, which itself is typedef'd to int64_t, but with __STDC__
+ * defined (e.g. by -ansi) it is a union. So change the initializer
+ * to "{0}" instead. This test relies on solaris_once_init_1.
+ */
+fix = {
+ hackname = solaris_once_init_2;
+ select = '@\(#\)pthread.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+ files = pthread.h;
+ /*
+ * On Solaris 10, this fix is unnecessary because upad64_t is
+ * always defined correctly regardless of the definition of the
+ * __STDC__ macro. The first "mach" pattern matches up to
+ * solaris9. The second "mach" pattern will not match any two (or
+ * more) digit solaris version, but it will match e.g. 2.5.1.
+ */
+ mach = '*-*-solaris2.[0-9]', '*-*-solaris2.[0-9][!0-9]*';
+ c_fix = format;
+ c_fix_arg = "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
+ "%0\n"
+ "#else\n"
+ "%1{0}, {0}, {0}, {%3}%4\n"
+ "#endif";
+ c_fix_arg = "(^#define[ \t]+PTHREAD_ONCE_INIT[ \t]+\\{\\{)"
+ "(0, 0, 0, )(PTHREAD_[A-Z_]+)(\\}\\})[ \t]*$";
+ test_text =
+ '#ident "@(#)pthread.h 1.26 98/04/12 SMI"'"\n"
+ "#define PTHREAD_ONCE_INIT\t{{0, 0, 0, PTHREAD_ONCE_NOTDONE}}\n";
};
files = stdio_tag.h;
select = '__cplusplus < 54321L';
+ /* In Solaris 10, the code in stdio_tag.h is conditionalized on
+ "!defined(__GNUC__)" so we no longer need to fix it. */
+ bypass = '__GNUC__';
sed = 's/defined(__cplusplus) && (__cplusplus < 54321L)/0/';
test_text = "#if\tdefined(__cplusplus) && (__cplusplus < 54321L)";
hackname = stdio_stdarg_h;
files = stdio.h;
bypass = "include.*(stdarg\.h|machine/ansi\.h)";
+ /*
+ * On Solaris 10, this fix is unncessary; <stdio.h> includes
+ * <iso/stdio_iso.h>, which includes <sys/va_list.h>.
+ */
+ mach = '*-*-solaris2.1[0-9]*';
+ not_machine = true;
c_fix = wrap;
/*
- * Don't use or define the name va_list in stdio.h.
- * This is for ANSI and also to interoperate properly with gcc's
- * varargs.h. 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.
+ * 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.
*/
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
+ * <stdio.h> is guarded appropriately by the _XPG4 feature macro;
+ * there is therefore no need for this fix there.
+ */
+ mach = '*-*-solaris2.1[0-9]*';
+ not_machine = true;
+
+ /*
+ * Use __gnuc_va_list in arg types in place of va_list.
+ * On 386BSD use __gnuc_va_list instead of _VA_LIST_. On Tru64 UNIX V5.1A
+ * use __gnuc_va_list instead of __VA_LIST__. We're hoping the
+ * trailing parentheses and semicolon save all other systems from this.
+ * Define __not_va_list__ (something harmless and unused)
+ * instead of va_list.
+ * Don't claim to have defined va_list.
+ */
+ sed = "s@[ \t]va_list\\([ \t)]\\)@ __gnuc_va_list\\1@\n"
+ "s@(va_list)&@(__gnuc_va_list)\\&@\n"
+ "s@ _VA_LIST_));@ __gnuc_va_list));@\n"
+ "s@ __VA_LIST__));@ __gnuc_va_list));@\n"
+ "s@ va_list@ __not_va_list__@\n"
+ "s@\\*va_list@*__not_va_list__@\n"
+ "s@ __va_list)@ __gnuc_va_list)@\n"
+ "s@typedef[ \t]\\(.*\\)[ \t]va_list[ \t]*;"
+ "@typedef \\1 __not_va_list__;@\n"
+ "s@typedef[ \t]*__va_list__@typedef __gnuc_va_list@\n"
+ "s@GNUC_VA_LIST@GNUC_Va_LIST@\n"
+ "s@_VA_LIST_DEFINED@_Va_LIST_DEFINED@\n"
+ "s@_NEED___VA_LIST@_NEED___Va_LIST@\n"
+ "s@VA_LIST@DUMMY_VA_LIST@\n"
+ "s@_Va_LIST@_VA_LIST@";
+ 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
+ * 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.
+ */
+fix = {
+ hackname = stdio_va_list_clients;
files = com_err.h;
files = cps.h;
files = curses.h;
files = wchar.h;
files = curses_colr/curses.h;
bypass = '__gnuc_va_list|_BSD_VA_LIST_|__DJ_va_list|_G_va_list';
+ /* Don't fix, if we use va_list from stdarg.h, or if the use is
+ otherwise protected. */
+ bypass = 'include <stdarg\.h>|#ifdef va_start';
/*
* Use __gnuc_va_list in arg types in place of va_list.
files = rpc/clnt.h;
files = rpc/svc.h;
files = rpc/xdr.h;
+ bypass = "__cplusplus";
/*
* Select those files containing '(*name)()'.
*/
fix = {
hackname = sun_malloc;
files = malloc.h;
+ bypass = "_CLASSIC_ANSI_TYPES";
sed = "s/typedef[ \t]char \\*\tmalloc_t/typedef void \\*\tmalloc_t/g";
sed = "s/int[ \t][ \t]*free/void\tfree/g";
/*
- * Solaris math.h and floatingpoint.h define __P without protection,
- * which conflicts with the fixproto definition. The fixproto
- * definition and the Solaris definition are used the same way.
- */
-fix = {
- hackname = svr4__p;
- files = math.h;
- files = floatingpoint.h;
- select = "^#define[ \t]+__P.*";
- c_fix = format;
- c_fix_arg = "#ifndef __P\n%0\n#endif";
-
- test_text = "#define __P(a) a";
-};
-
-
-/*
* 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.
hackname = sysv68_string;
files = testing.h;
files = string.h;
+ bypass = "_CLASSIC_ANSI_TYPES";
sed = "s/extern[ \t]*int[ \t]*strlen();/extern unsigned int strlen();/";
sed = "s/extern[ \t]*int[ \t]*ffs[ \t]*(long);/extern int ffs(int);/";
fix = {
hackname = sysz_stdlib_for_sun;
files = stdlib.h;
+ bypass = "_CLASSIC_ANSI_TYPES";
select = "char[ \t]*\\*[ \t]*(calloc|malloc|realloc|bsearch)[ \t]*\\(";
c_fix = format;
/*
- * Fix multiple defines for NULL. Sometimes, we stumble into \r\n
- * terminated lines, so accommodate these. Test both ways.
- * Don't bother to reproduce the \r\n termination, as GCC has to
- * recognize \n termination anyway.
- */
-fix = {
- hackname = undefine_null;
- select = "^#[ \t]*define[ \t]+NULL[ \t]";
- bypass = "#[ \t]*(ifn|un)def[ \t]+NULL($|[ \t\r])";
-
- c_fix = format;
- c_fix_arg = "#ifndef NULL\n#define NULL%1\n#endif\n";
- c_fix_arg = "^#[ \t]*define[ \t]+NULL([^\r\n]+)[\r]*\n";
-
- test_text = "#define NULL 0UL\r\n"
- "#define NULL\t((void*)0)\n";
-};
-
-/*
* On Cray Unicos/Mk some standard headers use the C99 keyword "restrict"
* which must be replaced by __restrict__ for GCC.
*/
files = sys/dir.h;
files = sys/param.h;
files = sys/types.h;
+ /* avoid changing C++ friendly NULL */
+ bypass = __cplusplus;
select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)";
c_fix = format;
c_fix_arg = "#define NULL 0";