Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 May 2009 17:29:11 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191996 - head/sys/sys
Message-ID:  <200905111729.n4BHTBRx097557@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905111729.n4BHTBRx097557>