musl/include
Rich Felker 41d7c77d6a use a common definition of NULL as 0L for C and C++
the historical mess of having different definitions for C and C++
comes from the historical C definition as (void *)0 and the fact that
(void *)0 can't be used in C++ because it does not convert to other
pointer types implicitly. however, using plain 0 in C++ exposed bugs
in C++ programs that call variadic functions with NULL as an argument
and (wrongly; this is UB) expect it to arrive as a null pointer. on
64-bit machines, the high bits end up containing junk. glibc dodges
the issue by using a GCC extension __null to define NULL; this is
observably non-conforming because a conforming application could
observe the definition of NULL via stringizing and see that it is
neither an integer constant expression with value zero nor such an
expression cast to void.

switching to 0L eliminates the issue and provides compatibility with
broken applications, since on all musl targets, long and pointers have
the same size, representation, and argument-passing convention. we
could maintain separate C and C++ definitions of NULL (i.e. just use
0L on C++ and use (void *)0 on C) but after careful analysis, it seems
extremely difficult for a C program to even determine whether NULL has
integer or pointer type, much less depend in subtle, unintentional
ways, on whether it does. C89 seems to have no way to make the
distinction. on C99, the fact that (int)(void *)0 is not an integer
constant expression, along with subtle VLA/sizeof semantics, can be
used to make the distinction, but many compilers are non-conforming
and give the wrong result to this test anyway. on C11, _Generic can
trivially make the distinction, but it seems unlikely that code
targetting C11 would be so backwards in caring which definition of
NULL an implementation uses.

