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
This commit is contained in:
Andreas Tobler 2008-12-31 23:00:17 +00:00 committed by Andreas Tobler
parent a11fe69921
commit 9cb825505e
3 changed files with 109 additions and 5 deletions

View File

@ -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

View File

@ -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.
*
@ -4697,6 +4697,60 @@ static const char* apzNodeent_SyntaxPatch[] = {
"%0;",
(char*)NULL };
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
* 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
@ -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,

View File

@ -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.