Re: Missing <stdlib.h> include in lib/autoconf/c.m4

"Zack Weinberg" <[email protected]> Thu, 10 Nov 2022 22:25:53 -0500
Newsgroups dev.linux.lists.c-std-porting
Message-ID <[email protected]>
On Thu, Nov 10, 2022, at 10:18 PM, Sam James wrote:
>> On 5 Nov 2022, at 22:37, Sam James <[email protected]> wrote:
>> 
>> I would send a patch for the original issue but I'm wondering how to handle freestanding (see big comment above _AC_C_C89_TEST_GLOBALS).

Yeah, we can't include <stdlib.h> here, but it should be OK to add a manual declaration of free (as I did in bf5a75...) -- there was already a manual declaration of malloc, and free doesn't even need size_t.


>> We need another one (<assert.h>) I think for _Static_assert in _AC_C_C11_TEST_GLOBALS too, up until C23?

I think this should be fine as is; in C11, _Static_assert is a keyword / special form, so it's safe to use without <assert.h>.  IIUC the change in C23 is to make static_assert also available without <assert.h>?

zw