nxdk
nxdk copied to clipboard
NULL is not recognized as sentinel
Our NULL
doesn't appear to be detected as sentinel. This leads to confusing output like this:
neverball/share/gui.c:708:51: warning: missing sentinel in function call [-Wsentinel]
return concat_string("...", text + right, NULL);
^
, NULL
neverball/share/common.h:74:7: note: function has been explicitly marked sentinel here
char *concat_string(const char *first, ...) NULL_TERMINATED;
Looking at my local /usr/lib/clang/9.0.0/include/stddef.h it looks like we should be using #define NULL __null
(C++) and #define NULL ((void*)0)
(C)? What are we using? Why doesn't it work?
Our NULL
comes from PDCLib, which defines it as _PDCLIB_NULL
, which is defined in _PDCLIB_int.h
: #define _PDCLIB_NULL 0
The C standard says the following about NULL
: [...] which expands to an implementation-defined null pointer constant [...]
So I'd say this is a shortcoming of upstream PDCLib. This indicates that an integer literal zero is fine on Windows, but not for clang.
This seems to have been fixed upstream, did we ever update afterwards = is this possibly fixed now?