as such, the simplest path of using the same definition for NULL in
both C and C++ was chosen. the #undef directive was also removed so
that the compiler can catch and give a warning or error on
redefinition if buggy programs have defined their own versions of
NULL prior to inclusion of standard headers.
2013-01-18 20:35:26 -05:00
..
arpa add inet_network (required for wine) 2012-12-19 07:32:38 +01:00
net default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
netinet add missing multicast socket options to netinet/in.h 2013-01-12 19:42:39 +01:00
netpacket
scsi add scsi headers scsi.h and sg.h 2012-12-05 12:35:24 -05:00
sys add MOD_TAI to sys/timex.h and update STA_RONLY 2013-01-12 19:42:39 +01:00
aio.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
alloca.h alloca cannot be a function. #define it to the gcc builtin if possible 2012-04-09 15:06:58 -04:00
ar.h some extra legacy header stuff 2012-05-06 16:35:32 -04:00
assert.h __assert_fail(): remove _Noreturn, to get proper stacktraces 2013-01-04 20:36:34 +01:00
byteswap.h remove all remaining redundant __restrict/__inline/_Noreturn defs 2012-09-08 17:14:52 -04:00
complex.h make CMPLX macros available in complex.h in non-c11 mode as well 2012-12-11 22:44:36 +01:00
cpio.h
crypt.h replace old and ugly crypt implementation 2012-06-29 00:56:37 -04:00
ctype.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
dirent.h feature test macros: make _GNU_SOURCE enable everything 2012-12-03 16:57:01 -05:00
dlfcn.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
elf.h microblaze TLS relocation support, completely untested 2012-10-15 21:01:48 -04:00
endian.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
err.h fix redundant _Noreturn def in err.h 2012-09-08 18:16:33 -04:00
errno.h
fcntl.h fix F_DUPFD_CLOEXEC being defined twice 2012-12-06 22:45:56 +01:00
features.h add _ALL_SOURCE as an alias for _GNU_SOURCE/enable-everything 2012-12-03 17:02:56 -05:00
fenv.h
float.h fix DECIMAL_DIG definitions 2012-03-21 12:42:48 -04:00
fnmatch.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
ftw.h remove unneeded judgemental commentary from ftw.h 2012-09-07 23:55:11 -04:00
getopt.h add getopt reset support 2012-09-30 20:00:38 -04:00
glob.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
grp.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
iconv.h remove all remaining redundant __restrict/__inline/_Noreturn defs 2012-09-08 17:14:52 -04:00
inttypes.h fix a couple issues in the inttypes.h PRI/SCN macros 2012-12-02 15:18:05 -05:00
iso646.h
langinfo.h
lastlog.h some extra legacy header stuff 2012-05-06 16:35:32 -04:00
libgen.h
libintl.h
limits.h fix missing limits when only _BSD_SOURCE is defined 2012-11-26 12:05:33 -05:00
link.h link.h: expose glibc/svr4 dynlinker debugging glue 2012-12-19 05:08:13 +01:00
locale.h use a common definition of NULL as 0L for C and C++ 2013-01-18 20:35:26 -05:00
malloc.h
math.h add legacy header values.h 2013-01-04 20:36:34 +01:00
memory.h add memory.h, bogus legacy alias for string.h 2012-03-01 01:34:58 -05:00
mntent.h
monetary.h remove all remaining redundant __restrict/__inline/_Noreturn defs 2012-09-08 17:14:52 -04:00
mqueue.h remove all remaining redundant __restrict/__inline/_Noreturn defs 2012-09-08 17:14:52 -04:00
netdb.h avoid breakage if somebody wrongly defines empty feature test macros 2012-11-01 03:49:43 -04:00
nl_types.h
paths.h header file fixes: multiple include guard consistency and correctness 2012-06-15 21:52:53 -04:00
poll.h add linux extension POLLRDHUP to poll.h 2012-12-26 16:55:49 -05:00
pthread.h add stub versions of some missing optional pthread interfaces 2012-11-17 18:42:16 -05:00
pty.h
pwd.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
regex.h remove all remaining redundant __restrict/__inline/_Noreturn defs 2012-09-08 17:14:52 -04:00
resolv.h header file fixes: multiple include guard consistency and correctness 2012-06-15 21:52:53 -04:00
sched.h add support for thread scheduling (POSIX TPS option) 2012-11-11 15:38:04 -05:00
search.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
semaphore.h remove all remaining redundant __restrict/__inline/_Noreturn defs 2012-09-08 17:14:52 -04:00
setjmp.h setjmp.h: add struct tag for sigjmp_buf (GCC C++ compatibility) 2013-01-04 20:36:34 +01:00
shadow.h
signal.h add sigandset and sigorset (needed for qemu) 2012-12-06 20:51:32 +01:00
spawn.h fix some restrict-qualifier mismatches in newly added interfaces 2012-11-27 09:44:30 -05:00
stdalign.h implement "low hanging fruit" from C11 2012-08-25 23:15:13 -04:00
stdarg.h
stdbool.h
stddef.h use a common definition of NULL as 0L for C and C++ 2013-01-18 20:35:26 -05:00
stdint.h fix signedness errors in stdint.h constant macros 2012-06-08 11:11:44 -04:00
stdio_ext.h stdio_ext.h needs to include stdio.h, at least to get FILE... 2012-08-24 16:16:30 -04:00
stdio.h use a common definition of NULL as 0L for C and C++ 2013-01-18 20:35:26 -05:00
stdlib.h use a common definition of NULL as 0L for C and C++ 2013-01-18 20:35:26 -05:00
stdnoreturn.h add stdnoreturn.h (C11) 2012-09-08 00:14:25 -04:00
string.h use a common definition of NULL as 0L for C and C++ 2013-01-18 20:35:26 -05:00
strings.h
stropts.h add isastream (obsolete STREAMS junk) 2012-05-06 09:03:19 -04:00
syscall.h header file fixes: multiple include guard consistency and correctness 2012-06-15 21:52:53 -04:00
sysexits.h
syslog.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
tar.h
termios.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
tgmath.h math: more correct tgmath.h type cast logic 2012-12-19 10:57:54 +01:00
time.h use a common definition of NULL as 0L for C and C++ 2013-01-18 20:35:26 -05:00
ucontext.h fixup mcontext stuff to expost gregset_t/fpregset_t as appropriate 2012-11-25 23:04:23 -05:00
ulimit.h
unistd.h use a common definition of NULL as 0L for C and C++ 2013-01-18 20:35:26 -05:00
utime.h
utmp.h some extra legacy header stuff 2012-05-06 16:35:32 -04:00
utmpx.h
values.h add legacy header values.h 2013-01-04 20:36:34 +01:00
wchar.h use a common definition of NULL as 0L for C and C++ 2013-01-18 20:35:26 -05:00
wctype.h default features: make musl usable without feature test macros 2012-09-07 23:13:55 -04:00
wordexp.h remove all remaining redundant __restrict/__inline/_Noreturn defs 2012-09-08 17:14:52 -04:00