I recently started having problems with compiling C programs, getting 10, 20 or 100 warnings from the different C packages like stdio.h or stdlib.h.
The warnings differ somewhat but usually say something like this:
/usr/local/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or
_Null_unspecified) [-Wnullability-completeness]
unsigned char *_base;
My program still compiles and works fine, but I worry that this needs to be fixed and also it is extremely annoying getting all these warnings in the terminal.
I am almost certain these warnings started showing after I updated my system to macOS Catalina but I don't know where to begin to solve it.
More concretely, when I compile a simple helloworld.c program like so
#include <stdio.h>
int main (void) {
printf("Hello World!");
return 0;
}
with the following commands:
make helloworld
or
gcc helloworld.c -o helloworld
..I get the following warnings, even though the program actually compiles.
In file included from helloworld.c:1:
In file included from /usr/local/include/stdio.h:64:
/usr/local/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
unsigned char *_base;
^
/usr/local/include/_stdio.h:93:16: note: insert '_Nullable' if the pointer may be null
unsigned char *_base;
^
_Nullable
/usr/local/include/_stdio.h:93:16: note: insert '_Nonnull' if the pointer should never be null
unsigned char *_base;
^
_Nonnull
/usr/local/include/_stdio.h:138:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _read) (void *, char *, int);
^
/usr/local/include/_stdio.h:138:32: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _read) (void *, char *, int);
^
_Nullable
/usr/local/include/_stdio.h:138:32: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _read) (void *, char *, int);
^
_Nonnull
/usr/local/include/_stdio.h:138:40: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _read) (void *, char *, int);
^
/usr/local/include/_stdio.h:138:40: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _read) (void *, char *, int);
^
_Nullable
/usr/local/include/_stdio.h:138:40: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _read) (void *, char *, int);
^
_Nonnull
/usr/local/include/_stdio.h:139:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
/usr/local/include/_stdio.h:139:35: note: insert '_Nullable' if the pointer may be null
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
_Nullable
/usr/local/include/_stdio.h:139:35: note: insert '_Nonnull' if the pointer should never be null
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
_Nonnull
/usr/local/include/_stdio.h:140:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _write)(void *, const char *, int);
^
/usr/local/include/_stdio.h:140:32: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nullable
/usr/local/include/_stdio.h:140:32: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nonnull
/usr/local/include/_stdio.h:140:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _write)(void *, const char *, int);
^
/usr/local/include/_stdio.h:140:46: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nullable
/usr/local/include/_stdio.h:140:46: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nonnull
/usr/local/include/_stdio.h:144:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
struct __sFILEX *_extra; /* additions to FILE to not break ABI */
^
/usr/local/include/_stdio.h:144:18: note: insert '_Nullable' if the pointer may be null
struct __sFILEX *_extra; /* additions to FILE to not break ABI */
^
_Nullable
/usr/local/include/_stdio.h:144:18: note: insert '_Nonnull' if the pointer should never be null
struct __sFILEX *_extra; /* additions to FILE to not break ABI */
^
_Nonnull
In file included from helloworld.c:1:
/usr/local/include/stdio.h:67:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
extern FILE *__stdinp;
^
/usr/local/include/stdio.h:67:13: note: insert '_Nullable' if the pointer may be null
extern FILE *__stdinp;
^
_Nullable
/usr/local/include/stdio.h:67:13: note: insert '_Nonnull' if the pointer should never be null
extern FILE *__stdinp;
^
_Nonnull
/usr/local/include/stdio.h:386:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable)(void *, const char *, int),
^
/usr/local/include/stdio.h:386:41: note: insert '_Nullable' if the pointer may be null
int (* _Nullable)(void *, const char *, int),
^
_Nullable
/usr/local/include/stdio.h:386:41: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable)(void *, const char *, int),
^
_Nonnull
/usr/local/include/stdio.h:386:55: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable)(void *, const char *, int),
^
/usr/local/include/stdio.h:386:55: note: insert '_Nullable' if the pointer may be null
int (* _Nullable)(void *, const char *, int),
^
_Nullable
/usr/local/include/stdio.h:386:55: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable)(void *, const char *, int),
^
_Nonnull
/usr/local/include/stdio.h:387:44: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
fpos_t (* _Nullable)(void *, fpos_t, int),
^
/usr/local/include/stdio.h:387:44: note: insert '_Nullable' if the pointer may be null
fpos_t (* _Nullable)(void *, fpos_t, int),
^
_Nullable
/usr/local/include/stdio.h:387:44: note: insert '_Nonnull' if the pointer should never be null
fpos_t (* _Nullable)(void *, fpos_t, int),
^
_Nonnull
/usr/local/include/stdio.h:388:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable)(void *));
^
/usr/local/include/stdio.h:388:41: note: insert '_Nullable' if the pointer may be null
int (* _Nullable)(void *));
^
_Nullable
/usr/local/include/stdio.h:388:41: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable)(void *));
^
_Nonnull
/usr/local/include/stdio.h:384:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
FILE *funopen(const void *,
^
/usr/local/include/stdio.h:384:6: note: insert '_Nullable' if the pointer may be null
FILE *funopen(const void *,
^
_Nullable
/usr/local/include/stdio.h:384:6: note: insert '_Nonnull' if the pointer should never be null
FILE *funopen(const void *,
^
_Nonnull
13 warnings generated.
EDIT: Mike Minaev provided a temporary fix that I am using for now. Command:
gcc -Wno-nullability-completeness helloworld.c -o helloworld
EDIT: I have looked around and tried various solutions from this thread or this thread, including reinstalling xcode with CLI but without results.
Jonathan Leffler below speculates that it could be because my header files are located in usr/local/include
instead of usr/include
but no fix is suggested.
temp quick fix for me:
gcc -Wno-nullability-completeness file.c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With