diff options
Diffstat (limited to 'fixincludes')
-rw-r--r-- | fixincludes/ChangeLog | 7 | ||||
-rw-r--r-- | fixincludes/fixincl.x | 112 | ||||
-rw-r--r-- | fixincludes/inclhack.def | 58 | ||||
-rw-r--r-- | fixincludes/tests/base/stdint.h | 33 |
4 files changed, 205 insertions, 5 deletions
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 68bb8e818af..f5f0c4993b0 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,10 @@ +2009-03-31 Joseph Myers <joseph@codesourcery.com> + + PR c/448 + * inclhack.def (newlib_stdint_1, newlib_stdint_2): New fixes. + * fixincl.x: Regenerate. + * tests/base/stdint.h: Update. + 2009-03-29 Joseph Myers <joseph@codesourcery.com> * tests/base/math.h, tests/base/pthread.h, tests/base/sys/wait.h: diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index fa38cb324eb..505e2e875b7 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Sunday March 29, 2009 at 01:30:25 AM UTC + * It has been AutoGen-ed Tuesday March 31, 2009 at 05:01:22 PM UTC * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Mar 29 01:30:25 UTC 2009 +/* DO NOT SVN-MERGE THIS FILE, EITHER Tue Mar 31 17:01:22 UTC 2009 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 178 fixup descriptions. + * This file contains 180 fixup descriptions. * * See README for more information. * @@ -4518,6 +4518,96 @@ static const char* apzNetbsd_Extra_SemicolonPatch[] = { /* * * * * * * * * * * * * * * * * * * * * * * * * * * + * Description of Newlib_Stdint_1 fix + */ +tSCC zNewlib_Stdint_1Name[] = + "newlib_stdint_1"; + +/* + * File name selection pattern + */ +tSCC zNewlib_Stdint_1List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +#define apzNewlib_Stdint_1Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zNewlib_Stdint_1Select0[] = + "@todo - Add support for wint_t types"; + +#define NEWLIB_STDINT_1_TEST_CT 1 +static tTestDesc aNewlib_Stdint_1Tests[] = { + { TT_EGREP, zNewlib_Stdint_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Newlib_Stdint_1 + */ +static const char* apzNewlib_Stdint_1Patch[] = { sed_cmd_z, + "-e", "s@#define INT32_MIN.*@#define INT32_MIN (-INT32_MAX - 1)@", + "-e", "s@#define INT32_MAX.*@#define INT32_MAX __INT32_MAX__@", + "-e", "s@#define UINT32_MAX.*@#define UINT32_MAX __UINT32_MAX__@", + "-e", "s@#define INT_LEAST32_MIN.*@#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1)@", + "-e", "s@#define INT_LEAST32_MAX.*@#define INT_LEAST32_MAX __INT_LEAST32_MAX__@", + "-e", "s@#define UINT_LEAST32_MAX.*@#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__@", + "-e", "s@#define INT_FAST\\([0-9]*\\)_MIN.*@#define INT_FAST\\1_MIN (-INT_FAST\\1_MAX - 1)@", + "-e", "s@#define INT_FAST\\([0-9]*\\)_MAX.*@#define INT_FAST\\1_MAX __INT_FAST\\1_MAX__@", + "-e", "s@#define UINT_FAST\\([0-9]*\\)_MAX.*@#define UINT_FAST\\1_MAX __UINT_FAST\\1_MAX__@", + "-e", "s@#define SIZE_MAX.*@#define SIZE_MAX __SIZE_MAX__@", + "-e", "s@#define PTRDIFF_MIN.*@#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)@", + "-e", "s@#define PTRDIFF_MAX.*@#define PTRDIFF_MAX __PTRDIFF_MAX__@", + "-e", "s@#define UINT8_C.*@#define UINT8_C(c) __UINT8_C(c)@", + "-e", "s@#define UINT16_C.*@#define UINT16_C(c) __UINT16_C(c)@", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Newlib_Stdint_2 fix + */ +tSCC zNewlib_Stdint_2Name[] = + "newlib_stdint_2"; + +/* + * File name selection pattern + */ +tSCC zNewlib_Stdint_2List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +#define apzNewlib_Stdint_2Machs (const char**)NULL + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zNewlib_Stdint_2Select0[] = + "@todo - Add support for wint_t types"; + +#define NEWLIB_STDINT_2_TEST_CT 1 +static tTestDesc aNewlib_Stdint_2Tests[] = { + { TT_EGREP, zNewlib_Stdint_2Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Newlib_Stdint_2 + */ +static const char* apzNewlib_Stdint_2Patch[] = { + "format", + "#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", + "/\\*\\* Macros for minimum-width integer constant expressions \\*/", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * * Description of Next_Math_Prefix fix */ tSCC zNext_Math_PrefixName[] = @@ -7235,9 +7325,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 223 +#define REGEX_COUNT 225 #define MACH_LIST_SIZE_LIMIT 181 -#define FIX_COUNT 178 +#define FIX_COUNT 180 /* * Enumerate the fixes @@ -7354,6 +7444,8 @@ typedef enum { NETBSD_C99_INLINE_1_FIXIDX, NETBSD_C99_INLINE_2_FIXIDX, NETBSD_EXTRA_SEMICOLON_FIXIDX, + NEWLIB_STDINT_1_FIXIDX, + NEWLIB_STDINT_2_FIXIDX, NEXT_MATH_PREFIX_FIXIDX, NEXT_TEMPLATE_FIXIDX, NEXT_VOLITILE_FIXIDX, @@ -7979,6 +8071,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = { NETBSD_EXTRA_SEMICOLON_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aNetbsd_Extra_SemicolonTests, apzNetbsd_Extra_SemicolonPatch, 0 }, + { zNewlib_Stdint_1Name, zNewlib_Stdint_1List, + apzNewlib_Stdint_1Machs, + NEWLIB_STDINT_1_TEST_CT, FD_MACH_ONLY, + aNewlib_Stdint_1Tests, apzNewlib_Stdint_1Patch, 0 }, + + { zNewlib_Stdint_2Name, zNewlib_Stdint_2List, + apzNewlib_Stdint_2Machs, + NEWLIB_STDINT_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aNewlib_Stdint_2Tests, apzNewlib_Stdint_2Patch, 0 }, + { zNext_Math_PrefixName, zNext_Math_PrefixList, apzNext_Math_PrefixMachs, NEXT_MATH_PREFIX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index f6dbd21738e..e1d413cc8db 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -2430,6 +2430,64 @@ fix = { }; +/* 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.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"; +}; + + +fix = { + hackname = newlib_stdint_2; + files = 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. * These conflict with the built-in functions. diff --git a/fixincludes/tests/base/stdint.h b/fixincludes/tests/base/stdint.h index 369b0120118..9ca62aea785 100644 --- a/fixincludes/tests/base/stdint.h +++ b/fixincludes/tests/base/stdint.h @@ -14,3 +14,36 @@ #error This header file is to be used only for c99 mode compilations #else #endif /* IRIX_STDINT_C99_CHECK */ + + +#if defined( NEWLIB_STDINT_1_CHECK ) +/* @todo - Add support for wint_t types. */ +#define INT32_MIN (-INT32_MAX - 1) +#define INT32_MAX __INT32_MAX__ +#define UINT32_MAX __UINT32_MAX__ +#define INT_LEAST32_MIN (-INT_LEAST32_MAX - 1) +#define INT_LEAST32_MAX __INT_LEAST32_MAX__ +#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__ +#define INT_FAST8_MIN (-INT_FAST8_MAX - 1) +#define INT_FAST8_MAX __INT_FAST8_MAX__ +#define UINT_FAST8_MAX __UINT_FAST8_MAX__ +#define SIZE_MAX __SIZE_MAX__ +#define PTRDIFF_MIN (-PTRDIFF_MAX - 1) +#define PTRDIFF_MAX __PTRDIFF_MAX__ +#define UINT8_C(c) __UINT8_C(c) +#define UINT16_C(c) __UINT16_C(c) +#endif /* NEWLIB_STDINT_1_CHECK */ + + +#if defined( NEWLIB_STDINT_2_CHECK ) +/* @todo - Add support for wint_t types. */ +#define INTMAX_MAX __INTMAX_MAX__ +#define INTMAX_MIN (-INTMAX_MAX - 1) +#define UINTMAX_MAX __UINTMAX_MAX__ +#define WCHAR_MAX __WCHAR_MAX__ +#define WCHAR_MIN __WCHAR_MIN__ +#define WINT_MAX __WINT_MAX__ +#define WINT_MIN __WINT_MIN__ + +/** Macros for minimum-width integer constant expressions */ +#endif /* NEWLIB_STDINT_2_CHECK */ |