diff fixincludes/inclhack.def @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children f6334be47118
line wrap: on
line diff
--- a/fixincludes/inclhack.def	Fri Feb 12 23:41:23 2010 +0900
+++ b/fixincludes/inclhack.def	Mon May 24 12:47:05 2010 +0900
@@ -391,7 +391,7 @@
 fix = {
     hackname  = aix_stdint_1;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    files     = stdint-aix.h, stdint.h;
     select    = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n"
 		"#define[ \t]UINT16_MAX[ \t]\\(65535U\\)";
     c_fix     = format;
@@ -405,7 +405,7 @@
 fix = {
     hackname  = aix_stdint_2;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    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"
@@ -434,7 +434,7 @@
 fix = {
     hackname  = aix_stdint_3;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    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"
@@ -457,7 +457,7 @@
 fix = {
     hackname  = aix_stdint_4;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    files     = stdint-aix.h, stdint.h;
     select    = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n"
 		"#else\n"
 		"#define[ \t]SIZE_MAX[ \t]*UINT32_MAX";
@@ -474,7 +474,7 @@
 fix = {
     hackname  = aix_stdint_5;
     mach      = "*-*-aix*";
-    files     = stdint.h;
+    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;
@@ -607,7 +607,7 @@
 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 '
@@ -794,27 +794,6 @@
 
 
 /*
- *  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.
  *  HP/UX 10.20 also has it in curses_colr/curses.h.
@@ -1144,7 +1123,7 @@
 fix = {
     hackname  = darwin_stdint_1;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    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"
@@ -1161,7 +1140,7 @@
 fix = {
     hackname  = darwin_stdint_2;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define INTPTR_MAX 9223372036854775807L\n"
@@ -1193,7 +1172,7 @@
 fix = {
     hackname  = darwin_stdint_3;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define UINTPTR_MAX 18446744073709551615UL\n"
@@ -1219,7 +1198,7 @@
 fix = {
     hackname  = darwin_stdint_4;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define SIZE_MAX 18446744073709551615UL\n"
@@ -1246,7 +1225,7 @@
 fix = {
     hackname  = darwin_stdint_5;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define INTMAX_MIN   (-9223372036854775807L - 1)\n"
@@ -1275,7 +1254,7 @@
 fix = {
     hackname  = darwin_stdint_6;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define PTRDIFF_MIN (-9223372036854775807L - 1)\n"
@@ -1308,7 +1287,7 @@
 fix = {
     hackname  = darwin_stdint_7;
     mach      = "*-*-darwin*";
-    files     = stdint.h;
+    files     = stdint-darwin.h, stdint.h;
     c_fix     = format;
     c_fix_arg = "#if __WORDSIZE == 64\n"
 		"#define INTMAX_C(v)  (v ## L)\n"
@@ -1598,6 +1577,28 @@
 };
 
 
+/* Some versions of glibc have a version of bits/string2.h that
+   produces "value computed is not used" warnings from strncpy; fix
+   this definition by using __builtin_strncpy instead as in newer
+   versions.  */
+fix = {
+    hackname  = glibc_strncpy;
+    files     = bits/string2.h;
+    bypass    = "__builtin_strncpy";
+    c_fix     = format;
+    c_fix_arg = "#  define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)";
+    c_fix_arg = "#  define strncpy([^\n]*\\\\\n)*[^\n]*";
+    test_text = <<-EOT
+	#  define strncpy(dest, src, n) \
+	  (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n)      \\
+			  ? (strlen (src) + 1 >= ((size_t) (n))			      \\
+			     ? (char *) memcpy (dest, src, n)			      \\
+			     : strncpy (dest, src, n))				      \\
+			  : strncpy (dest, src, n)))
+	EOT;
+
+};
+
 /* glibc's tgmath.h relies on an expression that is not an integer
    constant expression being treated as it was by GCC 4.4 and
    earlier.  */
@@ -2158,7 +2159,7 @@
 fix = {
     hackname  = hpux_c99_intptr;
     mach      = "*-hp-hpux11.3*";
-    files     = stdint.h;
+    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)@";
@@ -2181,7 +2182,7 @@
     hackname  = hpux_c99_inttypes;
     mach      = "*-hp-hpux11.[23]*";
     files     = inttypes.h;
-    files     = stdint.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)@";
@@ -2195,7 +2196,7 @@
 fix = {
     hackname  = hpux_c99_inttypes2;
     mach      = "*-hp-hpux11.2*";
-    files     = stdint.h;
+    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)@";
@@ -2209,7 +2210,7 @@
 fix = {
     hackname  = hpux_stdint_least_fast;
     mach      = "*-hp-hpux11.2*";
-    files     = stdint.h;
+    files     = stdint-hpux11.h, stdint.h;
     select    =
         "^[ \t]*#[ \t]*define[ \t]+UINT_(LEAST|FAST)64_MAX[ \t]+ULLONG_MAX";
     c_fix     = format;
@@ -2511,7 +2512,7 @@
  *  otherwise.
  */
 fix = {
-    hackname  = irix_stdint_c99;
+    hackname  = irix_stdint_c99_mode;
     files     = stdint.h;
     select = "(#ifndef __c99\n)(#error This header file is to be used only for c99 mode compilations)";
 
@@ -2525,6 +2526,87 @@
 
 
 /*
+ *  IRIX 6.5 <stdint.h> has some *_MIN/MAX constants whose types don't
+ *  match the corresponding types, as required by ISO C99.
+ */
+fix = {
+    hackname  = irix_stdint_c99_types;
+    files     = stdint-irix65.h, stdint.h;
+    mach      = "mips-sgi-irix6.5";
+    sed       = "s@^#define INT64_MIN.*(-0x7fffffffffffffff - 1)$@"
+                "#define INT64_MIN               (-0x7fffffffffffffffLL - 1)@";
+    sed       = "s@^#define INT64_MAX.*0x7fffffffffffffff$@"
+                "#define INT64_MAX               0x7fffffffffffffffLL@";
+    sed       = "s@^#define UINT32_MAX.*0xffffffff$@"
+                "#define UINT32_MAX              0xffffffffU@";
+    sed       = "s@^#define UINT64_MAX.*0xffffffffffffffff$@"
+                "#define UINT64_MAX              0xffffffffffffffffULL@";
+    sed       = "s@^#define INTPTR_MIN.*INT32_MIN$@"
+                "#define INTPTR_MIN              (-0x7fffffffL - 1)@";
+    sed       = "s@^#define INTPTR_MAX.*INT32_MAX$@"
+                "#define INTPTR_MAX              0x7fffffffL@";
+    sed       = "s@^#define UINTPTR_MAX.*UINT32_MAX$@"
+                "#define UINTPTR_MAX             0xffffffffUL@";
+    sed       = "s@^#define INTPTR_MIN.*INT64_MIN@"
+                "#define INTPTR_MIN              (-0x7fffffffffffffffL - 1)@";
+    sed       = "s@^#define INTPTR_MAX.*INT64_MAX$@"
+                "#define INTPTR_MAX              0x7fffffffffffffffL@";
+    sed       = "s@^#define UINTPTR_MAX.*UINT64_MAX$@"
+                "#define UINTPTR_MAX             0xffffffffffffffffUL@";
+    sed       = "s@^#define PTRDIFF_MIN.*INT64_MIN$@"
+                "#define PTRDIFF_MIN             (-0x7fffffffffffffffL - 1)@";
+    sed       = "s@^#define PTRDIFF_MAX.*INT64_MAX$@"
+                "#define PTRDIFF_MAX             0x7fffffffffffffffL@";
+    sed       = "s@^#define SIZE_MAX.*UINT64_MAX$@"
+                "#define SIZE_MAX                0xffffffffffffffffUL@";
+    test_text = "#define INT64_MIN               (-0x7fffffffffffffff - 1)\n"
+                "#define INT64_MAX               0x7fffffffffffffff\n"
+                "#define UINT32_MAX              0xffffffff\n"
+                "#define UINT64_MAX              0xffffffffffffffff\n"
+                "#define INTPTR_MIN              INT32_MIN\n"
+                "#define INTPTR_MAX              INT32_MAX\n"
+                "#define UINTPTR_MAX             UINT32_MAX\n"
+                "#define INTPTR_MIN              INT64_MIN\n"
+                "#define INTPTR_MAX              INT64_MAX\n"
+                "#define UINTPTR_MAX             UINT64_MAX\n"
+                "#define PTRDIFF_MIN             INT64_MIN\n"
+                "#define PTRDIFF_MAX             INT64_MAX\n"
+                "#define SIZE_MAX                UINT64_MAX";
+};
+
+
+/*
+ *  IRIX 6.5 <stdint.h> uses casts in some macros which cannot thus be used
+ *  in preprocessor tests, although ISO C99 requires this.
+ */
+fix = {
+    hackname  = irix_stdint_c99_macros;
+    files     = stdint-irix65.h, stdint.h;
+    mach      = "mips-sgi-irix6.5";
+    sed       = "s@^#define INT8_C(x).*int.*_t.*$@#define INT8_C(x)               (x)@";
+    sed       = "s@^#define INT16_C(x).*int.*_t.*$@#define INT16_C(x)              (x)@";
+    sed       = "s@^#define INT32_C(x).*int.*_t.*$@#define INT32_C(x)              (x)@";
+    sed       = "s@^#define INT64_C(x).*int.*_t.*$@#define INT64_C(x)              (x ## LL)@";
+    sed       = "s@^#define UINT8_C(x).*int.*_t.*$@#define UINT8_C(x)              (x)@";
+    sed       = "s@^#define UINT16_C(x).*int.*_t.*$@#define UINT16_C(x)             (x)@";
+    sed       = "s@^#define UINT32_C(x).*int.*_t.*$@#define UINT32_C(x)             (x ## U)@";
+    sed       = "s@^#define UINT64_C(x).*int.*_t.*$@#define UINT64_C(x)             (x ## ULL)@";
+    sed       = "s@^#define INTMAX_C(x).*int.*_t.*$@#define INTMAX_C(x)             (x ## LL)@";
+    sed       = "s@^#define UINTMAX_C(x).*int.*_t.*$@#define UINTMAX_C(x)            (x ## ULL)@";
+    test_text = "#define INT8_C(x)               (int_least8_t)(x)\n"
+                "#define INT16_C(x)              (int_least16_t)(x)\n"
+                "#define INT32_C(x)              (int_least32_t)(x)\n"
+                "#define INT64_C(x)              (int_least64_t)(x)\n"
+                "#define UINT8_C(x)              (uint_least8_t)(x)\n"
+                "#define UINT16_C(x)             (uint_least16_t)(x)\n"
+                "#define UINT32_C(x)             (uint_least32_t)(x)\n"
+                "#define UINT64_C(x)             (uint_least64_t)(x)\n"
+                "#define INTMAX_C(x)             (intmax_t)(x)\n"
+                "#define UINTMAX_C(x)            (uintmax_t)(x)";
+};
+
+
+/*
  *  IRIX 5.x's stdio.h and IRIX 6.5's internal/stdio_core.h declare
  *  some functions that take a va_list as
  *  taking char *.  However, GCC uses void * for va_list, so
@@ -2813,7 +2895,7 @@
    versions.  */
 fix = {
     hackname  = newlib_stdint_1;
-    files     = stdint.h;
+    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__@";
@@ -2849,7 +2931,7 @@
 
 fix = {
     hackname  = newlib_stdint_2;
-    files     = stdint.h;
+    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"
@@ -3258,7 +3340,7 @@
 
 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;
@@ -3268,10 +3350,11 @@
                 "\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_;
 };
 
 fix = {
@@ -3441,22 +3524,21 @@
 
 
 /*
- * Sun Solaris 10 has a version of sys/int_const.h that defines
+ * 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;
-    select    = '@\(#\)int_const.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
     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)";
-    c_fix_arg = "^#define[ \t]+UINT8_C\\(c\\)[ \t]+__CONCAT__.*\n"
+    select    = "^#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)";
@@ -3464,38 +3546,36 @@
 
 
 /*
- * Sun Solaris 10 has a version of sys/int_limits.h that defines
+ * Sun Solaris 2 has a version of sys/int_limits.h that defines
  * UINT8_MAX and UINT16_MAX to unsigned constants.
  */
 fix = {
     hackname  = solaris_int_limits_1;
-    select    = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
     files     = sys/int_limits.h;
+    mach      = '*-*-solaris2*';
     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"
+    select    = "^#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
+ * 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;
-    select    = '@\(#\)int_limits.h' "[ \t]+1.[0-9]+[ \t]+[0-9/]+ SMI";
     files     = sys/int_limits.h;
+    mach      = '*-*-solaris2*';
     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.*";
+    select    = "^#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";
@@ -3503,6 +3583,22 @@
 
 
 /*
+ * 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";
+};
+
+
+/*
  * 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.
  */