OSDN Git Service

* inclhack.def (aix_complex): New fix.
[pf3gnuchains/gcc-fork.git] / fixincludes / inclhack.def
index f77845f..82b767a 100644 (file)
@@ -356,6 +356,23 @@ fix = {
 
 
 /*
+ * 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;
+    files     = complex.h;
+    select    = "AIX xlc C99";
+
+    sed       = "s/^#define[ \t]_Complex_I[ \t]__I//";
+    sed       = "s/^#define[ \t]I[ \t]_Complex_I//";
+
+    test_text = "#define _Complex_I    __I\n"
+               "#define I _Complex_I";
+};
+
+
+/*
  *  pthread.h on AIX 4.3.3 tries to define a macro without whitspace
  *  which violates a requirement of ISO C.
  */
@@ -1023,6 +1040,193 @@ fix = {
 
 
 /*
+ * 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.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.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.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.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.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.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.h;
+    c_fix     = format;
+    c_fix_arg = "#if __WORDSIZE == 64\n"
+               "#define INTMAX_C(v)  (v ## L)\n"
+               "#define UINTMAX_C(v) (v ## UL)\n"
+               "#else\n"
+               "#define INTMAX_C(v)  (v ## LL)\n"
+               "#define UINTMAX_C(v) (v ## ULL)\n"
+               "#endif";
+    select    = "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n"
+               "#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)";
+    test_text = "#define INTMAX_C(v)  (v ## LL)\n"
+               "#define UINTMAX_C(v) (v ## ULL)";
+};
+
+
+/*
  *  Fix <c_asm.h> on Digital UNIX V4.0:
  *  It contains a prototype for a DEC C internal asm() function,
  *  clashing with gcc's asm keyword.  So protect this with __DECC.
@@ -1286,7 +1490,7 @@ fix = {
     hackname  = glibc_tgmath;
     files     = tgmath.h;
     select    = '\(\(\(type\) 0.25\) && \(\(type\) 0.25 - 1\)\)';
-    bypass    = "__floating_type \\\\\n.*__builtin_classify_type";
+    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))";
@@ -1909,7 +2113,7 @@ fix = {
 
 fix = {
     hackname  = hpux_inttype_int_least8_t;
-    mach      = "*-hp-hpux11.*";
+    mach      = "*-hp-hpux1[01].*";
     files     = sys/_inttypes.h;
     select    = "^[ \t]*typedef[ \t]*char[ \t]*int_least8_t.*";
     c_fix     = format;
@@ -1919,7 +2123,7 @@ fix = {
 
 fix = {
     hackname  = hpux_inttype_int8_t;
-    mach      = "*-hp-hpux11.*";
+    mach      = "*-hp-hpux1[01].*";
     files     = sys/_inttypes.h;
     select    = "^[ \t]*typedef[ \t]*char[ \t]*int8_t.*";
     c_fix     = format;
@@ -3167,7 +3371,91 @@ fix = {
 
 
 /*
- * Solaris 2.8 has what appears to be some gross workaround for 
+ * Sun Solaris 10 has a version of sys/int_const.h that defines
+ * UINT8_C and UINT16_C to unsigned constants.
+ */
+fix = {
+    hackname  = solaris_int_const;
+    select    = '@\(#\)int_const.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+    files     = sys/int_const.h;
+    c_fix     = format;
+    c_fix_arg = "#define\tUINT8_C(c)\t(c)\n"
+                "%1\n"
+                "#define\tUINT16_C(c)\t(c)";
+    c_fix_arg = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
+                "(/\*.*\*/)\n"
+                "#define[ \t]+UINT16_C\\(c\\)[ \t]+__CONCAT__.*";
+    test_text =
+    '#pragma ident     "@(#)int_const.h        1.5     04/09/28 SMI"'"\n"
+    "#define   UINT8_C(c)      __CONCAT__(c,u)\n"
+    "/* CSTYLED */\n"
+    "#define   UINT16_C(c)     __CONCAT__(c,u)";
+};
+
+
+/*
+ * Sun Solaris 10 has a version of sys/int_limits.h that defines
+ * UINT8_MAX and UINT16_MAX to unsigned constants.
+ */
+fix = {
+    hackname  = solaris_int_limits_1;
+    select    = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+    files     = sys/int_limits.h;
+    c_fix     = format;
+    c_fix_arg = "#define\tUINT8_MAX\t(255)\n"
+                "#define\tUINT16_MAX\t(65535)";
+    c_fix_arg = "^#define[ \t]+UINT8_MAX[ \t]+\\(255U\\)\n"
+                "#define[ \t]+UINT16_MAX[ \t]+\\(65535U\\)";
+    test_text =
+    '#pragma ident     "@(#)int_limits.h       1.9     04/09/28 SMI"'"\n"
+    "#define   UINT8_MAX       (255U)\n"
+    "#define   UINT16_MAX      (65535U)";
+};
+
+
+/*
+ * Sun Solaris 10 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;
+    select    = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
+    files     = sys/int_limits.h;
+    c_fix     = format;
+    c_fix_arg = "#define\t%1_FAST16_%2 %132_%2";
+    c_fix_arg = "^#define[ \t]+(INT|UINT)_FAST16_(MAX|MIN)[ \t](INT|UINT)16.*";
+    test_text =
+    '#pragma ident     "@(#)int_limits.h       1.9     04/09/28 SMI"'"\n"
+    "#define   INT_FAST16_MAX INT16_MAX\n"
+    "#define   UINT_FAST16_MAX UINT16_MAX\n"
+    "#define   INT_FAST16_MIN  INT16_MIN";
+};
+
+
+/*
+ * Sun Solaris up to 9 has a version of sys/int_types.h that forbids use
+ * of Standard C99 64-bit types in 32-bit mode.
+ */
+fix = {
+    hackname  = solaris_int_types;
+    select    = "__STDC__ - 0 == 0";
+    bypass    = "_LONGLONG_TYPE";
+    files     = sys/int_types.h;
+    c_fix     = format;
+    c_fix_arg =
+    "(defined(_STDC_C99) || !defined(_STRICT_STDC) || defined(__GNUC__))";
+    test_text =
+    "#if __STDC__ - 0 == 0 && !defined(_NO_LONGLONG)\n"
+    "typedef   long long               int64_t;\n"
+    "#endif\n\n"
+    "#if defined(_LP64) || (__STDC__ - 0 == 0 && !defined(_NO_LONGLONG))\n"
+    "typedef int64_t                   intmax_t;\n"
+    "#endif";
+};
+
+
+/*
+ * Sun Solaris 8 has what appears to be some gross workaround for
  * some old version of their c++ compiler.  G++ doesn't want it
  * either, but doesn't want to be tied to SunPRO version numbers.
  */