1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-04-28 06:33:36 +00:00

7224 Commits

Author SHA1 Message Date
Bruno Haible
558143e30b regex: Remove misplaced comment.
* modules/regex (Depends-on): Don't mention uchar-h-c23.
2026-04-25 18:16:12 +02:00
Bruno Haible
e2fb3d721a regex: Fix link error on macOS and FreeBSD (regression yesterday).
* modules/regex (Link): Add $(LIBUNISTRING), $(LIBC32CONV).
* modules/regex-tests (Makefile.am): Link test-regex with
$(LIBUNISTRING) and $(LIBC32CONV).
2026-04-25 11:36:31 +02:00
Paul Eggert
8b9452edea regex: be consistent with dfa
In the regex code, use the char32_t functions instead of the
wchar_t functions, so that regex stays in sync with dfa.
This should fix a bug in Gnu grep reported by Dennis Clarke for
OpenBSD <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=80774#47>.
A similar bug occurs in some macOS releases.
* modules/regex (Depends-on): Replace btowc, iswctype, mbrtowc,
wchar-h, wcrtomb, wctype-h, and wctype with btoc32,
c32_apply_type_test, c32_get_type_test, c32isalnum, c32rtomb,
c32tolower, c32toupper, mbrtoc32-regular, uchar-h.
* lib/regex_internal.h [!_LIBC]: Do not include <wchar.h>, <wctype.h>.
Instead, include <uchar.h> and #define wchar_t, wctype_t,
__wctype, __iswalnum, __iswctype, __towlower, __towupper, __btowc,
__mbrtowc, and __wcrtomb to their char32_t counterparts.
2026-04-24 17:29:50 -07:00
Paul Eggert
4731b2d916 dfa: always use char32_t not wchar_t
This should help merges changes from Gawk, which always uses the
char32_t API though that’s sometimes implemented with the wchar_t
API even on platforms where wchar_t and char32_t act differently.
The idea is to use char32_t uniformly in both the dfa and regex
modules, so that they get consistent answers on all platforms.
* lib/dfa.c, lib/localeinfo.c, lib/localeinfo.h: If GAWK, do not
include <wctype.h> or redefine the Gnulib char32_t types and
functions to be wchar.h and wctype.h functions or define mbszero
and streq, as I think I have a better way to do this with Gawk
that is less intrusive here; instead, always include <uchar.h>.
* lib/dfa.c: Do not include <wchar.h>.  Include "getext.h" before
including "xalloc.h" and "localinfo.h", as Gnulib doesn’t care
about the order and this works better with Gawk’s way of overriding Gnulib.
(parse_bracket_exp): Use && instead of &; either is correct and
both are equally fast nowadays but && triggers a warning in some
Gawk compiles.
* lib/dfa.h (_GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_DEALLOC)
(_GL_ATTRIBUTE_DEALLOC_FREE)
(_GL_ATTRIBUTE_RETURNS_NONNULL) [!_GL_ATTRIBUTE_MALLOC]:
Remove, as Gawk’s custom.h can define them.
* lib/localeinfo.c: Go back to using <verify.h> and ‘verify’
instead of using static_assert which Gawk can’t easily use because
it does not use Gnulib’s assert-h module.
* lib/localeinfo.h: Do not include <limits.h>, avoding some
namespace pollution.
(struct localeinfo): Use (unsigned char) -1 instead of UCHAR_MAX
to avoid the need to include <limits.h>.
* modules/dfa (Depends-on): Remove wchar-h.
2026-04-24 17:29:50 -07:00
Paul Eggert
b6d5b2f729 uchar-h: <string.h> etc. namespace cleanup
This is only a partial cleanup; to be cleaner we’d need to
move declarations of Gnulib extensions like c32isalpha
into a separate .h file.  However, if no Gnulib modules that
extend <uchar.h> are used, Gnulib <uchar.h> is now pretty clean on
recent GNUish platforms.
* lib/uchar.in.h: On GNUish platforms, include <stdint.h>,
<wchar.h>, <wctype.h> only if needed.  Do not include <string.h>,
as we never need it directly: even if we use <string.h>’s memset
via mbszero, <wchar.h> should include <string.h> if needed, as
<wchar.h> defines mbszero.  Move a static_assert from here to tests,
as the static_assert uses a symbol that is no longer guaranteed
to be visible.
* modules/uchar-h (Depends-on): Do not depend on assert-h.
* tests/test-uchar-h.c: Move a static_assert here from lib/uchar.in.h,
and include <wchar.h> so that wchar_t is guaranteed to be visible.
2026-04-24 16:11:27 -07:00
Bruno Haible
acff3d2250 byteswap: Fix compilation on Solaris OpenIndiana (regr. 2026-03-20).
* lib/byteswap.in.h: Include <stdint.h>.
* modules/byteswap (Depends-on): Add stdint-h.
2026-04-16 18:49:36 +02:00
Bruno Haible
001a315786 sigdelay: Add tests.
* tests/test-sigdelay1.c: New file, based on
tests/test-pthread_sigmask1.c.
* tests/test-sigdelay2.c: New file, based on
tests/test-pthread_sigmask2.c.
* modules/sigdelay-tests: New file.
2026-04-15 13:46:08 +02:00
Bruno Haible
006d544083 sigdelay: New module.
* lib/sigdelay.h: New file.
* lib/sigdelay.c: New file.
* modules/sigdelay: New file.
2026-04-15 13:45:52 +02:00
Bruno Haible
1943cae989 sigprocmask: On mingw, avoid dependency on libwinpthread.
* lib/sigprocmask.c: Include windows-tls.h, windows-once.h.
(thread_local): Remove macro.
(struct per_thread): New type.
(tls_key): New variable.
(keys_init): New function.
(keys_init_once): New variable.
(get_per_thread): New function.
(per_thread_singleton): New variable.
(blocked_set, pending_array): Remove variables.
(sigpending, override_handler, pthread_sigmask, _gl_raise_SIGPIPE):
Invoke get_per_thread, to access blocked_set or pending_array.
* modules/sigprocmask (Depends-on): Add windows-once, windows-tls.
2026-04-14 21:56:00 +02:00
Paul Eggert
87fb310b69 doc: be more like POSIX in threading terms
In documentation and comments, be more like POSIX in terminology
involving multithreading.  Explain the distinction between
multithreaded process vs multithreaded program.  Change “program”
to “process” when the latter wording is more accurate or informative.
Simplify the wording for the constraints on processes that use
unlocked I/O.  Change “multithread-safe” to “thread-safe”.
Change “thread-safety” to “thread safety”.
However, do not change “multithreaded” to “multi-threaded” even
though there are some uses of both spellinga, as there are a whole
bunch of uses of “multithreaded”, also in identifier names;
perhaps Gnulib should even standardize on “multithreaded”
(not “multi-threaded”), contra POSIX.
2026-04-11 13:21:19 -07:00
Bruno Haible
91b5ffbdd9 sigprocmask: Support multithreaded applications on native Windows.
* lib/signal.in.h (WIN_PTHREADS_SIGNAL_H): New macro.
* lib/sigprocmask.c: Include windows-spin.h.
(thread_local): New macro.
(blocked_set, pending_array): Mark as thread-local.
(blocked_handler): Remove function.
(struct override): New type.
(overrides, overrides_lock): New variables.
(override_handler): New function.
(pthread_sigmask): New function, borrowing from the previous sigprocmask
definition.
(sigprocmask): Now a wrapper around pthread_sigmask.
(rpl_signal): Use the overrides_lock to make it multithread-safe.
(_gl_raise_SIGPIPE): Add comments.
* modules/sigprocmask (Depends-on): Add windows-spin.
* lib/pthread_sigmask.c: Revert last change. On native Windows, don't
define pthread_sigmask here.
* modules/pthread_sigmask (Depends-on): Remove lock.
* NEWS: Remove the last entry.
2026-04-10 17:22:07 +02:00
Paul Eggert
13d1e8d16c term-style-control: use pthread_sigmask
* lib/term-style-control.c (block_relevant_signals)
(unblock_relevant_signals): Prefer pthread_sigmask to sigprocmask.
* modules/term-style-control (Depends-on):
Depend on pthread_sigmask, not on sigprocmask.
2026-04-05 11:34:35 -07:00
Paul Eggert
a3a1e8974b fatal-signal: use pthread_sigmask
* lib/fatal-signal.c (block_fatal_signals)
(unblock_fatal_signals): Prefer pthread_sigmask to sigprocmask.
* modules/fatal-signal (Depends-on):
Depend on pthread_sigmask, not on sigprocmask.
2026-04-05 11:34:35 -07:00
Paul Eggert
1a914207cb sigaction: use pthread_sigmask
* lib/sigaction.c (sigaction_handler, sigaction):
Use pthread_sigmask, not sigprocmask.
* modules/sigaction (Depends-on):
Depend on pthread_sigmask, not on sigprocmask.
2026-04-05 11:34:34 -07:00
Paul Eggert
12a30be76f pthread_sigmask: lock here, not in sigprocmask
Since sigprocmask should now be used only in single-threaded processes,
move the locking from lib/sigprocmask.c to lib/pthread_sigmask.c.
* lib/pthread_sigmask.c: If !HAVE_SIGPROCMASK &&
!GNULIB_PTHREAD_SIGMASK_SINGLE_THREAD, replace Gnulib sigprocmask
with a thread-safe subsitute sigprocmask_r.
Include glthread/lock.h to implement this.
* lib/sigprocmask.c (gl_lock_define_initialized, gl_lock_lock)
(gl_lock_unlock, sig_lock): Remove.  All uses removed.
Do not include glthread/lock.h.
* m4/signalblocking.m4 (gl_SIGNALBLOCKING):
Define HAVE_SIGPROCMASK, for the benefit of pthread_sigmask.c.
* modules/pthread_sigmask (Depends-on): Add ‘lock’.
* modules/sigprocmask (Depends-on): Remove ‘lock’.
2026-04-05 11:34:34 -07:00
Bruno Haible
e4100b4078 asyncsafe-spin: Prefer pthread_sigmask over sigprocmask.
Suggested by Paul Eggert.

