Re: [PATCH v0 0/2] Add C23 stdbit.h functions

Corinna Vinschen <[email protected]> Tue, 17 Mar 2026 18:34:01 +0100
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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