From 0e1f6b4fc1545a3471434cbf73d26612e094e799 Mon Sep 17 00:00:00 2001 From: fxcoudert Date: Tue, 9 Jun 2009 22:09:58 +0000 Subject: [PATCH] * inclhack.def (darwin_stdint_1, darwin_stdint_2, darwin_stdint_3, darwin_stdint_4): New fixes. * tests/base/stdint.h: Adjust test results for new fixes. * fixincl.x: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148328 138bc75d-0d04-0410-961f-82ee72b054a4 --- fixincludes/ChangeLog | 7 ++ fixincludes/fixincl.x | 212 +++++++++++++++++++++++++++++++++++++++- fixincludes/inclhack.def | 102 +++++++++++++++++++ fixincludes/tests/base/stdint.h | 35 +++++++ 4 files changed, 351 insertions(+), 5 deletions(-) diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index c7305c05136..9bdd28d3641 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,10 @@ +2009-06-09 Francois-Xavier Coudert + + * inclhack.def (darwin_stdint_1, darwin_stdint_2, darwin_stdint_3, + darwin_stdint_4): New fixes. + * tests/base/stdint.h: Adjust test results for new fixes. + * fixincl.x: Regenerate. + 2009-05-29 Eric Botcazou * inclhack.def (solaris_int_const): New fix. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index cb8fc889a27..433740f3028 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 Saturday May 30, 2009 at 12:11:05 AM CEST + * It has been AutoGen-ed Monday June 8, 2009 at 08:37:38 PM CEST * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat May 30 00:11:05 CEST 2009 +/* DO NOT SVN-MERGE THIS FILE, EITHER Mon Jun 8 20:37:38 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 191 fixup descriptions. + * This file contains 195 fixup descriptions. * * See README for more information. * @@ -1787,6 +1787,184 @@ static const char* apzDarwin_Private_ExternPatch[] = { /* * * * * * * * * * * * * * * * * * * * * * * * * * * + * Description of Darwin_Stdint_1 fix + */ +tSCC zDarwin_Stdint_1Name[] = + "darwin_stdint_1"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Stdint_1List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Stdint_1Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Stdint_1Select0[] = + "#define UINT8_C\\(v\\)[ \t]+\\(v ## U\\)\n\ +#define UINT16_C\\(v\\)[ \t]+\\(v ## U\\)"; + +#define DARWIN_STDINT_1_TEST_CT 1 +static tTestDesc aDarwin_Stdint_1Tests[] = { + { TT_EGREP, zDarwin_Stdint_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Stdint_1 + */ +static const char* apzDarwin_Stdint_1Patch[] = { + "format", + "#define UINT8_C(v)\tv\n\ +#define UINT16_C(v)\tv", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Stdint_2 fix + */ +tSCC zDarwin_Stdint_2Name[] = + "darwin_stdint_2"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Stdint_2List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Stdint_2Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Stdint_2Select0[] = + "#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"; + +#define DARWIN_STDINT_2_TEST_CT 1 +static tTestDesc aDarwin_Stdint_2Tests[] = { + { TT_EGREP, zDarwin_Stdint_2Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Stdint_2 + */ +static const char* apzDarwin_Stdint_2Patch[] = { + "format", + "#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", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Stdint_3 fix + */ +tSCC zDarwin_Stdint_3Name[] = + "darwin_stdint_3"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Stdint_3List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Stdint_3Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Stdint_3Select0[] = + "#if __WORDSIZE == 64\n\ +#define UINTPTR_MAX[ \t]+UINT64_MAX\n\ +#else\n\ +#define UINTPTR_MAX[ \t]+UINT32_MAX\n\ +#endif"; + +#define DARWIN_STDINT_3_TEST_CT 1 +static tTestDesc aDarwin_Stdint_3Tests[] = { + { TT_EGREP, zDarwin_Stdint_3Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Stdint_3 + */ +static const char* apzDarwin_Stdint_3Patch[] = { + "format", + "#if __WORDSIZE == 64\n\ +#define UINTPTR_MAX 18446744073709551615UL\n\ +#else\n\ +#define UINTPTR_MAX 4294967295UL\n\ +#endif", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin_Stdint_4 fix + */ +tSCC zDarwin_Stdint_4Name[] = + "darwin_stdint_4"; + +/* + * File name selection pattern + */ +tSCC zDarwin_Stdint_4List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin_Stdint_4Machs[] = { + "*-*-darwin*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zDarwin_Stdint_4Select0[] = + "#if __WORDSIZE == 64\n\ +#define SIZE_MAX[ \t]+UINT64_MAX\n\ +#else\n\ +#define SIZE_MAX[ \t]+UINT32_MAX\n\ +#endif"; + +#define DARWIN_STDINT_4_TEST_CT 1 +static tTestDesc aDarwin_Stdint_4Tests[] = { + { TT_EGREP, zDarwin_Stdint_4Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Darwin_Stdint_4 + */ +static const char* apzDarwin_Stdint_4Patch[] = { + "format", + "#if __WORDSIZE == 64\n\ +#define SIZE_MAX 18446744073709551615UL\n\ +#else\n\ +#define SIZE_MAX 4294967295UL\n\ +#endif", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * * Description of Dec_Intern_Asm fix */ tSCC zDec_Intern_AsmName[] = @@ -7733,9 +7911,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 233 +#define REGEX_COUNT 237 #define MACH_LIST_SIZE_LIMIT 181 -#define FIX_COUNT 191 +#define FIX_COUNT 195 /* * Enumerate the fixes @@ -7783,6 +7961,10 @@ typedef enum { DARWIN_EXTERNC_FIXIDX, DARWIN_GCC4_BREAKAGE_FIXIDX, DARWIN_PRIVATE_EXTERN_FIXIDX, + DARWIN_STDINT_1_FIXIDX, + DARWIN_STDINT_2_FIXIDX, + DARWIN_STDINT_3_FIXIDX, + DARWIN_STDINT_4_FIXIDX, DEC_INTERN_ASM_FIXIDX, DJGPP_WCHAR_H_FIXIDX, ECD_CURSOR_FIXIDX, @@ -8145,6 +8327,26 @@ tFixDesc fixDescList[ FIX_COUNT ] = { DARWIN_PRIVATE_EXTERN_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aDarwin_Private_ExternTests, apzDarwin_Private_ExternPatch, 0 }, + { zDarwin_Stdint_1Name, zDarwin_Stdint_1List, + apzDarwin_Stdint_1Machs, + DARWIN_STDINT_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Stdint_1Tests, apzDarwin_Stdint_1Patch, 0 }, + + { zDarwin_Stdint_2Name, zDarwin_Stdint_2List, + apzDarwin_Stdint_2Machs, + DARWIN_STDINT_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Stdint_2Tests, apzDarwin_Stdint_2Patch, 0 }, + + { zDarwin_Stdint_3Name, zDarwin_Stdint_3List, + apzDarwin_Stdint_3Machs, + DARWIN_STDINT_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Stdint_3Tests, apzDarwin_Stdint_3Patch, 0 }, + + { zDarwin_Stdint_4Name, zDarwin_Stdint_4List, + apzDarwin_Stdint_4Machs, + DARWIN_STDINT_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin_Stdint_4Tests, apzDarwin_Stdint_4Patch, 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 cfa567f29c9..f9845cc74f5 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -1023,6 +1023,108 @@ 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"; +}; + + +/* * Fix 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. diff --git a/fixincludes/tests/base/stdint.h b/fixincludes/tests/base/stdint.h index 653c5da69e8..35039db4f2b 100644 --- a/fixincludes/tests/base/stdint.h +++ b/fixincludes/tests/base/stdint.h @@ -9,6 +9,41 @@ +#if defined( DARWIN_STDINT_1_CHECK ) +#define UINT8_C(c) __UINT8_C(c) +#define UINT16_C(c) __UINT16_C(c) +#endif /* DARWIN_STDINT_1_CHECK */ + + +#if defined( DARWIN_STDINT_2_CHECK ) +#if __WORDSIZE == 64 +#define INTPTR_MAX 9223372036854775807L +#define INTPTR_MIN (-INTPTR_MAX-1) +#else +#define INTPTR_MAX 2147483647L +#define INTPTR_MIN (-INTPTR_MAX-1) +#endif +#endif /* DARWIN_STDINT_2_CHECK */ + + +#if defined( DARWIN_STDINT_3_CHECK ) +#if __WORDSIZE == 64 +#define UINTPTR_MAX 18446744073709551615UL +#else +#define UINTPTR_MAX 4294967295UL +#endif +#endif /* DARWIN_STDINT_3_CHECK */ + + +#if defined( DARWIN_STDINT_4_CHECK ) +#if __WORDSIZE == 64 +#define SIZE_MAX __SIZE_MAX__ +#else +#define SIZE_MAX __SIZE_MAX__ +#endif +#endif /* DARWIN_STDINT_4_CHECK */ + + #if defined( GLIBC_STDINT_CHECK ) /* This file is part of the GNU C Library. */ # define UINT8_C(c) c -- 2.11.4.GIT