svn commit: r191996 - head/sys/sys

John Baldwin jhb at FreeBSD.org
Mon May 11 17:29:11 UTC 2009


Author: jhb
Date: Mon May 11 17:29:11 2009
New Revision: 191996
URL: http://svn.freebsd.org/changeset/base/191996

Log:
  Always use __null to define NULL for GCC 4+.  Use '0' rather than
  '(void *)0' for NULL for C++ compilers compiling kernel code.  Together this
  makes it easier to build kernel modules using C++.
  
  Reviewed by:	imp
  MFC after:	3 days

Modified:
  head/sys/sys/_null.h

Modified: head/sys/sys/_null.h
==============================================================================
--- head/sys/sys/_null.h	Mon May 11 17:13:52 2009	(r191995)
+++ head/sys/sys/_null.h	Mon May 11 17:29:11 2009	(r191996)
@@ -28,18 +28,18 @@
 
 #ifndef NULL
 
-#if defined(_KERNEL) || !defined(__cplusplus)
-#define	NULL	((void *)0)
-#else
 #if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
 #define	NULL	__null
 #else
+#if defined(_KERNEL) && !defined(__cplusplus)
+#define	NULL	((void *)0)
+#else
 #if defined(__LP64__)
 #define	NULL	(0L)
 #else
 #define	NULL	0
 #endif	/* __LP64__ */
+#endif	/* _KERNEL && !__cplusplus */
 #endif	/* __GNUG__ */
-#endif	/* _KERNEL || !__cplusplus */
 
 #endif


More information about the svn-src-all mailing list