From be274b21f72fc0ecf9dde15b0969ae505d2abb67 Mon Sep 17 00:00:00 2001 From: David Edelsohn Date: Mon, 17 Aug 2009 15:22:04 +0000 Subject: [PATCH] inclhack.def (aix_complex): Redefine _Complex_I. * inclhack.def (aix_complex): Redefine _Complex_I. Do not redefine I. * (aix_stdint_[12345]): New fixes. * fixincl.x: Regenerate. * tests/base/complex.h: Update check. * tests/base/stdint.h: Add AIX stdint.h checks. From-SVN: r150846 --- fixincludes/ChangeLog | 9 ++ fixincludes/fixincl.x | 267 +++++++++++++++++++++++++++++-- fixincludes/inclhack.def | 112 ++++++++++++- fixincludes/tests/base/complex.h | 4 +- fixincludes/tests/base/stdint.h | 39 +++++ 5 files changed, 411 insertions(+), 20 deletions(-) diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index edeb1f768af..3933f28dfd8 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,3 +1,12 @@ +2009-08-17 David Edelsohn + + * inclhack.def (aix_complex): Redefine _Complex_I. Do not + redefine I. + * (aix_stdint_[12345]): New fixes. + * fixincl.x: Regenerate. + * tests/base/complex.h: Update check. + * tests/base/stdint.h: Add AIX stdint.h checks. + 2009-08-14 Steve Ellcey * inclhack.def (hpux_imaginary_i): New fix. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index b3521e5ffde..1ee1dc06106 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 Thursday August 13, 2009 at 08:49:14 AM PDT + * It has been AutoGen-ed Sunday August 16, 2009 at 08:59:30 AM EDT * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Aug 13 08:49:14 PDT 2009 +/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Aug 16 08:59:30 EDT 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 201 fixup descriptions. + * This file contains 206 fixup descriptions. * * See README for more information. * @@ -498,13 +498,15 @@ tSCC zAix_ComplexList[] = /* * Machine/OS name selection pattern */ -#define apzAix_ComplexMachs (const char**)NULL +tSCC* apzAix_ComplexMachs[] = { + "*-*-aix*", + (const char*)NULL }; /* * content selection pattern - do fix if pattern found */ tSCC zAix_ComplexSelect0[] = - "AIX xlc C99"; + "#define[ \t]_Complex_I[ \t]__I"; #define AIX_COMPLEX_TEST_CT 1 static tTestDesc aAix_ComplexTests[] = { @@ -513,9 +515,9 @@ static tTestDesc aAix_ComplexTests[] = { /* * Fix Command Arguments for Aix_Complex */ -static const char* apzAix_ComplexPatch[] = { sed_cmd_z, - "-e", "s/^#define[ \t]_Complex_I[ \t]__I//", - "-e", "s/^#define[ \t]I[ \t]_Complex_I//", +static const char* apzAix_ComplexPatch[] = { + "format", + "#define _Complex_I (__extension__ 1.0iF)", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * @@ -555,6 +557,219 @@ static const char* apzAix_PthreadPatch[] = { "%1 %2", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Stdint_1 fix + */ +tSCC zAix_Stdint_1Name[] = + "aix_stdint_1"; + +/* + * File name selection pattern + */ +tSCC zAix_Stdint_1List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Stdint_1Machs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Stdint_1Select0[] = + "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n\ +#define[ \t]UINT16_MAX[ \t]\\(65535U\\)"; + +#define AIX_STDINT_1_TEST_CT 1 +static tTestDesc aAix_Stdint_1Tests[] = { + { TT_EGREP, zAix_Stdint_1Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Stdint_1 + */ +static const char* apzAix_Stdint_1Patch[] = { + "format", + "#define UINT8_MAX\t(255)\n\ +#define UINT16_MAX\t(65535)", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Stdint_2 fix + */ +tSCC zAix_Stdint_2Name[] = + "aix_stdint_2"; + +/* + * File name selection pattern + */ +tSCC zAix_Stdint_2List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Stdint_2Machs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Stdint_2Select0[] = + "#define[ \t]INTPTR_MIN[ \t]INT64_MIN\n\ +#define[ \t]INTPTR_MAX[ \t]INT64_MAX\n\ +#define[ \t]UINTPTR_MAX[ \t]UINT64_MAX\n\ +#else\n\ +#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n\ +#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n\ +#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX"; + +#define AIX_STDINT_2_TEST_CT 1 +static tTestDesc aAix_Stdint_2Tests[] = { + { TT_EGREP, zAix_Stdint_2Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Stdint_2 + */ +static const char* apzAix_Stdint_2Patch[] = { + "format", + "#define INTPTR_MIN\t(-INTPTR_MAX-1)\n\ +#define INTPTR_MAX\t9223372036854775807L\n\ +#define UINTPTR_MAX\t18446744073709551615UL\n\ +#else\n\ +#define INTPTR_MIN\t(-INTPTR_MAX-1)\n\ +#define INTPTR_MAX\t2147483647L\n\ +#define UINTPTR_MAX\t4294967295UL", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Stdint_3 fix + */ +tSCC zAix_Stdint_3Name[] = + "aix_stdint_3"; + +/* + * File name selection pattern + */ +tSCC zAix_Stdint_3List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Stdint_3Machs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Stdint_3Select0[] = + "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n\ +#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n\ +#else\n\ +#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n\ +#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX"; + +#define AIX_STDINT_3_TEST_CT 1 +static tTestDesc aAix_Stdint_3Tests[] = { + { TT_EGREP, zAix_Stdint_3Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Stdint_3 + */ +static const char* apzAix_Stdint_3Patch[] = { + "format", + "#define PTRDIFF_MIN\t(-9223372036854775807L - 1)\n\ +#define PTRDIFF_MAX\t9223372036854775807L\n\ +#else\n\ +#define PTRDIFF_MIN\t(-2147483647L - 1)\n\ +#define PTRDIFF_MAX\t2147483647L", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Stdint_4 fix + */ +tSCC zAix_Stdint_4Name[] = + "aix_stdint_4"; + +/* + * File name selection pattern + */ +tSCC zAix_Stdint_4List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Stdint_4Machs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Stdint_4Select0[] = + "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n\ +#else\n\ +#define[ \t]SIZE_MAX[ \t]*UINT32_MAX"; + +#define AIX_STDINT_4_TEST_CT 1 +static tTestDesc aAix_Stdint_4Tests[] = { + { TT_EGREP, zAix_Stdint_4Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Stdint_4 + */ +static const char* apzAix_Stdint_4Patch[] = { + "format", + "#define SIZE_MAX\t18446744073709551615UL\n\ +#else\n\ +#define SIZE_MAX\t4294967295UL", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Stdint_5 fix + */ +tSCC zAix_Stdint_5Name[] = + "aix_stdint_5"; + +/* + * File name selection pattern + */ +tSCC zAix_Stdint_5List[] = + "stdint.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_Stdint_5Machs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_Stdint_5Select0[] = + "#define[ \t]UINT8_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)\n\ +#define[ \t]UINT16_C\\(c\\)[ \t]__CONCAT__\\(c,U\\)"; + +#define AIX_STDINT_5_TEST_CT 1 +static tTestDesc aAix_Stdint_5Tests[] = { + { TT_EGREP, zAix_Stdint_5Select0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Stdint_5 + */ +static const char* apzAix_Stdint_5Patch[] = { + "format", + "#define UINT8_C(c)\tc\n\ +#define UINT16_C(c)\tc", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aix_Sysmachine fix @@ -8165,9 +8380,9 @@ static const char* apzX11_SprintfPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 244 +#define REGEX_COUNT 249 #define MACH_LIST_SIZE_LIMIT 181 -#define FIX_COUNT 201 +#define FIX_COUNT 206 /* * Enumerate the fixes @@ -8183,6 +8398,11 @@ typedef enum { AAB_SUN_MEMCPY_FIXIDX, AIX_COMPLEX_FIXIDX, AIX_PTHREAD_FIXIDX, + AIX_STDINT_1_FIXIDX, + AIX_STDINT_2_FIXIDX, + AIX_STDINT_3_FIXIDX, + AIX_STDINT_4_FIXIDX, + AIX_STDINT_5_FIXIDX, AIX_SYSMACHINE_FIXIDX, AIX_SYSWAIT_2_FIXIDX, AIX_VOLATILE_FIXIDX, @@ -8419,7 +8639,7 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zAix_ComplexName, zAix_ComplexList, apzAix_ComplexMachs, - AIX_COMPLEX_TEST_CT, FD_MACH_ONLY, + AIX_COMPLEX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aAix_ComplexTests, apzAix_ComplexPatch, 0 }, { zAix_PthreadName, zAix_PthreadList, @@ -8427,6 +8647,31 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AIX_PTHREAD_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aAix_PthreadTests, apzAix_PthreadPatch, 0 }, + { zAix_Stdint_1Name, zAix_Stdint_1List, + apzAix_Stdint_1Machs, + AIX_STDINT_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Stdint_1Tests, apzAix_Stdint_1Patch, 0 }, + + { zAix_Stdint_2Name, zAix_Stdint_2List, + apzAix_Stdint_2Machs, + AIX_STDINT_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Stdint_2Tests, apzAix_Stdint_2Patch, 0 }, + + { zAix_Stdint_3Name, zAix_Stdint_3List, + apzAix_Stdint_3Machs, + AIX_STDINT_3_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Stdint_3Tests, apzAix_Stdint_3Patch, 0 }, + + { zAix_Stdint_4Name, zAix_Stdint_4List, + apzAix_Stdint_4Machs, + AIX_STDINT_4_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Stdint_4Tests, apzAix_Stdint_4Patch, 0 }, + + { zAix_Stdint_5Name, zAix_Stdint_5List, + apzAix_Stdint_5Machs, + AIX_STDINT_5_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_Stdint_5Tests, apzAix_Stdint_5Patch, 0 }, + { zAix_SysmachineName, zAix_SysmachineList, apzAix_SysmachineMachs, AIX_SYSMACHINE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index ba3048661eb..96ed41c7337 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -361,14 +361,12 @@ fix = { */ fix = { hackname = aix_complex; + mach = "*-*-aix*"; 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"; + select = "#define[ \t]_Complex_I[ \t]__I"; + c_fix = format; + c_fix_arg = "#define _Complex_I (__extension__ 1.0iF)"; + test_text = "#define _Complex_I __I\n"; }; @@ -387,6 +385,106 @@ fix = { }; +/* + * AIX stdint.h fixes. + */ +fix = { + hackname = aix_stdint_1; + mach = "*-*-aix*"; + files = stdint.h; + select = "#define[ \t]UINT8_MAX[ \t]\\(255U\\)\n" + "#define[ \t]UINT16_MAX[ \t]\\(65535U\\)"; + c_fix = format; + c_fix_arg = "#define UINT8_MAX (255)\n" + "#define UINT16_MAX (65535)"; + test_text = "#define UINT8_MAX (255U)\n" + "#define UINT16_MAX (65535U)"; +}; + + +fix = { + hackname = aix_stdint_2; + mach = "*-*-aix*"; + files = 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" + "#else\n" + "#define[ \t]INTPTR_MIN[ \t]INT32_MIN\n" + "#define[ \t]INTPTR_MAX[ \t]INT32_MAX\n" + "#define[ \t]UINTPTR_MAX[ \t]UINT32_MAX"; + c_fix = format; + c_fix_arg = "#define INTPTR_MIN (-INTPTR_MAX-1)\n" + "#define INTPTR_MAX 9223372036854775807L\n" + "#define UINTPTR_MAX 18446744073709551615UL\n" + "#else\n" + "#define INTPTR_MIN (-INTPTR_MAX-1)\n" + "#define INTPTR_MAX 2147483647L\n" + "#define UINTPTR_MAX 4294967295UL"; + test_text = "#define INTPTR_MIN INT64_MIN\n" + "#define INTPTR_MAX INT64_MAX\n" + "#define UINTPTR_MAX UINT64_MAX\n" + "#else\n" + "#define INTPTR_MIN INT32_MIN\n" + "#define INTPTR_MAX INT32_MAX\n" + "#define UINTPTR_MAX UINT32_MAX"; +}; + + +fix = { + hackname = aix_stdint_3; + mach = "*-*-aix*"; + files = stdint.h; + select = "#define[ \t]PTRDIFF_MIN[ \t]INT64_MIN\n" + "#define[ \t]PTRDIFF_MAX[ \t]INT64_MAX\n" + "#else\n" + "#define[ \t]PTRDIFF_MIN[ \t]*INT32_MIN\n" + "#define[ \t]PTRDIFF_MAX[ \t]*INT32_MAX"; + c_fix = format; + c_fix_arg = "#define PTRDIFF_MIN (-9223372036854775807L - 1)\n" + "#define PTRDIFF_MAX 9223372036854775807L\n" + "#else\n" + "#define PTRDIFF_MIN (-2147483647L - 1)\n" + "#define PTRDIFF_MAX 2147483647L"; + test_text = "#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"; +}; + + +fix = { + hackname = aix_stdint_4; + mach = "*-*-aix*"; + files = stdint.h; + select = "#define[ \t]SIZE_MAX[ \t]UINT64_MAX\n" + "#else\n" + "#define[ \t]SIZE_MAX[ \t]*UINT32_MAX"; + c_fix = format; + c_fix_arg = "#define SIZE_MAX 18446744073709551615UL\n" + "#else\n" + "#define SIZE_MAX 4294967295UL"; + test_text = "#define SIZE_MAX UINT64_MAX\n" + "#else\n" + "#define SIZE_MAX UINT32_MAX"; +}; + + +fix = { + hackname = aix_stdint_5; + mach = "*-*-aix*"; + files = 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; + c_fix_arg = "#define UINT8_C(c) c\n" + "#define UINT16_C(c) c"; + test_text = "#define UINT8_C(c) __CONCAT__(c,U)\n" + "#define UINT16_C(c) __CONCAT__(c,U)"; +}; + + /* * sys/machine.h on AIX 4.3.3 puts whitespace between a \ and a newline * in an otherwise harmless (and #ifed out) macro definition diff --git a/fixincludes/tests/base/complex.h b/fixincludes/tests/base/complex.h index c1447d4f3cd..d7f2c3120f3 100644 --- a/fixincludes/tests/base/complex.h +++ b/fixincludes/tests/base/complex.h @@ -10,8 +10,8 @@ #if defined( AIX_COMPLEX_CHECK ) -# define _Complex_I (__extension__ 1.0iF) -#define I _Complex_I +#define _Complex_I (__extension__ 1.0iF) + #endif /* AIX_COMPLEX_CHECK */ diff --git a/fixincludes/tests/base/stdint.h b/fixincludes/tests/base/stdint.h index 77e77fae079..ae7b12e46d3 100644 --- a/fixincludes/tests/base/stdint.h +++ b/fixincludes/tests/base/stdint.h @@ -9,6 +9,45 @@ +#if defined( AIX_STDINT_1_CHECK ) +#define UINT8_MAX (255U) +#define UINT16_MAX (65535U) +#endif /* AIX_STDINT_1_CHECK */ + + +#if defined( AIX_STDINT_2_CHECK ) +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX +#else +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#endif /* AIX_STDINT_2_CHECK */ + + +#if defined( AIX_STDINT_3_CHECK ) +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX +#else +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#endif /* AIX_STDINT_3_CHECK */ + + +#if defined( AIX_STDINT_4_CHECK ) +#define SIZE_MAX UINT64_MAX +#else +#define SIZE_MAX UINT32_MAX +#endif /* AIX_STDINT_4_CHECK */ + + +#if defined( AIX_STDINT_5_CHECK ) +#define UINT8_C(c) __CONCAT__(c,U) +#define UINT16_C(c) __CONCAT__(c,U) +#endif /* AIX_STDINT_5_CHECK */ + + #if defined( DARWIN_STDINT_1_CHECK ) #define UINT8_C(c) __UINT8_C(c) #define UINT16_C(c) __UINT16_C(c)