nxdk icon indicating copy to clipboard operation
nxdk copied to clipboard

NULL is not recognized as sentinel

Open JayFoxRox opened this issue 5 years ago • 2 comments

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?

JayFoxRox avatar Dec 16 '19 12:12 JayFoxRox

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.

thrimbor avatar Dec 17 '19 00:12 thrimbor

This seems to have been fixed upstream, did we ever update afterwards = is this possibly fixed now?

JayFoxRox avatar Jun 09 '23 20:06 JayFoxRox