[PATCH v2 0/2] Add C23 stdbit.h functionality
Corinna Vinschen
corinna@vinschen.de
Mon Apr 13 10:51:24 GMT 2026
Hi Joel,
is that your original patchset, rather than the fixed one?
Your stdbit/Makefile.inc is still using the incorrect %D, rather than
%D%.
The new files in the stdbit subdir don't build on Cygwin, because you're
including limits.h without defining __STDC_WANT_IEC_60559_BFP_EXT__.
This will only work if you set __ISO_C_VISIBLE >= 2023, which is NOT the
default when building newlib. You have to make sure this stuff builds
even if __ISO_C_VISIBLE >= 2023 is NOT defined while building newlib.
Next, these functions would be better also defined as macros in
stdbit.h, so the (in all cases trivial) functionality would be inlined
rather than adding the function calling overhead.
Last but not least, the new functions should be exported by Cygwin.
I. e., winsup/cygwin/cygwin.din needs to add them (in alphabetic order)
and CYGWIN_VERSION_API_MINOR in winsup/cygwin/include/cygwin/version.h
needs to be bumped. If this part of the patch isn't quite correct, it's
not much of a problem, but it would be nice to at least make an effort.
Thanks,
Corinna
On Apr 10 14:21, Joel Sherrill wrote:
> In response to comments on the previous version of this patch,
> I submitted my first Cygwin patch to add the missing _WIDTH
> constants to the Cygwin limits.h. That patch is now merged
> which hopefully removes the barrier for merging this.
>
> Note that a limits.h implementation can "include_next" the
> GCC limits.h and it will provide many constants. Cygwin
> had a self-contained version and they had to be added.
>
> Two patches:
> - 0001 - adds the files
> - 0002 - regenerates
>
> --joel
>
> 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
More information about the Newlib
mailing list