aboutsummaryrefslogtreecommitdiff
path: root/fixincludes
diff options
context:
space:
mode:
authorAndreas Tobler <a.tobler@schweiz.org>2008-12-31 23:00:17 +0000
committerAndreas Tobler <andreast@gcc.gnu.org>2009-01-01 00:00:17 +0100
commit9cb825505e75392820364bba0f58fc930836fee6 (patch)
tree5a48e9516f366715ca8c593bd4a3c0e572ef719b /fixincludes
parenta11fe69921144efb1f1cbe5268ec3232b85ea869 (diff)
inclhack.def (openbsd_null_definition): Redefine NULL to (void *)0 in case of C.
2009-01-01 Andreas Tobler <a.tobler@schweiz.org> * inclhack.def (openbsd_null_definition): Redefine NULL to (void *)0 in case of C. * fixincl.x: Regenerate. From-SVN: r142989
Diffstat (limited to 'fixincludes')
-rw-r--r--fixincludes/ChangeLog6
-rw-r--r--fixincludes/fixincl.x70
-rw-r--r--fixincludes/inclhack.def38
3 files changed, 109 insertions, 5 deletions
diff --git a/fixincludes/ChangeLog b/fixincludes/ChangeLog
index 876b2c71148..ac3a39105fc 100644
--- a/fixincludes/ChangeLog
+++ b/fixincludes/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-01 Andreas Tobler <a.tobler@schweiz.org>
+
+ * inclhack.def (openbsd_null_definition): Redefine NULL to (void *)0
+ in case of C.
+ * fixincl.x: Regenerate.
+
2008-12-31 Andreas Tobler <a.tobler@schweiz.org>
PR target/35460
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
index 0e283966615..120728ee052 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 Wednesday December 31, 2008 at 02:49:07 PM CET
+ * It has been AutoGen-ed Wednesday December 31, 2008 at 11:51:30 PM CET
* From the definitions inclhack.def
* and the template file fixincl
*/
-/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Dec 31 14:49:07 CET 2008
+/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Dec 31 23:51:30 CET 2008
*
* 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 178 fixup descriptions.
+ * This file contains 179 fixup descriptions.
*
* See README for more information.
*
@@ -4699,6 +4699,60 @@ static const char* apzNodeent_SyntaxPatch[] = {
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Openbsd_Null_Definition fix
+ */
+tSCC zOpenbsd_Null_DefinitionName[] =
+ "openbsd_null_definition";
+
+/*
+ * File name selection pattern
+ */
+tSCC zOpenbsd_Null_DefinitionList[] =
+ "locale.h\0stddef.h\0stdio.h\0string.h\0time.h\0unistd.h\0wchar.h\0sys/param.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzOpenbsd_Null_DefinitionMachs[] = {
+ "*-*-openbsd*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zOpenbsd_Null_DefinitionSelect0[] =
+ "__GNUG__";
+
+#define OPENBSD_NULL_DEFINITION_TEST_CT 1
+static tTestDesc aOpenbsd_Null_DefinitionTests[] = {
+ { TT_EGREP, zOpenbsd_Null_DefinitionSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Openbsd_Null_Definition
+ */
+static const char* apzOpenbsd_Null_DefinitionPatch[] = {
+ "format",
+ "#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 */",
+ "^#ifndef[ \t]*NULL\n\
+^#ifdef[ \t]*__GNUG__\n\
+^#define[ \t]*NULL[ \t]*__null\n\
+^#else\n\
+^#define[ \t]*NULL[ \t]*0L\n\
+^#endif\n\
+^#endif",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Obstack_Lvalue_Cast fix
*/
tSCC zObstack_Lvalue_CastName[] =
@@ -7219,9 +7273,9 @@ static const char* apzX11_SprintfPatch[] = {
*
* List of all fixes
*/
-#define REGEX_COUNT 224
+#define REGEX_COUNT 225
#define MACH_LIST_SIZE_LIMIT 181
-#define FIX_COUNT 178
+#define FIX_COUNT 179
/*
* Enumerate the fixes
@@ -7343,6 +7397,7 @@ typedef enum {
NEXT_VOLITILE_FIXIDX,
NEXT_WAIT_UNION_FIXIDX,
NODEENT_SYNTAX_FIXIDX,
+ OPENBSD_NULL_DEFINITION_FIXIDX,
OBSTACK_LVALUE_CAST_FIXIDX,
OPENBSD_VA_START_FIXIDX,
OSF_NAMESPACE_A_FIXIDX,
@@ -7988,6 +8043,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
NODEENT_SYNTAX_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
aNodeent_SyntaxTests, apzNodeent_SyntaxPatch, 0 },
+ { zOpenbsd_Null_DefinitionName, zOpenbsd_Null_DefinitionList,
+ apzOpenbsd_Null_DefinitionMachs,
+ OPENBSD_NULL_DEFINITION_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aOpenbsd_Null_DefinitionTests, apzOpenbsd_Null_DefinitionPatch, 0 },
+
{ zObstack_Lvalue_CastName, zObstack_Lvalue_CastList,
apzObstack_Lvalue_CastMachs,
OBSTACK_LVALUE_CAST_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 63871c42abd..adab21ef89b 100644
--- a/fixincludes/inclhack.def
+++ b/fixincludes/inclhack.def
@@ -2516,6 +2516,44 @@ fix = {
test_text = "char *na_addr\t";
};
+/*
+ * Fix OpenBSD's NULL definition.
+ */
+fix = {
+ hackname = openbsd_null_definition;
+ mach = "*-*-openbsd*";
+ files = locale.h, stddef.h, stdio.h, string.h,
+ time.h, unistd.h, wchar.h, sys/param.h;
+ select = "__GNUG__";
+ 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 */";
+
+ c_fix_arg = "^#ifndef[ \t]*NULL\n"
+ "^#ifdef[ \t]*__GNUG__\n"
+ "^#define[ \t]*NULL[ \t]*__null\n"
+ "^#else\n"
+ "^#define[ \t]*NULL[ \t]*0L\n"
+ "^#endif\n"
+ "^#endif";
+ test_text =
+ "#ifndef NULL\n"
+ "#ifdef __GNUG__\n"
+ "#define NULL __null\n"
+ "#else\n"
+ "#define NULL 0L\n"
+ "#endif\n"
+ "#endif\n";
+};
/*
* obstack.h used casts as lvalues.