From 94ab808c5d7f7510f8a173a2ce8f36b6026197f9 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sat, 4 Jul 2009 21:31:17 +0000 Subject: [PATCH] inclhack.def (darwin_stdint_5, [...]): New fixes. * inclhack.def (darwin_stdint_5, darwin_stdint_6, darwin_stdint_7): New fixes. * fixincl.x: Regenerate. * tests/base/stdint.h: Adjust test for new fixes. From-SVN: r149242 --- fixincludes/ChangeLog | 7 ++ fixincludes/fixincl.x | 168 +++++++++++++++++++++++++++++++- fixincludes/inclhack.def | 85 ++++++++++++++++ fixincludes/tests/base/stdint.h | 35 +++++++ 4 files changed, 290 insertions(+), 5 deletions(-) diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index bcdceab967f..35260caca66 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,10 @@ +2009-07-04 Francois-Xavier Coudert + + * inclhack.def (darwin_stdint_5, darwin_stdint_6, + darwin_stdint_7): New fixes. + * fixincl.x: Regenerate. + * tests/base/stdint.h: Adjust test for new fixes. + 2009-07-03 Eric Botcazou * inclhack.def (solaris_int_types): New fix. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index f0459b27eaf..90eb9370aef 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 Friday July 3, 2009 at 10:27:01 PM CEST + * It has been AutoGen-ed Saturday July 4, 2009 at 10:06:21 AM CEST * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Jul 3 22:27:01 CEST 2009 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Jul 4 10:06:21 CEST 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 196 fixup descriptions. + * This file contains 199 fixup descriptions. * * See README for more information. * @@ -1963,6 +1963,146 @@ static const char* apzDarwin_Stdint_4Patch[] = { #endif", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Stdint_5 fix + */ +tSCC zDarwin_Stdint_5Name[] = + "darwin_stdint_5"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Stdint_5List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Stdint_5Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Stdint_5Select0[] = + "#define INTMAX_MIN[ \t]+INT64_MIN\n\ +#define INTMAX_MAX[ \t]+INT64_MAX\n\n\ +#define UINTMAX_MAX[ \t]+UINT64_MAX"; + +#define DARWIN_STDINT_5_TEST_CT 1 +static tTestDesc aDarwin_Stdint_5Tests[] = { + { TT_EGREP, zDarwin_Stdint_5Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Stdint_5 + */ +static const char* apzDarwin_Stdint_5Patch[] = { + "format", + "#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", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Stdint_6 fix + */ +tSCC zDarwin_Stdint_6Name[] = + "darwin_stdint_6"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Stdint_6List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Stdint_6Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Stdint_6Select0[] = + "#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"; + +#define DARWIN_STDINT_6_TEST_CT 1 +static tTestDesc aDarwin_Stdint_6Tests[] = { + { TT_EGREP, zDarwin_Stdint_6Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Stdint_6 + */ +static const char* apzDarwin_Stdint_6Patch[] = { + "format", + "#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", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Stdint_7 fix + */ +tSCC zDarwin_Stdint_7Name[] = + "darwin_stdint_7"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Stdint_7List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Stdint_7Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Stdint_7Select0[] = + "#define INTMAX_C\\(v\\)[ \t]+\\(v ## LL\\)\n\ +#define UINTMAX_C\\(v\\)[ \t]+\\(v ## ULL\\)"; + +#define DARWIN_STDINT_7_TEST_CT 1 +static tTestDesc aDarwin_Stdint_7Tests[] = { + { TT_EGREP, zDarwin_Stdint_7Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Stdint_7 + */ +static const char* apzDarwin_Stdint_7Patch[] = { + "format", + "#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", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Dec_Intern_Asm fix @@ -7953,9 +8093,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 239 +#define REGEX_COUNT 242 #define MACH_LIST_SIZE_LIMIT 181 -#define FIX_COUNT 196 +#define FIX_COUNT 199 /* * Enumerate the fixes @@ -8007,6 +8147,9 @@ typedef enum { DARWIN_STDINT_2_FIXIDX, DARWIN_STDINT_3_FIXIDX, DARWIN_STDINT_4_FIXIDX, + DARWIN_STDINT_5_FIXIDX, + DARWIN_STDINT_6_FIXIDX, + DARWIN_STDINT_7_FIXIDX, DEC_INTERN_ASM_FIXIDX, DJGPP_WCHAR_H_FIXIDX, ECD_CURSOR_FIXIDX, @@ -8390,6 +8533,21 @@ tFixDesc fixDescList[ FIX_COUNT ] = { DARWIN_STDINT_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aDarwin_Stdint_4Tests, apzDarwin_Stdint_4Patch, 0 }, + { zDarwin_Stdint_5Name, zDarwin_Stdint_5List, + apzDarwin_Stdint_5Machs, + DARWIN_STDINT_5_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Stdint_5Tests, apzDarwin_Stdint_5Patch, 0 }, + + { zDarwin_Stdint_6Name, zDarwin_Stdint_6List, + apzDarwin_Stdint_6Machs, + DARWIN_STDINT_6_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Stdint_6Tests, apzDarwin_Stdint_6Patch, 0 }, + + { zDarwin_Stdint_7Name, zDarwin_Stdint_7List, + apzDarwin_Stdint_7Machs, + DARWIN_STDINT_7_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Stdint_7Tests, apzDarwin_Stdint_7Patch, 0 }, + { zDec_Intern_AsmName, zDec_Intern_AsmList, apzDec_Intern_AsmMachs, DEC_INTERN_ASM_TEST_CT, FD_MACH_ONLY, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 63485b232ec..8cb6b7ed61d 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1124,6 +1124,91 @@ fix = { }; +/* + * 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 on Digital UNIX V4.0: * It contains a prototype for a DEC C internal asm() function, diff --git a/fixincludes/tests/base/stdint.h b/fixincludes/tests/base/stdint.h index 35039db4f2b..77e77fae079 100644 --- a/fixincludes/tests/base/stdint.h +++ b/fixincludes/tests/base/stdint.h @@ -44,6 +44,41 @@ #endif /* DARWIN_STDINT_4_CHECK */ +#if defined( DARWIN_STDINT_5_CHECK ) +#if __WORDSIZE == 64 +#define INTMAX_MIN (-9223372036854775807L - 1) +#define INTMAX_MAX 9223372036854775807L +#define UINTMAX_MAX 18446744073709551615UL +#else +#define INTMAX_MIN (-9223372036854775807LL - 1) +#define INTMAX_MAX 9223372036854775807LL +#define UINTMAX_MAX 18446744073709551615ULL +#endif +#endif /* DARWIN_STDINT_5_CHECK */ + + +#if defined( DARWIN_STDINT_6_CHECK ) +#if __WORDSIZE == 64 +#define PTRDIFF_MIN (-PTRDIFF_MAX - 1) +#define PTRDIFF_MAX __PTRDIFF_MAX__ +#else +#define PTRDIFF_MIN (-PTRDIFF_MAX - 1) +#define PTRDIFF_MAX __PTRDIFF_MAX__ +#endif +#endif /* DARWIN_STDINT_6_CHECK */ + + +#if defined( DARWIN_STDINT_7_CHECK ) +#if __WORDSIZE == 64 +#define INTMAX_C(v) (v ## L) +#define UINTMAX_C(v) (v ## UL) +#else +#define INTMAX_C(v) (v ## LL) +#define UINTMAX_C(v) (v ## ULL) +#endif +#endif /* DARWIN_STDINT_7_CHECK */ + + #if defined( GLIBC_STDINT_CHECK ) /* This file is part of the GNU C Library. */ # define UINT8_C(c) c