How to suppress -Wimplicit-function-declaration warning, if <stdlib.h> really does not have the declaration?

Jim DeLaHunt list+macports-dev at jdlh.com
Thu Jan 27 08:41:18 UTC 2022


Thank you for your reply, Joshua.

On 2022-01-26 02:59, Joshua Root wrote:

> On 2022-1-26 18:43 , Jim DeLaHunt wrote:
>> When I attempt to compile it with clang as provided by XCode 11.2.1 
>> (11B5000) on macOS 10.14.6 Mojave, I get the 
>> -Wimplicit-function-declaration warning:
>> … [snip] …
>> But this code does have the right system header: <stdlib.h>. It looks 
>> like that header does not include a declaration of at_quick_exit().…
>
> I get the same result on Big Sur. Curious, since at_quick_exit is 
> apparently part of the C11 standard.

Yes, it is curious. I found a page which claims to show clang's C11 
implementation status[1]. It does not even mention proposal N1327[2], 
which appears to be the document for at_quick_exit and friends. It also 
shows 60% of the C11 proposals as having "unknown" availability in 
clang. So that is evidence that we should not expect clang to have a 
complete implementation of C11.

> In any case, we maintain lists of functions that are known not to 
> exist on each macOS version, so the warning can be suppressed. They 
> are in the ports tree here: 
> <https://github.com/macports/macports-ports/tree/master/_resources/port1.0/checks/implicit_function_declaration>

Thank you for pointing this out. I may use it. But first I need to check 
the five other -Wimplicit-function-declaration warnings in this port. I 
think they are all just missing a #include <stdlib.h> or <string.h>, but 
I need to check.

[1] <https://clang.llvm.org/c_status.html#c11>
[2] N1327 "Abandoning a Process" 
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1327.htm>

Best regards,
     —Jim DeLaHunt, Vancouver, Canada




More information about the macports-dev mailing list