AIX headers do not have a complete definition of NULL and the GCC
build complains about "missing sentinel".
The appended patch substitutes a more complete definition of NULL that
satisfies GCC/G++.
I also updated the void_null fix, which was discussed in 2011 to
substitute a more complete definition of NULL. void_null no longer
triggers on AIX because of the "__cplusplus" bypass, which appears in
AIX header files. I can omit void_null from the patch or remove the
fix completely if it no longer is applicable to any target.
(Yes, I will update fixinclude tests, but I first want agreement on
the fix itself.)
Bootstrapped on powerpc-ibm-aix7.1.0.0.
Thanks, David
* inclhack.def (aix_null): New.
(void_null): Substitute newer definition of NULL.
* fixincl.x: Regenerate.
Index: inclhack.def
===================================================================
--- inclhack.def (revision 198437)
+++ inclhack.def (working copy)
@@ -617,6 +617,31 @@
};
/*
+ * 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 = "#ifndef NULL\n"
+ "#ifdef __cplusplus\n"
+ "#ifdef __GNUG__\n"
+ "#define NULL\t__null\n"
+ "#else\t /* ! __GNUG__ */\n"
+ "#define NULL\t0L\n"
+ "#endif\t /* __GNUG__ */\n"
+ "#else\t /* ! __cplusplus */\n"
+ "#define NULL\t((void *)0)\n"
+ "#endif\t /* __cplusplus */\n"
+ "#endif\t /* !NULL */";
+ 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 +4577,24 @@
*/
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 = "#ifndef NULL\n"
+ "#ifdef __cplusplus\n"
+ "#ifdef __GNUG__\n"
+ "#define NULL\t__null\n"
+ "#else\t /* ! __GNUG__ */\n"
+ "#define NULL\t0L\n"
+ "#endif\t /* __GNUG__ */\n"
+ "#else\t /* ! __cplusplus */\n"
+ "#define NULL\t((void *)0)\n"
+ "#endif\t /* __cplusplus */\n"
+ "#endif\t /* !NULL */";
test_text = "# define\tNULL \t((void *)0) /* typed NULL */";
};