These patches add a new module to support <stdbit.h> on non-C23 platforms that lack it, which is most platforms these days: it's new in glibc 2.39 (released January) and other platforms I consulted don't have it yet.
This first implementation takes the simple approach of assuming that stdbit.h works if it exists, which is good enough for the platforms I tested it on. We can complicate later if needed, with include_next etc. Paul Eggert (4): stdbit: new module stdbit-tests: new module stdbit: remove most module dependence stdbit: clean up namespace and simplify ChangeLog | 75 +++ config/srclist.txt | 15 + doc/gnulib-tool.texi | 1 + doc/gnulib.texi | 2 + doc/posix-headers/stdbit.texi | 25 + lib/stdbit.c | 51 ++ lib/stdbit.in.h | 863 +++++++++++++++++++++++++++ m4/stdbit_h.m4 | 19 + modules/stdbit | 42 ++ modules/stdbit-tests | 42 ++ tests/support/test-driver.c | 5 + tests/tst-stdbit.h | 225 +++++++ tests/tst-stdc_bit_ceil.c | 88 +++ tests/tst-stdc_bit_floor.c | 88 +++ tests/tst-stdc_bit_width.c | 88 +++ tests/tst-stdc_count_ones.c | 88 +++ tests/tst-stdc_count_zeros.c | 88 +++ tests/tst-stdc_first_leading_one.c | 88 +++ tests/tst-stdc_first_leading_zero.c | 88 +++ tests/tst-stdc_first_trailing_one.c | 88 +++ tests/tst-stdc_first_trailing_zero.c | 88 +++ tests/tst-stdc_has_single_bit.c | 88 +++ tests/tst-stdc_leading_ones.c | 88 +++ tests/tst-stdc_leading_zeros.c | 88 +++ tests/tst-stdc_trailing_ones.c | 88 +++ tests/tst-stdc_trailing_zeros.c | 88 +++ 26 files changed, 2597 insertions(+) create mode 100644 doc/posix-headers/stdbit.texi create mode 100644 lib/stdbit.c create mode 100644 lib/stdbit.in.h create mode 100644 m4/stdbit_h.m4 create mode 100644 modules/stdbit create mode 100644 modules/stdbit-tests create mode 100644 tests/support/test-driver.c create mode 100644 tests/tst-stdbit.h create mode 100644 tests/tst-stdc_bit_ceil.c create mode 100644 tests/tst-stdc_bit_floor.c create mode 100644 tests/tst-stdc_bit_width.c create mode 100644 tests/tst-stdc_count_ones.c create mode 100644 tests/tst-stdc_count_zeros.c create mode 100644 tests/tst-stdc_first_leading_one.c create mode 100644 tests/tst-stdc_first_leading_zero.c create mode 100644 tests/tst-stdc_first_trailing_one.c create mode 100644 tests/tst-stdc_first_trailing_zero.c create mode 100644 tests/tst-stdc_has_single_bit.c create mode 100644 tests/tst-stdc_leading_ones.c create mode 100644 tests/tst-stdc_leading_zeros.c create mode 100644 tests/tst-stdc_trailing_ones.c create mode 100644 tests/tst-stdc_trailing_zeros.c -- 2.44.0