Even though cctools/ld64/src/3rd/helper.c correctly does #include <assert.h>, that header is basically empty when NDEBUG is defined.
On clang 16, this causes a compilation error because it now got stricter about implicit function declarations:
The -Wimplicit-function-declaration and -Wimplicit-int warnings now default to an error in C99, C11, and C17. As of C2x, support for implicit function declarations and implicit int has been removed, and the warning options will have no effect. Specifying -Wimplicit-int in C89 mode will now issue warnings instead of being a noop.
In other words, __assert_rtn should not try to call __assert in the case of NDEBUG being defined. Add an #ifndef guard around the body of the function to achieve this.
Even though
cctools/ld64/src/3rd/helper.c
correctly does#include <assert.h>
, that header is basically empty whenNDEBUG
is defined.On clang 16, this causes a compilation error because it now got stricter about implicit function declarations:
In other words,
__assert_rtn
should not try to call__assert
in the case ofNDEBUG
being defined. Add an#ifndef
guard around the body of the function to achieve this.