summaryrefslogtreecommitdiff
path: root/fixincludes
diff options
context:
space:
mode:
authorDavid Edelsohn <dje@gcc.gnu.org>2013-05-04 10:49:59 -0400
committerDavid Edelsohn <dje@gcc.gnu.org>2013-05-04 10:49:59 -0400
commit0654e6be9566ff502a8754e3876c66dfdef14e2f (patch)
treefb2829d7008afaf98b795228050ea04dc0b30341 /fixincludes
parent40de22d6f926dadb38c5b6cf46703843e3d2d1e7 (diff)
downloadgcc-0654e6be9566ff502a8754e3876c66dfdef14e2f.tar.gz
inclhack.def (aix_null): New.
* inclhack.def (aix_null): New. (void_null): Update replacement definition of NULL. * fixincl.x: Regenerate. * tests/base/curses.h: Update for new fix. From-SVN: r198596
Diffstat (limited to 'fixincludes')
-rw-r--r--fixincludes/ChangeLog9
-rw-r--r--fixincludes/fixincl.x82
-rw-r--r--fixincludes/inclhack.def54
-rw-r--r--fixincludes/tests/base/curses.h17
4 files changed, 142 insertions, 20 deletions
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 88aa56368a9..ff84ee691fd 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,4 +1,11 @@
-2013-01-16 Alexandre Oliva <aoliva@redhat.com>
+2013-05-04 David Edelsohn <dje.gcc@gmail.com>
+
+ * 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 <aoliva@redhat.com>
* inclhack.def (feraiseexcept_nosse_invalid): New.
(feraiseexcept_nosse_divbyzero): Likewise.
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 29fc52abf45..871ca291086 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.
*
@@ -847,6 +847,60 @@ static const char* apzAix_Net_If_ArpPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * 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
*/
tSCC zAix_Once_Init_1Name[] =
@@ -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 24069201d12..253df68997c 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -617,6 +617,33 @@ fix = {
};
/*
+ * 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
* braces.
@@ -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 e05f8912d72..4a183be632e 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 */