OSDN Git Service

2006-02-07 Andrew Haley <aph@redhat.com>
[pf3gnuchains/gcc-fork.git] / fixincludes / inclhack.def
index 447997b..e172142 100644 (file)
@@ -20,6 +20,118 @@ autogen definitions fixincl;
 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)
  */
@@ -907,6 +1019,8 @@ fix = {
 /*
  *  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.
@@ -916,7 +1030,7 @@ fix = {
     files    = "math.h";
     files    = "architecture/ppc/math.h";
     files    = "architecture/i386/math.h";
-    select   = '^extern[ \t]+double[ \t]+cabs';
+    select   = "^extern[ \t]+double[ \t]+cabs";
 
     c_fix     = format;
     c_fix_arg = "";
@@ -929,9 +1043,25 @@ fix = {
                 "#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);";
 };
 
+/*
+ * Fixup Darwin's broken check for __builtin_nanf.
+ */ 
+    
+fix = {
+    hackname  = broken_nan;
+    files     = "architecture/ppc/math.h";
+    files     = "architecture/i386/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
@@ -1571,6 +1701,54 @@ fix = {
 
 
 /*
+ *  Fix glibc definition of HUGE_VAL in terms of hex floating point constant
+ */
+fix = {
+    hackname  = huge_val_hex;
+    files     = bits/huge_val.h;
+    select    = "^#[ \t]*define[ \t]*HUGE_VAL[ \t].*0x1\\.0p.*";
+    bypass    = "__builtin_huge_val";
+
+    c_fix     = format;
+    c_fix_arg = "#define HUGE_VAL (__builtin_huge_val())\n";
+
+    test_text = "# define HUGE_VAL\t(__extension__ 0x1.0p2047)";
+};
+
+
+/*
+ *  Fix glibc definition of HUGE_VALF in terms of hex floating point constant
+ */
+fix = {
+    hackname  = huge_valf_hex;
+    files     = bits/huge_val.h;
+    select    = "^#[ \t]*define[ \t]*HUGE_VALF[ \t].*0x1\\.0p.*";
+    bypass    = "__builtin_huge_valf";
+
+    c_fix     = format;
+    c_fix_arg = "#define HUGE_VALF (__builtin_huge_valf())\n";
+
+    test_text = "#  define HUGE_VALF (__extension__ 0x1.0p255f)";
+};
+
+
+/*
+ *  Fix glibc definition of HUGE_VALL in terms of hex floating point constant
+ */
+fix = {
+    hackname  = huge_vall_hex;
+    files     = bits/huge_val.h;
+    select    = "^#[ \t]*define[ \t]*HUGE_VALL[ \t].*0x1\\.0p.*";
+    bypass    = "__builtin_huge_vall";
+
+    c_fix     = format;
+    c_fix_arg = "#define HUGE_VALL (__builtin_huge_vall())\n";
+
+    test_text = "#  define HUGE_VALL (__extension__ 0x1.0p32767L)";
+};
+
+
+/*
  *  Fix return type of abort and free
  */
 fix = {