This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

PATCH: define NULL as 0 instead of (void *)0 for non-GNU C++ parsers


this is a small patch removing the problem that other C++ parsers
than egcs/g++ will get NULL defined as ((void *)0).
The (void *) definition does currently break e.g. parsing of iostream
by third party parsers like object database schema pre-processors
and some source code browsers.
Since the definition of NULL is *only* changed if __GNUG__ is not defined
and *only* for parsers defining __cplusplus it neither affects egcs 
nor any C parsers.

BTW: I did this diff against the 1.1 brach in cvs but the same patch
could/should be applied to gcc/include/stddef.h in the 1.1.1 release.

Any hope to get this still into 1.1.2? Currently we have to patch all
our egcs installations manually.

	Cheers, Dirk

Fri Mar  5 11:15:02 1999  Dirk Duellmann  <>

	* ginclude/stddef.h: define NULL for non-gnu C++ parsers as 0
	instead of ((void *)0)

Index: stddef.h
RCS file: /egcs/carton/cvsfiles/egcs/gcc/ginclude/stddef.h,v
retrieving revision 1.3
diff -u -p -r1.3 stddef.h
--- stddef.h    1998/04/28 21:13:26     1.3
+++ stddef.h    1999/03/05 09:52:05
@@ -325,7 +325,12 @@ typedef __WINT_TYPE__ wint_t;
 #ifdef __GNUG__
 #define NULL __null
 #else   /* G++ */
+/* shield other c++ parsers against non-standard NULL definition */
+#ifndef __cplusplus
 #define NULL ((void *)0)
+#define NULL 0
+#endif  /* __cplusplus */
 #endif  /* G++ */
 #endif /* NULL not defined and <stddef.h> or need NULL.  */
 #undef __need_NULL

Dirk Duellmann		Tel : +41 22 767 4937
IT Division 513 1-007	Fax : +41 22 767 8630 
CERN			Mail:
CH-1211 Geneva 23	WWW:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]