aboutsummaryrefslogtreecommitdiff
path: root/fixincludes/inclhack.def
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/inclhack.def
parenta11fe69921144efb1f1cbe5268ec3232b85ea869 (diff)
downloadgcc-9cb825505e75392820364bba0f58fc930836fee6.zip
gcc-9cb825505e75392820364bba0f58fc930836fee6.tar.gz
gcc-9cb825505e75392820364bba0f58fc930836fee6.tar.bz2
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/inclhack.def')
-rw-r--r--fixincludes/inclhack.def38
1 files changed, 38 insertions, 0 deletions
diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def
index 63871c4..adab21e 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.