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

Joel Sherrill <[email protected]> Fri, 13 Mar 2026 12:03:33 -0500
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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.

But the first problem is getting it to build at all.

Help appreciated.

Joel Sherrill (2):
  newlib/libc: Add C23 stdbit.h from FreeBSD
  Makefile.inc, stdbit/Makefile.inc: Add stdbit

 newlib/libc/Makefile.inc                      |   1 +
 newlib/libc/include/stdbit.h                  | 124 ++++++++++++++++++
 newlib/libc/stdbit/Makefile.inc               |  15 +++
 newlib/libc/stdbit/stdc_bit_ceil.3            |  81 ++++++++++++
 newlib/libc/stdbit/stdc_bit_ceil.c            |  71 ++++++++++
 newlib/libc/stdbit/stdc_bit_floor.3           |  83 ++++++++++++
 newlib/libc/stdbit/stdc_bit_floor.c           |  53 ++++++++
 newlib/libc/stdbit/stdc_bit_width.3           | 104 +++++++++++++++
 newlib/libc/stdbit/stdc_bit_width.c           |  53 ++++++++
 newlib/libc/stdbit/stdc_count_ones.3          |  85 ++++++++++++
 newlib/libc/stdbit/stdc_count_ones.c          |  38 ++++++
 newlib/libc/stdbit/stdc_count_zeros.3         |  84 ++++++++++++
 newlib/libc/stdbit/stdc_count_zeros.c         |  38 ++++++
 newlib/libc/stdbit/stdc_first_leading_one.3   |  93 +++++++++++++
 newlib/libc/stdbit/stdc_first_leading_one.c   |  57 ++++++++
 newlib/libc/stdbit/stdc_first_leading_zero.3  |  92 +++++++++++++
 newlib/libc/stdbit/stdc_first_leading_zero.c  |  57 ++++++++
 newlib/libc/stdbit/stdc_first_trailing_one.3  | 110 ++++++++++++++++
 newlib/libc/stdbit/stdc_first_trailing_one.c  |  52 ++++++++
 newlib/libc/stdbit/stdc_first_trailing_zero.3 |  93 +++++++++++++
 newlib/libc/stdbit/stdc_first_trailing_zero.c |  53 ++++++++
 newlib/libc/stdbit/stdc_has_single_bit.3      |  98 ++++++++++++++
 newlib/libc/stdbit/stdc_has_single_bit.c      |  38 ++++++
 newlib/libc/stdbit/stdc_leading_ones.3        |  86 ++++++++++++
 newlib/libc/stdbit/stdc_leading_ones.c        |  60 +++++++++
 newlib/libc/stdbit/stdc_leading_zeros.3       |  86 ++++++++++++
 newlib/libc/stdbit/stdc_leading_zeros.c       |  60 +++++++++
 newlib/libc/stdbit/stdc_trailing_ones.3       |  86 ++++++++++++
 newlib/libc/stdbit/stdc_trailing_ones.c       |  56 ++++++++
 newlib/libc/stdbit/stdc_trailing_zeros.3      |  87 ++++++++++++
 newlib/libc/stdbit/stdc_trailing_zeros.c      |  56 ++++++++
 31 files changed, 2150 insertions(+)
 create mode 100644 newlib/libc/include/stdbit.h
 create mode 100644 newlib/libc/stdbit/Makefile.inc
 create mode 100644 newlib/libc/stdbit/stdc_bit_ceil.3
 create mode 100644 newlib/libc/stdbit/stdc_bit_ceil.c
 create mode 100644 newlib/libc/stdbit/stdc_bit_floor.3
 create mode 100644 newlib/libc/stdbit/stdc_bit_floor.c
 create mode 100644 newlib/libc/stdbit/stdc_bit_width.3
 create mode 100644 newlib/libc/stdbit/stdc_bit_width.c
 create mode 100644 newlib/libc/stdbit/stdc_count_ones.3
 create mode 100644 newlib/libc/stdbit/stdc_count_ones.c
 create mode 100644 newlib/libc/stdbit/stdc_count_zeros.3
 create mode 100644 newlib/libc/stdbit/stdc_count_zeros.c
 create mode 100644 newlib/libc/stdbit/stdc_first_leading_one.3
 create mode 100644 newlib/libc/stdbit/stdc_first_leading_one.c
 create mode 100644 newlib/libc/stdbit/stdc_first_leading_zero.3
 create mode 100644 newlib/libc/stdbit/stdc_first_leading_zero.c
 create mode 100644 newlib/libc/stdbit/stdc_first_trailing_one.3
 create mode 100644 newlib/libc/stdbit/stdc_first_trailing_one.c
 create mode 100644 newlib/libc/stdbit/stdc_first_trailing_zero.3
 create mode 100644 newlib/libc/stdbit/stdc_first_trailing_zero.c
 create mode 100644 newlib/libc/stdbit/stdc_has_single_bit.3
 create mode 100644 newlib/libc/stdbit/stdc_has_single_bit.c
 create mode 100644 newlib/libc/stdbit/stdc_leading_ones.3
 create mode 100644 newlib/libc/stdbit/stdc_leading_ones.c
 create mode 100644 newlib/libc/stdbit/stdc_leading_zeros.3
 create mode 100644 newlib/libc/stdbit/stdc_leading_zeros.c
 create mode 100644 newlib/libc/stdbit/stdc_trailing_ones.3
 create mode 100644 newlib/libc/stdbit/stdc_trailing_ones.c
 create mode 100644 newlib/libc/stdbit/stdc_trailing_zeros.3
 create mode 100644 newlib/libc/stdbit/stdc_trailing_zeros.c

-- 
2.47.3