diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog index 88aa56368a9d..ff84ee691fd3 100644 --- a/fixincludes/ChangeLog +++ b/fixincludes/ChangeLog @@ -1,4 +1,11 @@ -2013-01-16 Alexandre Oliva +2013-05-04 David Edelsohn + + * inclhack.def (aix_null): New. + (void_null): Update replacement definition of NULL. + * fixincl.x: Regenerate. + * tests/base/curses.h: Update for new fix. + +2013-01-16 Alexandre Oliva * inclhack.def (feraiseexcept_nosse_invalid): New. (feraiseexcept_nosse_divbyzero): Likewise. diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 29fc52abf457..871ca2910868 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 December 29, 2012 at 09:17:09 AM BRST + * It has been AutoGen-ed May 3, 2013 at 11:45:43 AM by AutoGen 5.12 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Sat Dec 29 09:17:10 BRST 2012 +/* DO NOT SVN-MERGE THIS FILE, EITHER Fri May 3 11:45:44 PDT 2013 * * 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 226 fixup descriptions. + * This file contains 227 fixup descriptions. * * See README for more information. * @@ -845,6 +845,60 @@ static const char* apzAix_Net_If_ArpPatch[] = { "typedef struct _fc_softc {", (char*)NULL }; +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Aix_Null fix + */ +tSCC zAix_NullName[] = + "aix_null"; + +/* + * File name selection pattern + */ +tSCC zAix_NullList[] = + "curses.h\0dbm.h\0locale.h\0stdio.h\0stdlib.h\0string.h\0time.h\0unistd.h\0wchar.h\0sys/dir.h\0sys/param.h\0sys/types.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzAix_NullMachs[] = { + "*-*-aix*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zAix_NullSelect0[] = + "#define[ \t]+NULL[ \t]+\\(*0L*\\)*"; + +/* + * content bypass pattern - skip fix if pattern found + */ +tSCC zAix_NullBypass0[] = + "__null"; + +#define AIX_NULL_TEST_CT 2 +static tTestDesc aAix_NullTests[] = { + { TT_NEGREP, zAix_NullBypass0, (regex_t*)NULL }, + { TT_EGREP, zAix_NullSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Aix_Null + */ +static const char* apzAix_NullPatch[] = { + "format", + "#ifndef NULL\n\ +#ifdef __cplusplus\n\ +#ifdef __GNUG__\n\ +#define NULL __null\n\ +#else /* ! __GNUG__ */\n\ +#define NULL 0L\n\ +#endif /* __GNUG__ */\n\ +#else /* ! __cplusplus */\n\ +#define NULL ((void *)0)\n\ +#endif /* __cplusplus */\n\ +#endif /* !NULL */", + (char*)NULL }; + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * Description of Aix_Once_Init_1 fix @@ -8680,7 +8734,17 @@ static tTestDesc aVoid_NullTests[] = { */ static const char* apzVoid_NullPatch[] = { "format", - "#define NULL 0", + "#ifndef NULL\n\ +#ifdef __cplusplus\n\ +#ifdef __GNUG__\n\ +#define NULL __null\n\ +#else /* ! __GNUG__ */\n\ +#define NULL 0L\n\ +#endif /* __GNUG__ */\n\ +#else /* ! __cplusplus */\n\ +#define NULL ((void *)0)\n\ +#endif /* __cplusplus */\n\ +#endif /* !NULL */", (char*)NULL }; /* * * * * * * * * * * * * * * * * * * * * * * * * * @@ -9265,9 +9329,9 @@ static const char* apzFeraiseexcept_Nosse_DivbyzeroPatch[] = { * * List of all fixes */ -#define REGEX_COUNT 264 +#define REGEX_COUNT 266 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 226 +#define FIX_COUNT 227 /* * Enumerate the fixes @@ -9288,6 +9352,7 @@ typedef enum { AIX_COMPLEX_FIXIDX, AIX_MALLOC_FIXIDX, AIX_NET_IF_ARP_FIXIDX, + AIX_NULL_FIXIDX, AIX_ONCE_INIT_1_FIXIDX, AIX_ONCE_INIT_2_FIXIDX, AIX_MUTEX_INITIALIZER_1_FIXIDX, @@ -9577,6 +9642,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { AIX_NET_IF_ARP_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, aAix_Net_If_ArpTests, apzAix_Net_If_ArpPatch, 0 }, + { zAix_NullName, zAix_NullList, + apzAix_NullMachs, + AIX_NULL_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aAix_NullTests, apzAix_NullPatch, 0 }, + { zAix_Once_Init_1Name, zAix_Once_Init_1List, apzAix_Once_Init_1Machs, AIX_ONCE_INIT_1_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 24069201d122..253df68997c2 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -616,6 +616,33 @@ fix = { test_text = "struct fc_softc {\n int a;\n};"; }; +/* + * Fix AIX definition of NULL for G++. + */ +fix = { + hackname = aix_null; + mach = "*-*-aix*"; + files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h, + time.h, unistd.h, wchar.h, sys/dir.h, sys/param.h, sys/types.h; + bypass = __null; + select = "#define[ \t]+NULL[ \t]+\\(*0L*\\)*"; + c_fix = format; + c_fix_arg = <<- _EOFix_ + #ifndef NULL + #ifdef __cplusplus + #ifdef __GNUG__ + #define NULL __null + #else /* ! __GNUG__ */ + #define NULL 0L + #endif /* __GNUG__ */ + #else /* ! __cplusplus */ + #define NULL ((void *)0) + #endif /* __cplusplus */ + #endif /* !NULL */ + _EOFix_; + test_text = "# define\tNULL \t(0L) /* typed NULL */"; +}; + /* * pthread.h on AIX defines PTHREAD_ONCE_INIT, PTHREAD_MUTEX_INITIALIZER, * PTHREAD_COND_INITIALIZER and PTHREAD_RWLOCK_INITIALIZER without enough @@ -4552,23 +4579,26 @@ fix = { */ fix = { hackname = void_null; - files = curses.h; - files = dbm.h; - files = locale.h; - files = stdio.h; - files = stdlib.h; - files = string.h; - files = time.h; - files = unistd.h; - files = sys/dir.h; - files = sys/param.h; - files = sys/types.h; + files = curses.h, dbm.h, locale.h, stdio.h, stdlib.h, string.h, + time.h, unistd.h, sys/dir.h, sys/param.h, sys/types.h; /* avoid changing C++ friendly NULL */ bypass = __cplusplus; bypass = __null; select = "^#[ \t]*define[ \t]+NULL[ \t]+\\(\\(void[ \t]*\\*\\)0\\)"; c_fix = format; - c_fix_arg = "#define NULL 0"; + c_fix_arg = <<- _EOFix_ + #ifndef NULL + #ifdef __cplusplus + #ifdef __GNUG__ + #define NULL __null + #else /* ! __GNUG__ */ + #define NULL 0L + #endif /* __GNUG__ */ + #else /* ! __cplusplus */ + #define NULL ((void *)0) + #endif /* __cplusplus */ + #endif /* !NULL */ + _EOFix_; test_text = "# define\tNULL \t((void *)0) /* typed NULL */"; }; diff --git a/fixincludes/tests/base/curses.h b/fixincludes/tests/base/curses.h index e05f8912d725..4a183be632ee 100644 --- a/fixincludes/tests/base/curses.h +++ b/fixincludes/tests/base/curses.h @@ -9,6 +9,11 @@ +#if defined( AIX_NULL_CHECK ) +# define NULL (0L) /* typed NULL */ +#endif /* AIX_NULL_CHECK */ + + #if defined( AVOID_BOOL_DEFINE_CHECK ) #ifndef __cplusplus # define bool char @@ -31,5 +36,15 @@ struct term; #if defined( VOID_NULL_CHECK ) -#define NULL 0 /* typed NULL */ +#ifndef NULL +#ifdef __cplusplus +#ifdef __GNUG__ +#define NULL __null +#else /* ! __GNUG__ */ +#define NULL 0L +#endif /* __GNUG__ */ +#else /* ! __cplusplus */ +#define NULL ((void *)0) +#endif /* __cplusplus */ +#endif /* !NULL */ /* typed NULL */ #endif /* VOID_NULL_CHECK */