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

Joel Sherrill <[email protected]> Fri, 13 Mar 2026 15:05:42 -0500
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCVJwc5mYBE=nBETZZqgX437ULB6h2fe1DWnou5hLa8Gew@mail.gmail.com>
On Fri, Mar 13, 2026 at 12:48 PM Howland, Craig D. - US <
[email protected]> wrote:

>
> ------------------------------
> *From:* Joel Sherrill <[email protected]>
> *Sent:* Friday, March 13, 2026 1:03 PM
> *To:* [email protected] <[email protected]>
> *Cc:* Joel Sherrill <[email protected]>
> *Subject:* [PATCH v0 0/2] Add C23 stdbit.h functions
>
> >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
> <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.
> >
> >But the first problem is getting it to build at all.
> >
> >Help appreciated.
> >
> > Joel Sherrill (2):
> Joel:
> One question:  what about checks for the underlying __builtin* functions
> called?  I know (newer) GCC has them, but do all the supported compilers?
> (In the latter case, perhaps the to-be-added C23 check would implicitly
> handle that?)
>

Checking what I have installed, gcc 14 defaults to C17 and setting -std=c23
gives  __STDC_VERSION__  of 202000L. I think that means it will take GCC 15
or newer to get by the __STDC_VERSION__ check.

GCC 15 also does not provide stdckdint.h but gcc master does.

I haven't dived into support for new keywords but remember finding out
RTEMS had used one of the new keywords has a function name in a test. So
some of those are supported.

I **think** this means that GCC < 15 isn't going to build these.

I have not done an exhaustive pass on multilib variants for missing
__builtin* functions but I did a test build for -m68000 and it called
libgcc2 functions instead.

(Sorry, no ideas on the make problem.)
>

Me either. I thought that would be easier than it has turned out to be.

FWIW the patches are (1) import the o=unchanged source, (2) build changes.
The check for __STDC_VERSION__ needs to be added. I can add that to (2) or
add a (3) for that.

--joel


> Craig
>
> ------------------------------
>
> This electronic message contains information from CACI International Inc
> or subsidiary companies, which may be company sensitive, proprietary,
> privileged or otherwise protected from disclosure. The information is
> intended to be used solely by the recipient(s) named above. If you are not
> an intended recipient, be aware that any review, disclosure, copying,
> distribution or use of this transmission or its contents is prohibited. If
> you have received this transmission in error, please notify the sender
> immediately.
>