path: root/sys/sys/_null.h
Commit message (Collapse)AuthorAgeFilesLines
* sys/sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326256
* Define NULL to nullptr in C++11 mode (not strictly required, but it makesDavid Chisnall2011-12-271-1/+3
| | | | | | | | | migrating code to C++11 easier). Approved by: dim (mentor) Notes: svn path=/head/; revision=228918
* *sigh*, while the kernel built, userland C did not. Revert the previousJohn Baldwin2009-05-111-4/+4
| | | | | | | | | | commit and fix it correctly by removing the _KERNEL check entirely. Now the kernel always sees the same value of NULL as userland meaning that it sees __null, 0, or 0L when compiled as C++, and '(void *)0' when compiled as C. Notes: svn path=/head/; revision=192002
* Always use __null to define NULL for GCC 4+. Use '0' rather thanJohn Baldwin2009-05-111-4/+4
| | | | | | | | | | | '(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 Notes: svn path=/head/; revision=191996
* Define NULL to be __null in a case of gnu c++. This makes sentinel attributeRoman Divacky2009-01-291-0/+4
| | | | | | | | | | | | | | | | | 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: svn path=/head/; revision=187895
* /* -> /*- for license, minor formatting changesWarner Losh2005-01-071-1/+1
| | | | Notes: svn path=/head/; revision=139825
* Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)Mark Murray2004-03-051-5/+5
| | | | | | | | | | | | | | | | | | that this provokes. "Wherever possible" means "In the kernel OR NOT C++" (implying C). There are places where (void *) pointers are not valid, such as for function pointers, but in the special case of (void *)0, agreement settles on it being OK. Most of the fixes were NULL where an integer zero was needed; many of the fixes were NULL where ascii <nul> ('\0') was needed, and a few were just "other". Tested on: i386 sparc64 Notes: svn path=/head/; revision=126643
* GC the AMD64 special handling.David E. O'Brien2003-12-261-2/+1
| | | | Notes: svn path=/head/; revision=123855
* Add a reminder note about removing the amd64 test here once the gcc33 portPeter Wemm2003-12-231-0/+1
| | | | | | | has been updated. Notes: svn path=/head/; revision=123741
* Don peril sensitive sunglasses and set NULL to an actual pointer type,Peter Wemm2003-12-231-0/+4
| | | | | | | | | but *only* for the kernel. We can do this because the kernel is not a standard C application environment. This would have stopped the recent mtx_* arg NULL/MTX_DEF mixups from going unnoticed for so long. Notes: svn path=/head/; revision=123739
* amd64 doesn't define __LP64__ in the compiler, but it definately needsPeter Wemm2003-12-151-1/+1
| | | | | | | | | | | | | | this definition. It fixes gnome for starters. I haven't tried *emacs yet. Like IA64, amd64 uses registers for the first few arguments and then the stack for the rest. This means the 64 bit promotion of the NULL (0) value is lost and its just pushed on as an 'int' in a varargs call. When the consumer walks the list and expects to pull off void * pointers via va_arg, then all hell breaks loose. Marcel: thanks a million for finding this! Notes: svn path=/head/; revision=123544
* Change the definition of NULL on ia64 (for LP64 compilations) fromMarcel Moolenaar2003-12-071-0/+37
an int constant to a long constant. This change improves consistency in the following two ways: 1. The first 8 arguments are always passed in registers on ia64, which by virtue of the generated code implicitly widens ints to longs and allows the use of an 32-bit integral type for 64-bit arguments. Subsequent arguments are passed onto the memory stack, which does not exhibit the same behaviour and consequently do not allow this. In practice this means that variadic functions taking pointers and given NULL (without cast) work as long as the NULL is passed in one of the first 8 arguments. A SIGSEGV is more likely the result if such would be done for stack-based arguments. This is due to the fact that the upper 4 bytes remain undefined. 2. All 64-bit platforms that FreeBSD supports, with the obvious exception of ia64, allow 32-bit integral types (specifically NULL) when 64-bit pointers are expected in variadic functions by way of how the compiler generates code. As such, code that works correctly (whether rightfully so or not) on any platform other than ia64, may fail on ia64. To more easily allow tweaking of the definition of NULL, this commit removes the 12 definitions in the various headers and puts it in a new header that can be included whenever NULL is to be made visible. This commit fixes GNOME, emacs, xemacs and a whole bunch of ports that I don't particularly care about at this time... Notes: svn path=/head/; revision=123257