* lib/asyncsafe-spin.c (asyncsafe_spin_lock, asyncsafe_spin_unlock): Use
pthread_sigmask instead of sigprocmask.
* modules/asyncsafe-spin (Depends-on): Add pthread_sigmask. Remove
sigprocmask.
(Link): New section.
* modules/asyncsafe-spin-tests (Makefile.am): Link test-asyncsafe-spin1
with $(PTHREAD_SIGMASK_LIB).
* modules/jit/cache-tests (Makefile.am): Link test-cache with
$(PTHREAD_SIGMASK_LIB).
2026-04-04 22:44:10 +02:00
Bruno Haible
86fe27800e spawn-pipe: Prefer pthread_sigmask over sigprocmask.
Suggested by Paul Eggert.

* lib/spawn-pipe.c (execute): Use pthread_sigmask to get the set of
blocked signals.
* modules/spawn-pipe (Depends-on): Add pthread_sigmask.
2026-04-04 22:26:25 +02:00
Bruno Haible
e82e994cf8 execute: Prefer pthread_sigmask over sigprocmask.
Suggested by Paul Eggert.

* lib/execute.c (execute): Use pthread_sigmask to get the set of blocked
signals.
* modules/execute (Depends-on): Add pthread_sigmask.
2026-04-04 22:15:24 +02:00
Bruno Haible
184fc35f61 pthread_sigmask tests: Enable all tests on NetBSD.
* modules/pthread_sigmask-tests (Depends-on): Remove test-xfail.
(Makefile.am): Don't test OS_IS_NETBSD.
2026-04-04 15:16:17 +02:00
Bruno Haible
dbd5c0e936 sigprocmask: Allow single-thread optimization in a more reliable way.
* modules/sigprocmask: Revert last change.
* lib/sigprocmask.c: Test GNULIB_SIGPROCMASK_SINGLE_THREAD before
including glthread/lock.h.
* doc/multithread.texi: Document GNULIB_SIGPROCMASK_SINGLE_THREAD.
2026-04-01 22:45:55 +02:00
Paul Eggert
4726af921c sigprocmask: allow --avoid=lock
* modules/sigprocmask (Files): Add lib/glthread/lock.h,
so that this module works even if the lock module is avoided.
This is useful for gzip, which does not use multithreading.
2026-03-31 19:57:09 -07:00
Paul Eggert
91150bc6e2 gettext-h: don’t depend on locale-h
This is useful for apps like gzip.h that stay in the C locale
and don’t need all the the locale-h machinery.
* lib/gettext.h: Include <locale.h> only if !ENABLE_NLS && __sun.
(pgettext, dpgettext, npgettext, dnpgettext, pgettext_expr)
(npgettext_expr): Use _GL_LC_MESSAGES, not LC_MESSAGES.
* m4/gettext_h.m4 (gl_GETTEXT_H): Define _GL_LC_MESSAGES.
* modules/gettext-h (Depends-on): Remove locale-h.
2026-03-31 19:57:09 -07:00
Collin Funk
7dcb0a5b6c vasprintf-posix, vasprintf, stdio-windows: Prefer AC_CHECK_FUNCS_ONCE.
* m4/vasprintf-posix.m4 (gl_FUNC_VASPRINTF_IS_POSIX): Use
AC_CHECK_FUNCS_ONCE instead of AC_CHECK_FUNCS.
* m4/vasprintf.m4 (gl_FUNC_VASPRINTF): Likewise.
* modules/stdio-windows: Likewise.
2026-03-20 18:43:34 -07:00
Paul Eggert
ca5f09c318 byteswap: depend on stdbit-h, not stdint-h
* lib/byteswap.in.h: Do not include stdint.h, as stdbit.h suffices.
* modules/byteswap (Depends-on): Depend on stdbit-h, not stdint-h.
2026-03-20 15:41:37 -07:00
Paul Eggert
3de66b092f countof-h: use countof, part 3
* lib/nproc.c, lib/regex_internal.h, lib/set-permissions.c:
* lib/strftime.c:
Include <stdcountof.h>.
* lib/nproc.c (ARRAY_SIZE):
* lib/sig2str.c (NUNNAME_ENTRIES):
Remove.  All uses replaced with countof.
* lib/regcomp.c (regerror):
* lib/set-permissions.c (set_acls_from_mode):
* lib/strftime.c (__strftime_internal):
Use countof instead of doing it by hand.
* modules/acl-permissions, modules/c-nstrftime, modules/fprintftime:
* modules/nproc, modules/regex, modules/nstrftime:
* modules/nstrftime-limited, modules/sig2str:
Depend on stdcountof-h.
2026-03-20 14:55:35 -07:00
Paul Eggert
4e11e3d07a stdbit-h: don’t generate some dummy .o files
On recent GNU and other C23ish platforms, do not compile files
like lib/stdc_bit_ceil.c, as the corresponding .o files contain
nothing useful.
* m4/stdbit_h.m4 (gl_STDBIT_H):
Define the Automake condition GL_HAVE_STDBIT_H.
Quote cache variables in case the cache is bad.
* modules/stdc_bit_ceil, modules/stdc_bit_floor:
* modules/stdc_bit_width, modules/stdc_count_ones:
* modules/stdc_count_zeros, modules/stdc_first_leading_one:
* modules/stdc_first_leading_zero:
* modules/stdc_first_trailing_one:
* modules/stdc_first_trailing_zero, modules/stdc_has_single_bit:
* modules/stdc_leading_ones, modules/stdc_leading_zeros:
* modules/stdc_trailing_ones, modules/stdc_trailing_zeros:
Generate if !GL_HAVE_STDBIT_H, not if GL_GENERATE_STDBIT_H.
2026-03-16 15:17:58 -07:00
Paul Eggert
01b366c149 stdbit-h: remove stdbit.c
lib/stdbit.c was present only to define private helper functions.
Move them into lib/stdc_leading_zeros.c and
lib/stdc_trailing_zeros.c, depending on what they help.
The latter now might use the former, since the
_gl_stdbit_ctz family calls the _gl_stdbit_clz family
when !defined _GL_STDBIT_HAS_BUILTIN_CTZ && !defined _MSC_VER,
so stdc_trailing_zeros now depends on stdc_leading_zeros.
* lib/stdbit.c: Remove file.
* lib/stdbit.in.h (_GL_STDBIT_INLINE): Remove.
All uses replaced by _GL_STDC_LEADING_ZEROS_INLINE
or _GL_STDC_TRAILING_ZEROS_INLINE.
* modules/stdbit-h (Files, lib_SOURCES): Remove lib/stdbit.c.
* modules/stdc_trailing_zeros (Depends-on): Add stdc_leading_zeros.
2026-03-16 00:03:12 -07:00
Paul Eggert
6a370d149b stdbit-h: test without <stdint.h>
Improve the <stdbit.h> tests so that they check
that <stdbit.h> works even if <stdint.h> is not included.
* modules/stdc_bit_ceil-tests, modules/stdc_bit_floor-tests:
* modules/stdc_bit_width-tests, modules/stdc_count_ones-tests:
* modules/stdc_count_zeros-tests:
* modules/stdc_first_leading_one-tests:
* modules/stdc_first_leading_zero-tests:
* modules/stdc_first_trailing_one-tests:
* modules/stdc_first_trailing_zero-tests:
* modules/stdc_has_single_bit-tests:
* modules/stdc_leading_ones-tests:
* modules/stdc_leading_zeros-tests:
* modules/stdc_trailing_ones-tests:
* modules/stdc_trailing_zeros-tests:
(Depends-on): Remove stdint-h.
* tests/from-glibc/tst-stdbit.h [GNULIB_TEST_STDBIT]:
Do not include <stdint.h>.
2026-03-16 00:03:12 -07:00
Paul Eggert
ac50a945f8 stdbit-h: don’t depend on stdint-h
* modules/stdc_load8, modules/stdc_load8_aligned:
* modules/stdc_store8, modules/stdc_store8_aligned:
* modules/stdc_memreverse8u:
(Depends-on): Remove stdint-h, as Gnulib should be able to assume
the small subset of C99 <stdint.h> that stdbit.in.h uses.
2026-03-16 00:03:12 -07:00
Collin Funk
766f86918b stdc_rotate_right: Add tests.
* modules/stdc_rotate_right-tests: New file.
* tests/test-stdc_rotate_right.c: Likewise.
2026-03-15 17:07:38 -07:00
Collin Funk
7ffbb1f4fe stdc_rotate_right: New module.
* lib/stdbit.in.h (_GL_STDC_ROTATE_RIGHT_INLINE, _gl_stdc_rotate_right)
(stdc_rotate_right): New macros.
(stdc_rotate_right_uc, stdc_rotate_right_us, stdc_rotate_right_ui)
(stdc_rotate_right_ul, stdc_rotate_right_ull): New functions.
* lib/stdc_rotate_right.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_ROTATE_RIGHT.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_ROTATE_RIGHT.
* modules/stdc_rotate_right: New file.
* doc/posix-functions/stdc_rotate_right.texi: Mention the new module.
2026-03-15 17:07:32 -07:00
Collin Funk
72e6d321dd stdc_rotate_left: Add tests.
* modules/stdc_rotate_left-tests: New file.
* tests/test-stdc_rotate_left.c: Likewise.
2026-03-15 17:06:53 -07:00
Collin Funk
ef7f169531 stdc_rotate_left: New module.
* lib/stdbit.in.h (_GL_STDC_ROTATE_LEFT_INLINE, _gl_stdc_rotate_left)
(stdc_rotate_left): New macros.
(stdc_rotate_left_uc, stdc_rotate_left_us, stdc_rotate_left_ui)
(stdc_rotate_left_ul, stdc_rotate_left_ull): New functions.
* lib/stdc_rotate_left.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_ROTATE_LEFT.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_ROTATE_LEFT.
* modules/stdc_rotate_left: New file.
* doc/posix-functions/stdc_rotate_left.texi: Mention the new module.
2026-03-15 17:06:50 -07:00
Bruno Haible
057b44988b stdc_memreverse8: Add tests.
* tests/test-stdc_memreverse8.c: New file.
* modules/stdc_memreverse8-tests: New file.
2026-03-15 14:48:43 +01:00
Bruno Haible
d5be14cfa1 stdc_memreverse8: New module.
* lib/stdbit.in.h: Include <stddef.h>.
(_GL_STDC_MEMREVERSE8_INLINE): New macro.
(stdc_memreverse8): New function.
* lib/stdc_memreverse8.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_MEMREVERSE8.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_MEMREVERSE8.
* modules/stdc_memreverse8: New file.
* doc/posix-functions/stdc_memreverse8.texi: Mention the new module.
2026-03-15 14:35:48 +01:00
Bruno Haible
7f47771c48 byteswap: Rely on <stdbit.h>.
* lib/byteswap.in.h: Include <stdbit.h>.
(_GL_BYTESWAP_HAS_BUILTIN_BSWAP16, _GL_BYTESWAP_HAS_BUILTIN_BSWAP32,
_GL_BYTESWAP_HAS_BUILTIN_BSWAP64): Remove macros.
(bswap_16): Just call stdc_memreverse8u16.
(bswap_32): Just call stdc_memreverse8u32.
(bswap_64): Just call stdc_memreverse8u64.
* modules/byteswap (Depends-on): Add stdc_memreverse8u. Remove bool.
2026-03-15 13:30:37 +01:00
Bruno Haible
56df453390 stdc_load8_aligned, stdc_store8_aligned: Don't use <byteswap.h>.
* lib/stdbit.in.h: Don't include <byteswap.h>.
(_GL_STDBIT_BSWAP16, _GL_STDBIT_BSWAP32, _GL_STDBIT_BSWAP64): Remove
macros.
(stdc_memreverse8u8, stdc_memreverse8u16, stdc_memreverse8u32,
stdc_memreverse8u64): Generalize: Take uint_least* parameter.
(stdc_load8_aligned_*, stdc_store8_aligned_*): Use stdc_memreverse8u16,
stdc_memreverse8u32, stdc_memreverse8u64 instead of _GL_STDBIT_BSWAP16,
_GL_STDBIT_BSWAP32, _GL_STDBIT_BSWAP64.
2026-03-15 13:24:24 +01:00
Bruno Haible
ee8c16407d stdc_memreverse8u: Add tests.
* tests/test-stdc_memreverse8u.c: New file, based on
tests/test-byteswap.c.
* modules/stdc_memreverse8u-tests: New file.
2026-03-15 13:05:20 +01:00
Bruno Haible
81546b416c stdc_memreverse8u: New module.
* lib/stdbit.in.h (_GL_STDC_MEMREVERSE8U_INLINE): New macro.
(stdc_memreverse8u8, stdc_memreverse8u16, stdc_memreverse8u32,
stdc_memreverse8u64): New functions, based on lib/byteswap.in.h.
* lib/stdc_memreverse8u.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_MEMREVERSE8U.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_MEMREVERSE8U.
* modules/stdc_memreverse8u: New file.
* doc/posix-functions/stdc_memreverse8u8.texi: Mention the new module.
* doc/posix-functions/stdc_memreverse8u16.texi: Likewise.
* doc/posix-functions/stdc_memreverse8u32.texi: Likewise.
* doc/posix-functions/stdc_memreverse8u64.texi: Likewise.
2026-03-15 13:01:49 +01:00
Bruno Haible
6ac43814a5 hamt: Don't use deprecated module.
* lib/hamt.c: Include <stdbit.h> instead of count-one-bits.h.
(trienode_count, subtrie_lookup, subtrie_insert, subtrie_remove): Call
stdc_count_ones instead of count_one_bits.
* modules/hamt (Depends-on): Add stdc_count_ones. Remove count-one-bits.
2026-03-15 10:13:52 +01:00
Bruno Haible
84cda94746 count-*: Fix module status (regression yesterday).
* modules/count-leading-zeros: Mark as deprecated, not obsolete.
Recommend module 'stdc_leading_zeros' instead of 'stdbit'.
* modules/count-trailing-zeros: Mark as deprecated, not obsolete.
Recommend module 'stdc_trailing_zeros' instead of 'stdbit'.
* modules/count-one-bits: Mark as deprecated, not obsolete. Recommend
module 'stdc_count_ones' instead of 'stdbit'.
* NEWS: Update.
2026-03-15 10:01:57 +01:00
Paul Eggert
9ab77fcaad stdbit: obsolete older count-* modules
* modules/count-leading-zeros:
* modules/count-one-bits:
* modules/count-trailing-zeros: Now obsolete,
as the stdbit module is now mature enough.
2026-03-14 19:00:25 -07:00
Paul Eggert
b70f85852a stdbit-h: restore optimization for RISC-V etc
Problem reported by Bruno Haible in:
https://lists.gnu.org/r/bug-gnulib/2026-03/msg00098.html
This patch does the optimization in a different way,
preferring plain ‘if’ to ‘#if’ if either will do.
* lib/stdbit.in.h: Bring back includes for byteswap.h, string.h.
(_GL_STDBIT_OPTIMIZE_VIA_MEMCPY, _GL_STDBIT_ASSUME_ALIGNED)
(_GL_STDBIT_BIGENDIAN): New macros.
(stdc_load8_beu16, stdc_load8_leu16):
Bring back casts to uint_fast16_t.
(stdc_load8_aligned_beu16, stdc_load8_aligned_beu32)
(stdc_load8_aligned_beu64, stdc_load8_aligned_leu16)
(stdc_load8_aligned_leu32, stdc_load8_aligned_leu64)
(stdc_load8_aligned_bes8, stdc_load8_aligned_bes16)
(stdc_load8_aligned_bes32, stdc_load8_aligned_bes64)
(stdc_load8_aligned_les8, stdc_load8_aligned_les16)
(stdc_load8_aligned_les32, stdc_load8_aligned_les64)
(stdc_store8_aligned_beu16, stdc_store8_aligned_beu32)
(stdc_store8_aligned_beu64, stdc_store8_aligned_leu16)
(stdc_store8_aligned_leu32, stdc_store8_aligned_leu64)
(stdc_store8_aligned_bes8, stdc_store8_aligned_bes16)
(stdc_store8_aligned_bes32, stdc_store8_aligned_bes64)
(stdc_store8_aligned_les8, stdc_store8_aligned_les16)
(stdc_store8_aligned_les32, stdc_store8_aligned_les64):
Bring back the memcpy optimization if _GL_STDBIT_OPTIMIZE_VIA_MEMCPY.
* modules/stdc_load8_aligned (Depends-on):
* modules/stdc_store8_aligned (Depends-on):
Go back to depending on byteswap.
2026-03-13 18:22:05 -07:00
Paul Eggert
b1996e0f1d stdbit-h: simpler fix for -fno-strict-aliasing
* lib/stdbit.in.h: Do not include byteswap.h.
(_GL_LOADSTORE8_VARIANT_A, _GL_LOADSTORE8_VARIANT_E)
(_GL_LOADSTORE8_VARIANT_F): Remove.
(stdc_load8_aligned_beu8, stdc_load8_aligned_beu16)
(stdc_load8_aligned_beu32, stdc_load8_aligned_beu64)
(stdc_load8_aligned_leu8, stdc_load8_aligned_leu16)
(stdc_load8_aligned_leu32, stdc_load8_aligned_leu64)
(stdc_load8_aligned_bes8, stdc_load8_aligned_bes16)
(stdc_load8_aligned_bes32, stdc_load8_aligned_bes64)
(stdc_load8_aligned_les8, stdc_load8_aligned_les16)
(stdc_load8_aligned_les32, stdc_load8_aligned_les64)
(stdc_store8_aligned_beu8, stdc_store8_aligned_beu16)
(stdc_store8_aligned_beu32, stdc_store8_aligned_beu64)
(stdc_store8_aligned_leu8, stdc_store8_aligned_leu16)
(stdc_store8_aligned_leu32, stdc_store8_aligned_leu64)
(stdc_store8_aligned_bes8, stdc_store8_aligned_bes16)
(stdc_store8_aligned_bes32, stdc_store8_aligned_bes64)
(stdc_store8_aligned_les8, stdc_store8_aligned_les16)
(stdc_store8_aligned_les32, stdc_store8_aligned_les64):
Simplifly by deferring to their unaligned counterparts.
* modules/stdc_load8_aligned (Depends-on):
Depend on stdc_load8, not byteswap.
* modules/stdc_store8_aligned (Depends-on):
Depend on stdc_store8, not byteswap.
2026-03-13 12:49:05 -07:00
Paul Eggert
b29a052129 stdbit-h: add test for recent aligned issue.
Adapted from test by Lasse Collin <lasse.collin@tukaani.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-03/msg00094.html>.
* modules/stdc_store8_aligned-tests (Depends-on):
Depend on stdc_load8_aligned.
* tests/test-stdc_store8_aligned.c (test_strict_aliasing): New test.
(main): Use it.
2026-03-13 11:45:56 -07:00
Bruno Haible
7c1559af22 stdc_store8: Add tests.
* tests/test-stdc_store8.c: New file, based on
tests/test-stdc_store8_aligned.c.
* modules/stdc_store8-tests: New file.
2026-03-13 09:07:17 +01:00
Bruno Haible
00f3819ced stdc_store8: New module.
* lib/stdbit.in.h (_GL_STDC_STORE8_INLINE): New macro.
(stdc_store8_beu{8,16,32,64}, stdc_store8_leu{8,16,32,64},
stdc_store8_bes{8,16,32,64}, stdc_store8_les{8,16,32,64}): New
functions.
* lib/stdc_store8.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_STORE8.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_STORE8.
* modules/stdc_store8: New file.
* doc/posix-functions/stdc_store8_beu8.texi: Mention the new module.
* doc/posix-functions/stdc_store8_beu16.texi: Likewise.
* doc/posix-functions/stdc_store8_beu32.texi: Likewise.
* doc/posix-functions/stdc_store8_beu64.texi: Likewise.
* doc/posix-functions/stdc_store8_leu8.texi: Likewise.
* doc/posix-functions/stdc_store8_leu16.texi: Likewise.
* doc/posix-functions/stdc_store8_leu32.texi: Likewise.
* doc/posix-functions/stdc_store8_leu64.texi: Likewise.
* doc/posix-functions/stdc_store8_bes8.texi: Likewise.
* doc/posix-functions/stdc_store8_bes16.texi: Likewise.
* doc/posix-functions/stdc_store8_bes32.texi: Likewise.
* doc/posix-functions/stdc_store8_bes64.texi: Likewise.
* doc/posix-functions/stdc_store8_les8.texi: Likewise.
* doc/posix-functions/stdc_store8_les16.texi: Likewise.
* doc/posix-functions/stdc_store8_les32.texi: Likewise.
* doc/posix-functions/stdc_store8_les64.texi: Likewise.
2026-03-13 08:48:11 +01:00
Bruno Haible
f526033fc5 stdc_store8_aligned: Add tests.
* tests/test-stdc_store8_aligned.c: New file.
* modules/stdc_store8_aligned-tests: New file.
2026-03-13 08:13:57 +01:00
Bruno Haible
b48c4f8a18 stdc_store8_aligned: New module.
* lib/stdbit.in.h (_GL_STDC_STORE8_ALIGNED_INLINE): New macro.
(stdc_store8_aligned_beu{8,16,32,64},
stdc_store8_aligned_leu{8,16,32,64},
stdc_store8_aligned_bes{8,16,32,64},
stdc_store8_aligned_les{8,16,32,64}): New functions.
* lib/stdc_store8_aligned.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_STORE8_ALIGNED.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_STORE8_ALIGNED.
* modules/stdc_store8_aligned: New file.
* doc/posix-functions/stdc_store8_aligned_beu8.texi: Mention the new
module.
* doc/posix-functions/stdc_store8_aligned_beu16.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_beu32.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_beu64.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_leu8.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_leu16.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_leu32.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_leu64.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_bes8.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_bes16.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_bes32.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_bes64.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_les8.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_les16.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_les32.texi: Likewise.
* doc/posix-functions/stdc_store8_aligned_les64.texi: Likewise.
2026-03-13 07:57:41 +01:00
Bruno Haible
b95d0eb8bb stdc_load8: Add tests.
* tests/test-stdc_load8.c: New file, based on
tests/test-stdc_load8_aligned.c.
* modules/stdc_load8-tests: New file.
2026-03-12 20:38:27 +01:00