[PATCH v0 0/2] Add C23 stdbit.h functions
Corinna Vinschen
corinna@vinschen.de
Tue Mar 17 17:34:01 GMT 2026
Hi Joel,
On Mar 13 12:03, Joel Sherrill wrote:
> This patch series is a draft and feedback is appreciated on what
> is required to run "autoreconf" to get build infrastructure that
> does not give an error. See
> https://sourceware.org/pipermail/newlib/2026/022334.html for
> details on the make error.
>
> Once this builds, I can foresee at least one more problem.
> The header file stdbit.h does not have C23 guards and neither
> do any of the implementation files. If these function files
> are to be compiled by an older compiler without C23 support,
> they should be disabled. At this point, I see adding a C23
> guard to stdbit.c and stdbit/*.c files.
Actually, no.
- The fact that these functions are only required by a C23 environment
doesn't mean that an older compiler shouldn't be able to build them.
They should be buildable and built, as long as the compiler provides
the matching builtins.
- The header doesn't offically exist prior to C23. So if a source file
includes this file, it's building for C23 or later by default.
There's no guard required. It's different *only* for the compiler
building newlib itself, but this compiler should have access to the
header.
The problem with stdbit/Makefile.inc is that you used %D instead of %D%.
This breaks the generated Makefile.
With that fixed, your code still doesn't build (with gcc 13.4.0,
cross-building for Cygwin), because the compiler complains about missing
definitions for UINT_WIDTH, ULLONG_WIDTH, etc. Maybe you should use
__LONG_WIDTH__ etc.?
Thanks,
Corinna
More information about the Newlib
mailing list