aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/_null.h
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-01-29 16:51:09 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-01-29 16:51:09 +0000
commite9b123be773ec87ff1c51c50758ecb80930767d9 (patch)
treec6ad73e3a3d25cef11268431972d6556418dfa30 /sys/sys/_null.h
parent49c4791ccc1f8aa6b59f412f59c6554b2d1c9abc (diff)
downloadsrc-e9b123be773ec87ff1c51c50758ecb80930767d9.tar.gz
src-e9b123be773ec87ff1c51c50758ecb80930767d9.zip
Define NULL to be __null in a case of gnu c++. This makes sentinel attribute
work ok in C++. Note that we enable this only for gcc 4.x for any value of x. The __null was introduced in gcc 4.1 (in fact it was commited 12 days after release of gcc 4.0) and as we have never released any version of FreeBSD with gcc 4.0 nor ports support gcc 4.0.x this is a safe check. Using __GNUC_PREREQ__ would require us to include cdefs.h in params.h so we just check __GNUC__. Approved by: kib (mentor) Tested by: exp build of ports (done by pav) Tested by: make universe (done by me)
Notes
Notes: svn path=/head/; revision=187895
Diffstat (limited to 'sys/sys/_null.h')
-rw-r--r--sys/sys/_null.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/sys/_null.h b/sys/sys/_null.h
index 9e965f100b1a..caae78133c9d 100644
--- a/sys/sys/_null.h
+++ b/sys/sys/_null.h
@@ -31,11 +31,15 @@
#if defined(_KERNEL) || !defined(__cplusplus)
#define NULL ((void *)0)
#else
+#if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
+#define NULL __null
+#else
#if defined(__LP64__)
#define NULL (0L)
#else
#define NULL 0
#endif /* __LP64__ */
+#endif /* __GNUG__ */
#endif /* _KERNEL || !__cplusplus */
#endif