Date: Thu, 29 Jan 2009 16:51:09 +0000 (UTC) From: Roman Divacky <rdivacky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r187895 - head/sys/sys Message-ID: <200901291651.n0TGp9NU058879@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rdivacky Date: Thu Jan 29 16:51:09 2009 New Revision: 187895 URL: http://svn.freebsd.org/changeset/base/187895 Log: 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) Modified: head/sys/sys/_null.h Modified: head/sys/sys/_null.h ============================================================================== --- head/sys/sys/_null.h Thu Jan 29 16:47:15 2009 (r187894) +++ head/sys/sys/_null.h Thu Jan 29 16:51:09 2009 (r187895) @@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901291651.n0TGp9NU058879>