]> git.ipfire.org Git - thirdparty/gnulib.git/log
thirdparty/gnulib.git
8 weeks agostdbit-h: avoid <byteswap.h> namespace pollution
Paul Eggert [Sat, 14 Mar 2026 22:15:50 +0000 (15:15 -0700)] 
stdbit-h: avoid <byteswap.h> namespace pollution

* lib/stdbit.in.h (_GL_STDBIT_HAS_BUILTIN_BSWAP16)
(_GL_STDBIT_HAS_BUILTIN_BSWAP32, _GL_STDBIT_HAS_BUILTIN_BSWAP64)
(_GL_STDBIT_BSWAP16, _GL_STDBIT_BSWAP32, _GL_STDBIT_BSWAP64):
New macros.  All uses of bswap_16, bswap_32, bswap_64 changed.

8 weeks agostdbit-h: avoid <string.h> namespace pollution
Paul Eggert [Sat, 14 Mar 2026 21:27:18 +0000 (14:27 -0700)] 
stdbit-h: avoid <string.h> namespace pollution

* lib/stdbit.in.h (_GL_STDBIT_MEMCPY): New macro.
All uses of memcpy changed.

8 weeks agostdbit-h: __has_builtin (__builtin_assume_aligned)
Paul Eggert [Sat, 14 Mar 2026 20:07:54 +0000 (13:07 -0700)] 
stdbit-h: __has_builtin (__builtin_assume_aligned)

Prefer the usual pattern for checking for builtins:
allow __has_builtin for compilers that are not Clang or GCC
where we already have something.
* lib/stdbit.in.h (_GL_HAS_BUILTIN_ASSUME_ALIGNED): New macro.
(_GL_STDBIT_ASSUME_ALIGNED): Use it.

8 weeks agodoc: assume copy to int preserves low order bits
Paul Eggert [Sat, 14 Mar 2026 19:23:13 +0000 (12:23 -0700)] 
doc: assume copy to int preserves low order bits

8 weeks agodoc: fix typos re Unisys ClearPath Libra
Paul Eggert [Sat, 14 Mar 2026 19:21:55 +0000 (12:21 -0700)] 
doc: fix typos re Unisys ClearPath Libra

8 weeks agostdbit-h: adjust comments to match code
Paul Eggert [Sat, 14 Mar 2026 18:30:35 +0000 (11:30 -0700)] 
stdbit-h: adjust comments to match code

* lib/stdbit.in.h: Adjust commentary to match code’s types
and use of if rather than #if.

2 months agostdbit-h: restore optimization for RISC-V etc
Paul Eggert [Sat, 14 Mar 2026 00:44:06 +0000 (17:44 -0700)] 
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.

2 months agostdbit-h: fewer casts
Paul Eggert [Fri, 13 Mar 2026 19:29:50 +0000 (12:29 -0700)] 
stdbit-h: fewer casts

* lib/stdbit.in.h (stdc_load8_beu16, stdc_load8_leu16)
(stdc_store8_beu16, stdc_store8_beu32, stdc_store8_beu64)
(stdc_store8_leu16, stdc_store8_leu32, stdc_store8_leu64):
Avoid unnecessary and sometimes-confusing casts.

2 months agostdbit-h: simplify stdc_{load,store)_[bl]e[s]*
Paul Eggert [Fri, 13 Mar 2026 19:25:11 +0000 (12:25 -0700)] 
stdbit-h: simplify stdc_{load,store)_[bl]e[s]*

* lib/stdbit.in.h (stdc_load8_bes8, stdc_load8_bes16)
(stdc_load8_bes32, stdc_load8_bes64, stdc_load8_les8)
(stdc_load8_les16, stdc_load8_les32, stdc_load8_les64)
(stdc_store8_bes8, stdc_store8_bes16, stdc_store8_bes32)
(stdc_store8_bes64, stdc_store8_les8, stdc_store8_les16)
(stdc_store8_les32, stdc_store8_les64):
Simplify by deferring to the unsigned counterpart.

2 months agostdbit-h: simpler fix for -fno-strict-aliasing
Paul Eggert [Fri, 13 Mar 2026 18:53:13 +0000 (11:53 -0700)] 
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.

2 months agostdbit-h: add test for recent aligned issue.
Paul Eggert [Fri, 13 Mar 2026 18:43:49 +0000 (11:43 -0700)] 
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.

2 months agostdc_load8_aligned, stdc_store8_aligned: Fix strict aliasing violations.
Bruno Haible [Fri, 13 Mar 2026 17:53:39 +0000 (18:53 +0100)] 
stdc_load8_aligned, stdc_store8_aligned: Fix strict aliasing violations.

Reported by Lasse Collin <lasse.collin@tukaani.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-03/msg00094.html>.

* lib/stdbit.in.h: Include <string.h>.
(_GL_LOADSTORE8_VARIANT_A, _GL_LOADSTORE8_VARIANT_E,
_GL_LOADSTORE8_VARIANT_F): New macros.
(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_load8_bes8, stdc_load8_les8, 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): Don't cast a pointer to a pointer to a
different element type.

2 months agostdc_store8: Add tests.
Bruno Haible [Fri, 13 Mar 2026 08:07:17 +0000 (09:07 +0100)] 
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.

2 months agostdc_store8: New module.
Bruno Haible [Fri, 13 Mar 2026 07:48:11 +0000 (08:48 +0100)] 
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.

2 months agostdc_store8_aligned: Add tests.
Bruno Haible [Fri, 13 Mar 2026 07:13:57 +0000 (08:13 +0100)] 
stdc_store8_aligned: Add tests.

* tests/test-stdc_store8_aligned.c: New file.
* modules/stdc_store8_aligned-tests: New file.

2 months agostdc_store8_aligned: New module.
Bruno Haible [Fri, 13 Mar 2026 06:57:41 +0000 (07:57 +0100)] 
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.

2 months agostdc_load8: Add tests.
Bruno Haible [Thu, 12 Mar 2026 19:38:27 +0000 (20:38 +0100)] 
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.

2 months agostdc_load8: New module.
Bruno Haible [Thu, 12 Mar 2026 19:37:13 +0000 (20:37 +0100)] 
stdc_load8: New module.

* lib/stdbit.in.h (_GL_STDC_LOAD8_INLINE): New macro.
(stdc_load8_beu{8,16,32,64}, stdc_load8_leu{8,16,32,64},
stdc_load8_bes{8,16,32,64}, stdc_load8_les{8,16,32,64}): New functions.
* lib/stdc_load8.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_LOAD8.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_LOAD8.
* modules/stdc_load8: New file.
* doc/posix-functions/stdc_load8_beu8.texi: Mention the new module.
* doc/posix-functions/stdc_load8_beu16.texi: Likewise.
* doc/posix-functions/stdc_load8_beu32.texi: Likewise.
* doc/posix-functions/stdc_load8_beu64.texi: Likewise.
* doc/posix-functions/stdc_load8_leu8.texi: Likewise.
* doc/posix-functions/stdc_load8_leu16.texi: Likewise.
* doc/posix-functions/stdc_load8_leu32.texi: Likewise.
* doc/posix-functions/stdc_load8_leu64.texi: Likewise.
* doc/posix-functions/stdc_load8_bes8.texi: Likewise.
* doc/posix-functions/stdc_load8_bes16.texi: Likewise.
* doc/posix-functions/stdc_load8_bes32.texi: Likewise.
* doc/posix-functions/stdc_load8_bes64.texi: Likewise.
* doc/posix-functions/stdc_load8_les8.texi: Likewise.
* doc/posix-functions/stdc_load8_les16.texi: Likewise.
* doc/posix-functions/stdc_load8_les32.texi: Likewise.
* doc/posix-functions/stdc_load8_les64.texi: Likewise.

2 months agostdc_load8_aligned: Add tests.
Bruno Haible [Thu, 12 Mar 2026 18:37:52 +0000 (19:37 +0100)] 
stdc_load8_aligned: Add tests.

* tests/test-stdc_load8_aligned.c: New file.
* modules/stdc_load8_aligned-tests: New file.

2 months agostdc_load8_aligned: New module.
Bruno Haible [Thu, 12 Mar 2026 14:31:41 +0000 (15:31 +0100)] 
stdc_load8_aligned: New module.

* lib/stdbit.in.h: Include <stdint.h>, <byteswap.h>.
(_GL_STDC_LOAD8_ALIGNED_INLINE): New macro.
(stdc_load8_aligned_beu{8,16,32,64}, stdc_load8_aligned_leu{8,16,32,64},
stdc_load8_aligned_bes{8,16,32,64}, stdc_load8_aligned_les{8,16,32,64}):
New functions.
* lib/stdc_load8_aligned.c: New file.
* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STDC_LOAD8_ALIGNED.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_STDC_LOAD8_ALIGNED.
* modules/stdc_load8_aligned: New file.
* doc/posix-functions/stdc_load8_aligned_beu8.texi: Mention the new
module.
* doc/posix-functions/stdc_load8_aligned_beu16.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_beu32.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_beu64.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_leu8.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_leu16.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_leu32.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_leu64.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_bes8.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_bes16.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_bes32.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_bes64.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_les8.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_les16.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_les32.texi: Likewise.
* doc/posix-functions/stdc_load8_aligned_les64.texi: Likewise.

2 months agodoc: Document C2y stdc_* <stdbit.h> functions, part 2.
Bruno Haible [Thu, 12 Mar 2026 12:06:23 +0000 (13:06 +0100)] 
doc: Document C2y stdc_* <stdbit.h> functions, part 2.

* doc/posix-functions/stdc_load8_aligned_bes8.texi: New file.
* doc/posix-functions/stdc_load8_aligned_bes16.texi: New file.
* doc/posix-functions/stdc_load8_aligned_bes32.texi: New file.
* doc/posix-functions/stdc_load8_aligned_bes64.texi: New file.
* doc/posix-functions/stdc_load8_aligned_beu8.texi: New file.
* doc/posix-functions/stdc_load8_aligned_beu16.texi: New file.
* doc/posix-functions/stdc_load8_aligned_beu32.texi: New file.
* doc/posix-functions/stdc_load8_aligned_beu64.texi: New file.
* doc/posix-functions/stdc_load8_bes8.texi: New file.
* doc/posix-functions/stdc_load8_bes16.texi: New file.
* doc/posix-functions/stdc_load8_bes32.texi: New file.
* doc/posix-functions/stdc_load8_bes64.texi: New file.
* doc/posix-functions/stdc_load8_beu8.texi: New file.
* doc/posix-functions/stdc_load8_beu16.texi: New file.
* doc/posix-functions/stdc_load8_beu32.texi: New file.
* doc/posix-functions/stdc_load8_beu64.texi: New file.
* doc/posix-functions/stdc_store8_aligned_bes8.texi: New file.
* doc/posix-functions/stdc_store8_aligned_bes16.texi: New file.
* doc/posix-functions/stdc_store8_aligned_bes32.texi: New file.
* doc/posix-functions/stdc_store8_aligned_bes64.texi: New file.
* doc/posix-functions/stdc_store8_aligned_beu8.texi: New file.
* doc/posix-functions/stdc_store8_aligned_beu16.texi: New file.
* doc/posix-functions/stdc_store8_aligned_beu32.texi: New file.
* doc/posix-functions/stdc_store8_aligned_beu64.texi: New file.
* doc/posix-functions/stdc_store8_bes8.texi: New file.
* doc/posix-functions/stdc_store8_bes16.texi: New file.
* doc/posix-functions/stdc_store8_bes32.texi: New file.
* doc/posix-functions/stdc_store8_bes64.texi: New file.
* doc/posix-functions/stdc_store8_beu8.texi: New file.
* doc/posix-functions/stdc_store8_beu16.texi: New file.
* doc/posix-functions/stdc_store8_beu32.texi: New file.
* doc/posix-functions/stdc_store8_beu64.texi: New file.
* doc/gnulib.texi (Functions in <stdbit.h>): Include these new files.
* doc/posix-functions/stdc_load8_aligned_les16.texi: No module yet.
* doc/posix-functions/stdc_load8_aligned_les32.texi: No module yet.
* doc/posix-functions/stdc_load8_aligned_les64.texi: No module yet.
* doc/posix-functions/stdc_load8_aligned_les8.texi: No module yet.
* doc/posix-functions/stdc_load8_aligned_leu16.texi: No module yet.
* doc/posix-functions/stdc_load8_aligned_leu32.texi: No module yet.
* doc/posix-functions/stdc_load8_aligned_leu64.texi: No module yet.
* doc/posix-functions/stdc_load8_aligned_leu8.texi: No module yet.
* doc/posix-functions/stdc_load8_les16.texi: No module yet.
* doc/posix-functions/stdc_load8_les32.texi: No module yet.
* doc/posix-functions/stdc_load8_les64.texi: No module yet.
* doc/posix-functions/stdc_load8_les8.texi: No module yet.
* doc/posix-functions/stdc_load8_leu16.texi: No module yet.
* doc/posix-functions/stdc_load8_leu32.texi: No module yet.
* doc/posix-functions/stdc_load8_leu64.texi: No module yet.
* doc/posix-functions/stdc_load8_leu8.texi: No module yet.
* doc/posix-functions/stdc_memreverse8.texi: No module yet.
* doc/posix-functions/stdc_memreverse8u16.texi: No module yet.
* doc/posix-functions/stdc_memreverse8u32.texi: No module yet.
* doc/posix-functions/stdc_memreverse8u64.texi: No module yet.
* doc/posix-functions/stdc_memreverse8u8.texi: No module yet.
* doc/posix-functions/stdc_rotate_left.texi: No module yet.
* doc/posix-functions/stdc_rotate_right.texi: No module yet.
* doc/posix-functions/stdc_store8_aligned_les16.texi: No module yet.
* doc/posix-functions/stdc_store8_aligned_les32.texi: No module yet.
* doc/posix-functions/stdc_store8_aligned_les64.texi: No module yet.
* doc/posix-functions/stdc_store8_aligned_les8.texi: No module yet.
* doc/posix-functions/stdc_store8_aligned_leu16.texi: No module yet.
* doc/posix-functions/stdc_store8_aligned_leu32.texi: No module yet.
* doc/posix-functions/stdc_store8_aligned_leu64.texi: No module yet.
* doc/posix-functions/stdc_store8_aligned_leu8.texi: No module yet.
* doc/posix-functions/stdc_store8_les16.texi: No module yet.
* doc/posix-functions/stdc_store8_les32.texi: No module yet.
* doc/posix-functions/stdc_store8_les64.texi: No module yet.
* doc/posix-functions/stdc_store8_les8.texi: No module yet.
* doc/posix-functions/stdc_store8_leu16.texi: No module yet.
* doc/posix-functions/stdc_store8_leu32.texi: No module yet.
* doc/posix-functions/stdc_store8_leu64.texi: No module yet.
* doc/posix-functions/stdc_store8_leu8.texi: No module yet.

2 months agostdbit-h: Finish handling multiple gnulib-tool invocations.
Collin Funk [Thu, 12 Mar 2026 11:21:44 +0000 (12:21 +0100)] 
stdbit-h: Finish handling multiple gnulib-tool invocations.

* lib/stdbit.in.h: Setup #include_next for the system stdbit.h. Don't
declare C23 functions if the system has stdbit.h.
* m4/stdbit_h.m4 (gl_STDBIT_H): Define HAVE_STDBIT_H. Check for
stdc_rotate_left_uc to see if the system header is missing C2y features.
* modules/stdbit-h (Depends-on): Add include_next.
(Makefile.am): Substitute @HAVE_STDBIT_H@ and some variables needed for

2 months agovaprintf: Add tests.
Bruno Haible [Wed, 11 Mar 2026 17:23:43 +0000 (18:23 +0100)] 
vaprintf: Add tests.

* tests/test-vaprintf.c: New file, based on tests/test-xvasprintf.c.
* modules/vaprintf-tests: New file.

2 months agovaprintf: New module.
Bruno Haible [Wed, 11 Mar 2026 17:22:19 +0000 (18:22 +0100)] 
vaprintf: New module.

* lib/stdio.in.h (_GL_ATTRIBUTE_DEALLOC_FREE): New macro, copied from
lib/string.in.h.
(free, rpl_free): Define as in lib/string.in.h.
(aprintf, vaprintf): New declarations.
* lib/vaprintf.c: New file, based on lib/xvasprintf.c.
* lib/aprintf.c: New file, based on lib/xasprintf.c.
* m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize
GNULIB_VAPRINTF. Require gl_STDLIB_H_REQUIRE_DEFAULTS.
* modules/stdio-h (Depends-on): Add stdlib-h.
(Makefile.am): Substitute GNULIB_VAPRINTF, GNULIB_FREE_POSIX,
REPLACE_FREE.
* modules/vaprintf: New file.

2 months agoxvasprintf-tests: Fix typo.
Bruno Haible [Wed, 11 Mar 2026 17:15:58 +0000 (18:15 +0100)] 
xvasprintf-tests: Fix typo.

* tests/test-xvasprintf.c (test_xasprintf): Test xasprintf, not
my_xasprintf.

2 months agodoc: Fix documentation that was added today.
Bruno Haible [Mon, 9 Mar 2026 19:35:43 +0000 (20:35 +0100)] 
doc: Fix documentation that was added today.

* doc/posix-functions/stdc_*.texi: Reflect current state of gnulib.

2 months agoc32tolower, c32toupper: Fix for Turkish locale in Cygwin 3.6.7.
Bruno Haible [Mon, 9 Mar 2026 13:10:43 +0000 (14:10 +0100)] 
c32tolower, c32toupper: Fix for Turkish locale in Cygwin 3.6.7.

* lib/c32to-impl.h (FUNC): Move _GL_SMALL_WCHAR_T case up.

2 months agodoc: Document C2y stdc_* <stdbit.h> functions.
Bruno Haible [Mon, 9 Mar 2026 11:15:09 +0000 (12:15 +0100)] 
doc: Document C2y stdc_* <stdbit.h> functions.

* doc/posix-functions/stdc_load8_aligned_les16.texi: New file.
* doc/posix-functions/stdc_load8_aligned_les32.texi: New file.
* doc/posix-functions/stdc_load8_aligned_les64.texi: New file.
* doc/posix-functions/stdc_load8_aligned_les8.texi: New file.
* doc/posix-functions/stdc_load8_aligned_leu16.texi: New file.
* doc/posix-functions/stdc_load8_aligned_leu32.texi: New file.
* doc/posix-functions/stdc_load8_aligned_leu64.texi: New file.
* doc/posix-functions/stdc_load8_aligned_leu8.texi: New file.
* doc/posix-functions/stdc_load8_les16.texi: New file.
* doc/posix-functions/stdc_load8_les32.texi: New file.
* doc/posix-functions/stdc_load8_les64.texi: New file.
* doc/posix-functions/stdc_load8_les8.texi: New file.
* doc/posix-functions/stdc_load8_leu16.texi: New file.
* doc/posix-functions/stdc_load8_leu32.texi: New file.
* doc/posix-functions/stdc_load8_leu64.texi: New file.
* doc/posix-functions/stdc_load8_leu8.texi: New file.
* doc/posix-functions/stdc_memreverse8.texi: New file.
* doc/posix-functions/stdc_memreverse8u16.texi: New file.
* doc/posix-functions/stdc_memreverse8u32.texi: New file.
* doc/posix-functions/stdc_memreverse8u64.texi: New file.
* doc/posix-functions/stdc_memreverse8u8.texi: New file.
* doc/posix-functions/stdc_rotate_left.texi: New file.
* doc/posix-functions/stdc_rotate_right.texi: New file.
* doc/posix-functions/stdc_store8_aligned_les16.texi: New file.
* doc/posix-functions/stdc_store8_aligned_les32.texi: New file.
* doc/posix-functions/stdc_store8_aligned_les64.texi: New file.
* doc/posix-functions/stdc_store8_aligned_les8.texi: New file.
* doc/posix-functions/stdc_store8_aligned_leu16.texi: New file.
* doc/posix-functions/stdc_store8_aligned_leu32.texi: New file.
* doc/posix-functions/stdc_store8_aligned_leu64.texi: New file.
* doc/posix-functions/stdc_store8_aligned_leu8.texi: New file.
* doc/posix-functions/stdc_store8_les16.texi: New file.
* doc/posix-functions/stdc_store8_les32.texi: New file.
* doc/posix-functions/stdc_store8_les64.texi: New file.
* doc/posix-functions/stdc_store8_les8.texi: New file.
* doc/posix-functions/stdc_store8_leu16.texi: New file.
* doc/posix-functions/stdc_store8_leu32.texi: New file.
* doc/posix-functions/stdc_store8_leu64.texi: New file.
* doc/posix-functions/stdc_store8_leu8.texi: New file.
* doc/gnulib.texi (Functions in <stdbit.h>): Change section title.
Include these new files.

2 months agoparse-datetime: Fix typo.
Collin Funk [Mon, 9 Mar 2026 04:02:23 +0000 (21:02 -0700)] 
parse-datetime: Fix typo.

* lib/parse-datetime.y: Fix typo.

2 months agostdbit-h: Fix generated header substitutions (regr. today).
Collin Funk [Sun, 8 Mar 2026 19:51:41 +0000 (12:51 -0700)] 
stdbit-h: Fix generated header substitutions (regr. today).

* m4/stdbit_h.m4 (gl_STDBIT_H_REQUIRE_DEFAULTS): Adjust the variable
names with 's/_GL_/_/' as expected by the Makefile.am snippet.

2 months agoacl-permissions: Don't stump on the system namespace.
Bruno Haible [Sun, 8 Mar 2026 14:33:53 +0000 (15:33 +0100)] 
acl-permissions: Don't stump on the system namespace.

* lib/acl.h (struct aclinfo): Rename field __gl_acl_ch to _gl_acl_ch.
* lib/file-has-acl.c (get_aclinfo, aclinfo_free, fdfile_has_aclinfo):
Update.

2 months agobinary-io: Don't stump on the system namespace.
Bruno Haible [Sun, 8 Mar 2026 14:30:20 +0000 (15:30 +0100)] 
binary-io: Don't stump on the system namespace.

* lib/binary-io.h (_gl_set_fd_mode): Renamed from __gl_setmode.
* lib/binary-io.c (set_binary_mode): Update.

2 months agoerror-h: Don't stump on the system namespace.
Bruno Haible [Sun, 8 Mar 2026 14:27:28 +0000 (15:27 +0100)] 
error-h: Don't stump on the system namespace.

* lib/error.in.h (_gl_error_call1): Renamed from __gl_error_call1.
(_gl_error_call): Renamed from __gl_error_call.

2 months agostdbit-h: Don't stump on the system namespace.
Bruno Haible [Sun, 8 Mar 2026 14:24:28 +0000 (15:24 +0100)] 
stdbit-h: Don't stump on the system namespace.

* lib/stdbit.in.h (_gl_stdbit_clz): Renamed from __gl_stdbit_clz.
(_gl_stdbit_clzl): Renamed from __gl_stdbit_clzl.
(_gl_stdbit_clzll): Renamed from __gl_stdbit_clzll.
(_gl_stdbit_ctz): Renamed from __gl_stdbit_ctz.
(_gl_stdbit_ctzl): Renamed from __gl_stdbit_ctzl.
(_gl_stdbit_ctzll): Renamed from __gl_stdbit_ctzll.
(_gl_stdbit_popcount): Renamed from __gl_stdbit_popcount.
(_gl_stdbit_popcountl): Renamed from __gl_stdbit_popcountl.
(_gl_stdbit_popcountll): Renamed from __gl_stdbit_popcountll.
(_gl_stdbit_popcount_wide): Renamed from __gl_stdbit_popcount_wide.
(_gl_stdbit_popcount_support): Renamed from
__gl_stdbit_popcount_support.
(_gl_stdbit_popcount_supported): Renamed from
_gl_stdbit_popcount_supported.
* lib/stdc_count_ones.c: Update.

2 months agostdbit-h: Use idioms for handling multiple gnulib-tool invocations.
Bruno Haible [Sun, 8 Mar 2026 14:05:45 +0000 (15:05 +0100)] 
stdbit-h: Use idioms for handling multiple gnulib-tool invocations.

* lib/stdbit.in.h: Use @GNULIB_...@ instead of @GL_...@.
* m4/stdbit_h.m4 (gl_STDBIT_H): Don't initialize GL_* variables.
(gl_STDBIT_MODULE_INDICATOR, gl_STDBIT_H_REQUIRE_DEFAULTS,
gl_STDBIT_H_DEFAULTS): New macros.
* modules/stdbit-h (Makefile.am): Substitute GNULIB_* instead of GL_*
variables.
* modules/stdc_bit_ceil (configure.ac): Use gl_STDBIT_MODULE_INDICATOR.
* modules/stdc_bit_floor (configure.ac): Likewise.
* modules/stdc_bit_width (configure.ac): Likewise.
* modules/stdc_count_ones (configure.ac): Likewise.
* modules/stdc_count_zeros (configure.ac): Likewise.
* modules/stdc_first_leading_one (configure.ac): Likewise.
* modules/stdc_first_leading_zero (configure.ac): Likewise.
* modules/stdc_first_trailing_one (configure.ac): Likewise.
* modules/stdc_first_trailing_zero (configure.ac): Likewise.
* modules/stdc_has_single_bit (configure.ac): Likewise.
* modules/stdc_leading_ones (configure.ac): Likewise.
* modules/stdc_leading_zeros (configure.ac): Likewise.
* modules/stdc_trailing_ones (configure.ac): Likewise.
* modules/stdc_trailing_zeros (configure.ac): Likewise.

2 months agognulib-tool.py: Fix default handling for --local-{symlink,hardlink}.
Bruno Haible [Fri, 6 Mar 2026 08:47:50 +0000 (09:47 +0100)] 
gnulib-tool.py: Fix default handling for --local-{symlink,hardlink}.

* pygnulib/GLConfig.py (GLConfig.__init__): Allow lcopymode to remain
None.
(GLConfig.default): Change lcopymode's default to be None.
(GLConfig.checkLCopyMode): Update signature.
(GLConfig.resetLCopyMode): Change default value to None.
* pygnulib/GLFileSystem.py (GLFileSystem.shouldLink): Update.

2 months agognulib-tool.py: Use --symlink or --hardlink for local modules.
Collin Funk [Fri, 6 Mar 2026 06:22:41 +0000 (22:22 -0800)] 
gnulib-tool.py: Use --symlink or --hardlink for local modules.

Reported by Pádraig Brady in
<https://lists.gnu.org/r/coreutils/2026-03/msg00015.html>.

* pygnulib/GLConfig.py (__init__): If --local-symlink or
--local-hardlink are not specified, use the value specified by --symlink
or --hardlink for local modules instead of copying.

2 months agoDon't use 'typeof' built-in with -std=c99 or -std=c11.
Bruno Haible [Tue, 3 Mar 2026 10:33:11 +0000 (11:33 +0100)] 
Don't use 'typeof' built-in with -std=c99 or -std=c11.

Reported by Alexander Sosedkin <asosedkin@redhat.com> in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-03/msg00019.html>.

* lib/stdcountof.in.h (_gl_verify_is_array): Don't use the definition
with typeof in strict C99 or C11 modes.
* lib/string-desc.h (HAVE_TYPEOF): Don't define in strict C99 or C11
modes.

2 months agomanywarnings: Eliminate some never-useful clang warnings.
Bruno Haible [Tue, 3 Mar 2026 07:52:34 +0000 (08:52 +0100)] 
manywarnings: Eliminate some never-useful clang warnings.

* m4/manywarnings.m4 (gl_MANYWARN_ALL_GCC(C)): Disable the
-Wgnu-include-next, -Wstring-plus-int, -Wstring-plus-char warnings.

2 months agoUse countof, part 2.
Bruno Haible [Mon, 2 Mar 2026 13:35:26 +0000 (14:35 +0100)] 
Use countof, part 2.

Done through  sed -e 's/SIZEOF \([(][^()]*[)]\)/countof \1/g'

* lib/boot-time.c: Include <stdcountof.h>.
* lib/readutmp.c: Include <stdcountof.h>.
* lib/boot-time-aux.h (get_linux_boot_time_fallback,
get_openbsd_boot_time, get_windows_boot_time): Use countof.
* lib/duplocale.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(duplocale): Use countof instead.
* lib/fatal-signal.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(num_fatal_signals, actions_allocated): Use countof instead.
* lib/iconv_open.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(rpl_iconv_open): Use countof instead.
* lib/term-style-control.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(num_job_control_signals): Use countof instead.
* lib/uniconv/u16-conv-to-enc.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
* lib/uniconv/u32-conv-to-enc.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
* lib/uniconv/u-conv-to-enc.h (FUNC): Use countof instead.
* lib/uniconv/u16-strconv-to-enc.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
* lib/uniconv/u32-strconv-to-enc.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
* lib/uniconv/u-strconv-to-enc.h (FUNC): Use countof instead.
* lib/uniname/uniname.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(unicode_name_word, unicode_name_word_lookup, unicode_code_to_index,
unicode_index_to_code, unicode_character_name, unicode_name_character):
Use countof instead.
* lib/uniwidth/width.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(uc_width): Use countof instead.
* lib/wait-process.c: Include <stdcountof.h>.
(SIZEOF): Remove macro.
(slaves_allocated): Use countof instead.
* lib/gen-uni-tables.c (countof): Renamed from SIZEOF.
* modules/boot-time (Depends-on): Add stdcountof-h.
* modules/readutmp (Depends-on): Likewise.
* modules/duplocale (Depends-on): Likewise.
* modules/fatal-signal (Depends-on): Likewise.
* modules/iconv_open (Depends-on): Likewise.
* modules/term-style-control (Depends-on): Likewise.
* modules/uniconv/u16-conv-to-enc (Depends-on): Likewise.
* modules/uniconv/u32-conv-to-enc (Depends-on): Likewise.
* modules/uniconv/u16-strconv-to-enc (Depends-on): Likewise.
* modules/uniconv/u32-strconv-to-enc (Depends-on): Likewise.
* modules/uniname/uniname (Depends-on): Likewise.
* modules/uniwidth/width (Depends-on): Likewise.
* modules/wait-process (Depends-on): Likewise.
* tests/macros.h (SIZEOF): Remove macro.
* tests/**/*.[hc]: Use countof instead of SIZEOF. Include <stdcountof.h>
as needed.
* modules/**/*-tests (Depends-on): Add stdcountof-h if needed.

2 months agoUse countof, part 1.
Bruno Haible [Mon, 2 Mar 2026 10:04:16 +0000 (11:04 +0100)] 
Use countof, part 1.

* lib/argmatch.h: Include <stdcountof.h>.
(ARRAY_CARDINALITY): Remove macro.
(ARGMATCH_VERIFY): Use countof instead.
* tests/test-argv-iter.c: Include <stdcountof.h>.
(ARRAY_CARDINALITY): Remove macro.
(main): Use countof instead.
* tests/test-hash.c: Include <stdcountof.h>.
(ARRAY_CARDINALITY): Remove macro.
(main): Use countof instead.
* tests/test-userspec.c: Include <stdcountof.h>.
(ARRAY_CARDINALITY): Remove macro.
(main): Use countof instead.
* modules/argmatch (Depends-on): Add stdcountof-h.
* modules/argv-iter-tests (Depends-on): Likewise.
* modules/hash-tests (Depends-on): Likewise.
* modules/userspec-tests (Depends-on): Likewise.

2 months agostdcountof-h: Improve comment.
Bruno Haible [Mon, 2 Mar 2026 12:00:03 +0000 (13:00 +0100)] 
stdcountof-h: Improve comment.

* lib/stdcountof.in.h (countof): Improve comment.

2 months agoSilence clang's -Wstring-plus-int warnings in Gnulib code.
Bruno Haible [Mon, 2 Mar 2026 04:29:20 +0000 (05:29 +0100)] 
Silence clang's -Wstring-plus-int warnings in Gnulib code.

* m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): Add -Wno-string-plus-int.

2 months agotests: Use streq, part 5.
Bruno Haible [Mon, 2 Mar 2026 08:59:03 +0000 (09:59 +0100)] 
tests: Use streq, part 5.

* tests/test-execute-child.c: Revert last change.
* modules/execute-tests (Depends-on): Remove streq.

2 months agostdcountof-h tests: Avoid a clang warning.
Bruno Haible [Sun, 1 Mar 2026 18:55:55 +0000 (19:55 +0100)] 
stdcountof-h tests: Avoid a clang warning.

* tests/test-stdcountof-h.c (call_count, do_call): Don't define in C++
mode.

2 months agofloat-h: Ensure ISO C23 compliance with clang 22.
Bruno Haible [Sun, 1 Mar 2026 18:28:29 +0000 (19:28 +0100)] 
float-h: Ensure ISO C23 compliance with clang 22.

* m4/float_h.m4 (gl_FLOAT_H): Test also whether the provided <float.h>
defines {FLT,DBL,LDBL}_IS_IEC_60559.

2 months agostrftime: pacify clang -Wstring-plus-int
Paul Eggert [Sun, 1 Mar 2026 18:13:48 +0000 (10:13 -0800)] 
strftime: pacify clang -Wstring-plus-int

This pacifies a warning from default clang 21, and saves a byte.
Problem reported by Badli Al Rashid <https://bugs.gnu.org/80514>.
* lib/strftime.c (c_ampm_letters): New static constant, if
!defined _NL_CURRENT && (HAVE_ONLY_C_LOCALE || (USE_C_LOCALE &&
!HAVE_STRFTIME_L)).
(ampm): Use it if needed.

2 months agotests: Use strnul.
Bruno Haible [Sun, 1 Mar 2026 13:44:32 +0000 (14:44 +0100)] 
tests: Use strnul.

* tests/test-dfa-match-aux.c (main): Use strnul.
* tests/test-pthread-rwlock-waitqueue.c (reader_func, writer_func):
Likewise.
* tests/test-strtold.h (test_function): Likewise.
* tests/test-xstrtold.c (main): Likewise.
* modules/dfa-tests (Depends-on): Add strnul.
* modules/pthread-rwlock-extra-tests (Depends-on): Likewise.
* modules/c-strtold-tests (Depends-on): Likewise.
* modules/strtold-tests (Depends-on): Likewise.
* modules/xstrtold-tests (Depends-on): Likewise.

2 months agoFix last few ChangeLog entries.
Bruno Haible [Sun, 1 Mar 2026 13:44:13 +0000 (14:44 +0100)] 
Fix last few ChangeLog entries.

2 months agotests: Use memeq, part 3.
Bruno Haible [Sun, 1 Mar 2026 11:37:49 +0000 (12:37 +0100)] 
tests: Use memeq, part 3.

* tests/**/*.[hc]: Use memeq instead of memcmp.
* modules/*-tests (Dependencies): Add memeq.

2 months agotests: Use memeq, part 2.
Bruno Haible [Sun, 1 Mar 2026 11:36:45 +0000 (12:36 +0100)] 
tests: Use memeq, part 2.

Done through
  sed -e 's/memcmp \([(][^()]*[)]\) != 0/!memeq \1/g' \
      -e 's/memcmp \([(][^()]*[(][^()]*[)][^()]*[)]\) != 0/!memeq \1/g'

* tests/**/*.[hc]: Use !memeq instead of memcmp ... != 0.
* modules/*-tests (Dependencies): Add memeq.

2 months agotests: Use memeq, part 1.
Bruno Haible [Sun, 1 Mar 2026 11:35:40 +0000 (12:35 +0100)] 
tests: Use memeq, part 1.

Done through
  sed -e 's/memcmp \([(][^()]*[)]\) == 0/memeq \1/g' \
      -e 's/memcmp \([(][^()]*[(][^()]*[)][^()]*[)]\) == 0/memeq \1/g'

* tests/**/*.[hc]: Use memeq instead of memcmp ... == 0.
* modules/*-tests (Dependencies): Add memeq.

2 months agotests: Use streq, part 4.
Bruno Haible [Sun, 1 Mar 2026 09:50:12 +0000 (10:50 +0100)] 
tests: Use streq, part 4.

* tests/**/*.[hc]: Use streq instead of STREQ.
* tests/macros.h (STREQ): Remove macro.
* modules/*-tests (Dependencies): Add streq.

2 months agotests: Use streq, part 3.
Bruno Haible [Sun, 1 Mar 2026 09:15:23 +0000 (10:15 +0100)] 
tests: Use streq, part 3.

* tests/**/*.[hc]: Use streq instead of strcmp.
* modules/*-tests (Dependencies): Add streq.

2 months agotests: Use streq, part 2.
Bruno Haible [Sun, 1 Mar 2026 09:01:29 +0000 (10:01 +0100)] 
tests: Use streq, part 2.

Done through sed -e 's/strcmp \([(][^()]*[)]\) != 0/!streq \1/'

* tests/**/*.[hc]: Use !streq instead of strcmp ... != 0.
* modules/*-tests (Dependencies): Add streq.

2 months agotests: Use streq, part 1.
Bruno Haible [Sun, 1 Mar 2026 08:23:18 +0000 (09:23 +0100)] 
tests: Use streq, part 1.

Done through sed -e 's/strcmp \([(][^()]*[)]\) == 0/streq \1/'

* tests/**/*.[hc]: Use streq instead of strcmp ... == 0.
* modules/*-tests (Dependencies): Add streq.

2 months agofilesystem-remote: New module.
Bruno Haible [Sat, 28 Feb 2026 21:13:14 +0000 (22:13 +0100)] 
filesystem-remote: New module.

* lib/filesystem-remote.h: New file, based on lib/file-remote.h.
* lib/filesystem-remote.c: New file, based on lib/file-remote.c.
* lib/file-remote.h (is_remote_fs_type_name): Remove declaration.
* lib/file-remote.c (is_remote_fs_type_name): Remove function.
* modules/filesystem-remote: New file.
* lib/mountlist.c: Include filesystem-remote.h instead of file-remote.h.
* modules/mountlist (Depends-on): Add filesystem-remote. Remove
file-remote.

2 months agocygpath: Use _GL_ATTRIBUTE_MALLOC and _GL_ATTRIBUTE_DEALLOC_FREE.
Collin Funk [Sat, 28 Feb 2026 20:59:50 +0000 (12:59 -0800)] 
cygpath: Use _GL_ATTRIBUTE_MALLOC and _GL_ATTRIBUTE_DEALLOC_FREE.

* lib/cygpath.h: Include stdlib.h for free declaration.
(cygpath_w): Mark function with _GL_ATTRIBUTE_MALLOC and
_GL_ATTRIBUTE_DEALLOC_FREE since it will always return a malloc'ed
pointer or NULL.

2 months agofile-remote: Use streq.
Bruno Haible [Sat, 28 Feb 2026 20:45:08 +0000 (21:45 +0100)] 
file-remote: Use streq.

* lib/file-remote.c (is_remote_fs_type_name, file_is_remote): Use streq
instead of strcmp.
* modules/file-remote (Depends-on): Add streq.

2 months agoStraighten dependencies to streq or memeq.
Bruno Haible [Sat, 28 Feb 2026 17:44:42 +0000 (18:44 +0100)] 
Straighten dependencies to streq or memeq.

* modules/argmatch (Dependencies): Add memeq, streq. Remove stringeq.
* modules/bcp47 (Dependencies): Likewise.
* modules/readutmp (Dependencies): Likewise.
* modules/relocatable-prog (Dependencies): Likewise.
* modules/relocatable-prog-wrapper (Dependencies): Likewise.
* modules/vc-mtime (Dependencies): Likewise.
* modules/backup-rename (Dependencies): Add memeq. Remove stringeq.
* modules/backupfile (Dependencies): Likewise.
* modules/boot-time (Dependencies): Likewise.
* modules/csharpcomp (Dependencies): Likewise.
* modules/csharpexec (Dependencies): Likewise.
* modules/file-has-acl (Dependencies): Likewise.
* modules/get_ppid_of (Dependencies): Likewise.
* modules/get_progname_of (Dependencies): Likewise.
* modules/getlogin_r (Dependencies): Likewise.
* modules/getprogname (Dependencies): Likewise.
* modules/getumask (Dependencies): Likewise.
* modules/isnan-no-c++ (Dependencies): Likewise.
* modules/isnanf (Dependencies): Likewise.
* modules/isnanf-nolibm (Dependencies): Likewise.
* modules/isnand (Dependencies): Likewise.
* modules/isnand-nolibm (Dependencies): Likewise.
* modules/isnanl (Dependencies): Likewise.
* modules/isnanl-nolibm (Dependencies): Likewise.
* modules/mbchar (Dependencies): Likewise.
* modules/mem-hash-map (Dependencies): Likewise.
* modules/memcoll (Dependencies): Likewise.
* modules/progname (Dependencies): Likewise.
* modules/pthread_sigmask (Dependencies): Likewise.
* modules/quotearg (Dependencies): Likewise.
* modules/same (Dependencies): Likewise.
* modules/signbit-no-c++ (Dependencies): Likewise.
* modules/string-desc (Dependencies): Likewise.
* modules/uniname/uniname (Dependencies): Likewise.
* modules/acl-permissions (Dependencies): Add streq. Remove stringeq.
* modules/argp (Dependencies): Likewise.
* modules/c-vasnprintf (Dependencies): Likewise.
* modules/c32_get_mapping (Dependencies): Likewise.
* modules/c32_get_type_test (Dependencies): Likewise.
* modules/concat-filename (Dependencies): Likewise.
* modules/cpu-supports (Dependencies): Likewise.
* modules/dfa (Dependencies): Likewise.
* modules/duplocale (Dependencies): Likewise.
* modules/exclude (Dependencies): Likewise.
* modules/findprog (Dependencies): Likewise.
* modules/findprog-in (Dependencies): Likewise.
* modules/findprog-lgpl (Dependencies): Likewise.
* modules/fopen (Dependencies): Likewise.
* modules/fopen-gnu (Dependencies): Likewise.
* modules/freopen (Dependencies): Likewise.
* modules/fts (Dependencies): Likewise.
* modules/getlocalename_l-simple (Dependencies): Likewise.
* modules/getlocalename_l-unsafe (Dependencies): Likewise.
* modules/getlogin (Dependencies): Likewise.
* modules/getugroups (Dependencies): Likewise.
* modules/hard-locale (Dependencies): Likewise.
* modules/hashcode-named-file (Dependencies): Likewise.
* modules/hashkey-string (Dependencies): Likewise.
* modules/iconv_open (Dependencies): Likewise.
* modules/idcache (Dependencies): Likewise.
* modules/localcharset (Dependencies): Likewise.
* modules/localename (Dependencies): Likewise.
* modules/localename-environ (Dependencies): Likewise.
* modules/localename-unsafe (Dependencies): Likewise.
* modules/localename-unsafe-limited (Dependencies): Likewise.
* modules/map-c++-tests (Dependencies): Likewise.
* modules/mbs_endswith (Dependencies): Likewise.
* modules/mountlist (Dependencies): Likewise.
* modules/newlocale (Dependencies): Likewise.
* modules/nl_langinfo (Dependencies): Likewise.
* modules/nproc (Dependencies): Likewise.
* modules/open (Dependencies): Likewise.
* modules/parse-datetime (Dependencies): Likewise.
* modules/popen (Dependencies): Likewise.
* modules/posix_spawn-internal (Dependencies): Likewise.
* modules/propername (Dependencies): Likewise.
* modules/pt_chown (Dependencies): Likewise.
* modules/putenv-gnu (Dependencies): Likewise.
* modules/qcopy-acl (Dependencies): Likewise.
* modules/rpmatch (Dependencies): Likewise.
* modules/selinux-h (Dependencies): Likewise.
* modules/setlocale (Dependencies): Likewise.
* modules/setlocale-fixes (Dependencies): Likewise.
* modules/sig2str (Dependencies): Likewise.
* modules/spawn-pipe (Dependencies): Likewise.
* modules/stat (Dependencies): Likewise.
* modules/str_endswith (Dependencies): Likewise.
* modules/streq-opt (Dependencies): Likewise.
* modules/striconveha (Dependencies): Likewise.
* modules/supersede (Dependencies): Likewise.
* modules/time_rz (Dependencies): Likewise.
* modules/unicodeio (Dependencies): Likewise.
* modules/unistdio/u16-u16-vasnprintf (Dependencies): Likewise.
* modules/unistdio/u16-vasnprintf (Dependencies): Likewise.
* modules/unistdio/u32-u32-vasnprintf (Dependencies): Likewise.
* modules/unistdio/u32-vasnprintf (Dependencies): Likewise.
* modules/unistdio/u8-u8-vasnprintf (Dependencies): Likewise.
* modules/unistdio/u8-vasnprintf (Dependencies): Likewise.
* modules/unistdio/ulc-vasnprintf (Dependencies): Likewise.
* modules/vasnprintf (Dependencies): Likewise.
* modules/vasnwprintf (Dependencies): Likewise.
* modules/wctrans (Dependencies): Likewise.
* modules/wctype (Dependencies): Likewise.
* modules/c-nstrftime (Dependencies): Add streq.
* modules/fprintftime (Dependencies): Likewise.
* modules/nstrftime (Dependencies): Likewise.
* modules/nstrftime-limited (Dependencies): Likewise.

2 months agostreq, memeq: New modules.
Bruno Haible [Sat, 28 Feb 2026 15:36:24 +0000 (16:36 +0100)] 
streq, memeq: New modules.

* lib/string.in.h (_GL_STRING_INLINE): Remove macro.
(_GL_MEMEQ_INLINE): New macro.
(memeq): Use it instead of _GL_STRING_INLINE. Test GNULIB_MEMEQ.
(_GL_STREQ_INLINE): New macro.
(streq): Use it instead of _GL_STRING_INLINE. Test GNULIB_STREQ.
* lib/memeq.c: New file.
* lib/streq.c: New file.
* lib/string.c: Remove file.
* m4/memeq.m4: New file, based on m4/stringeq.m4.
* m4/streq.m4: New file, based on m4/stringeq.m4.
* m4/stringeq.m4: Remove file.
* m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Initialize
GNULIB_MEMEQ, GNULIB_STREQ. Don't initialize GNULIB_STRINGEQ.
* modules/string-h (Makefile.am): Substitute GNULIB_MEMEQ, GNULIB_STREQ.
Don't substitute GNULIB_STRINGEQ.
* modules/memeq: New file.
* modules/streq: New file.
* modules/stringeq: Change to just be the union of streq and memeq.
* MODULES.html.sh (func_all_modules): Add memeq, streq.

2 months agoFix module dependencies after 2025-09-17 "stringeq: prefer streq to strcmp in other...
Bruno Haible [Sat, 28 Feb 2026 15:35:50 +0000 (16:35 +0100)] 
Fix module dependencies after 2025-09-17 "stringeq: prefer streq to strcmp in other modules".

* modules/c-vasnprintf (Dependencies): Add stringeq.
* modules/findprog-lgpl (Dependendies): Likewise.
* modules/localename-environ (Dependendies): Likewise.
* modules/localename-unsafe-limited (Dependendies): Likewise.
* modules/uchar-h-c23 (Dependendies): Likewise.
* modules/unistdio/u16-u16-vasnprintf (Dependendies): Likewise.
* modules/unistdio/u16-vasnprintf (Dependendies): Likewise.
* modules/unistdio/u32-u32-vasnprintf (Dependendies): Likewise.
* modules/unistdio/u32-vasnprintf (Dependendies): Likewise.
* modules/unistdio/u8-u8-vasnprintf (Dependendies): Likewise.
* modules/unistdio/u8-vasnprintf (Dependendies): Likewise.
* modules/unistdio/ulc-vasnprintf (Dependendies): Likewise.
* modules/vasnprintf (Dependendies): Likewise.
* modules/vasnwprintf (Dependendies): Likewise.
* modules/setenv (Dependendies): Remove stringeq.
* modules/uchar-h (Dependendies): Likewise.
* modules/uniconv/base (Dependendies): Likewise.

2 months agoFix module dependencies after 2025-09-17 "stringeq: prefer memeq to memcmp in other...
Bruno Haible [Sat, 28 Feb 2026 15:02:49 +0000 (16:02 +0100)] 
Fix module dependencies after 2025-09-17 "stringeq: prefer memeq to memcmp in other modules".

* modules/backup-rename (Dependencies): Add stringeq.
* modules/isnanf (Dependendies): Likewise.
* modules/isnanf-nolibm (Dependendies): Likewise.
* modules/isnand (Dependendies): Likewise.
* modules/isnand-nolibm (Dependendies): Likewise.
* modules/isnanl (Dependendies): Likewise.
* modules/isnanl-nolibm (Dependendies): Likewise.

2 months agomountlist: use file-remote module to determine remoteness
Pádraig Brady [Mon, 23 Feb 2026 14:22:51 +0000 (14:22 +0000)] 
mountlist: use file-remote module to determine remoteness

* lib/file-remote.c (is_remote_fs_type_name): A new function
that matches file system _names_ as being remote.  The list is
an amalgamation of those names already referenced in file-remote,
names referenced in ME_REMOTE, and IDs referenced in file-remote.
* lib/file-remote.h: Declare new function.
* lib/mountlist.c (ME_REMOTE): Use is_remote_fs_type_name()
to determine if the name is remote.
* modules/mountlist: Depend on file-remote.

2 months agostrnul: Fix link-time error.
Bruno Haible [Sat, 28 Feb 2026 08:04:14 +0000 (09:04 +0100)] 
strnul: Fix link-time error.

* lib/string.in.h (_GL_STRNUL_INLINE): New macro.
(gl_strnul): Use it instead of _GL_STRING_INLINE.
* lib/strnul.c: New file.
* lib/string.c: Update comment.
* modules/strnul (Files): Add strnul.c. Remove string.c.
(Makefile.am): Update accordingly.

2 months agowctype-h: Try to fix error regarding mbstate_t on very old mingw.
Bruno Haible [Fri, 27 Feb 2026 10:47:19 +0000 (11:47 +0100)] 
wctype-h: Try to fix error regarding mbstate_t on very old mingw.

Reported by Eli Zaretskii, see
<https://lists.gnu.org/archive/html/bug-gnulib/2026-01/msg00206.html>.
Based on proposed patch at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00043.html>.

* lib/wctype.in.h: Don't include <wchar.h> on mingw when it has already
been at least partially processed.

2 months agombs_startswith: Add tests.
Bruno Haible [Fri, 27 Feb 2026 05:41:31 +0000 (06:41 +0100)] 
mbs_startswith: Add tests.

* tests/test-mbs_startswith1.c: New file, based on
tests/test-mbs_endswith1.c.
* tests/test-mbs_startswith2.c: New file, based on
tests/test-mbs_endswith2.c.
* tests/test-mbs_startswith2.sh: New file, based on
tests/test-mbs_endswith2.sh.
* tests/test-mbs_startswith3.c: New file, based on
tests/test-mbs_endswith3.c.
* tests/test-mbs_startswith3.sh: New file, based on
tests/test-mbs_endswith3.sh.
* modules/mbs_startswith-tests: New file.

2 months agombs_startswith: Fix handling of incomplete characters.
Bruno Haible [Fri, 27 Feb 2026 05:37:55 +0000 (06:37 +0100)] 
mbs_startswith: Fix handling of incomplete characters.

* lib/string.in.h (mbs_startswith): Remove macro definition.
* lib/mbs_startswith.c: New file.
* modules/mbs_startswith (Files): Add it.
(Depends-on): Add strnlen, mbiter.
(Makefile.am): Arrange to compile mbs_startswith.c.

2 months agoassert: document variadic variant
Paul Eggert [Wed, 25 Feb 2026 17:41:30 +0000 (09:41 -0800)] 
assert: document variadic variant

2 months agocrypto/sha3: Silence -Wzero-as-null-pointer-constant warning.
Collin Funk [Tue, 24 Feb 2026 05:32:25 +0000 (21:32 -0800)] 
crypto/sha3: Silence -Wzero-as-null-pointer-constant warning.

* lib/sha3.c (sha3_read_ctx): Use NULL for the pointer argument.

2 months agoUse strnul in a few places.
Alejandro Colomar [Tue, 24 Feb 2026 01:59:14 +0000 (02:59 +0100)] 
Use strnul in a few places.

* lib/argz.c (argz_next): Use strnul.
* lib/cpu-supports.c (hwcap_allowed): Likewise.
* lib/file-has-acl.c (aclinfo_has_xattr): Likewise.
* lib/inet_ntop.c (inet_ntop6): Likewise.
* lib/link.c (link): Likewise.
* lib/localename-unsafe.c (enum_locales_fn): Likewise.
* lib/mbspcasecmp.c (mbspcasecmp): Likewise.
* lib/opendir.c (opendir): Likewise.
* lib/parse-duration.c (parse_year_month_day, parse_hour_minute_second,
trim): Likewise.
* lib/setlocale.c (setlocale_unixlike): Likewise.
* lib/strftime.c (__strftime_internal): Likewise.
* lib/striconv.c (str_cd_iconv): Likewise.
* lib/strncat.c (strncat): Likewise.
* lib/term-style-control.c (log_signal_handler_called,
tcsetattr_failed): Likewise.
* lib/time_rz.c (save_abbr): Likewise.
* lib/vc-mtime.c (git_mtime, max_vc_mtime): Likewise.
* tests/test-savedir.c (test_savedir_sort_none, test_savedir_sort_name):
Likewise.
* modules/argz (Depends-on): Add strnul.
* modules/cpu-supports (Depends-on): Likewise.
* modules/file-has-acl (Depends-on): Likewise.
* modules/inet_ntop (Depends-on): Likewise.
* modules/link (Depends-on): Likewise.
* modules/localename-unsafe (Depends-on): Likewise.
* modules/localename-unsafe-limited (Depends-on): Likewise.
* modules/mbspcasecmp (Depends-on): Likewise.
* modules/opendir (Depends-on): Likewise.
* modules/parse-duration (Depends-on): Likewise.
* modules/setlocale (Depends-on): Likewise.
* modules/nstrftime (Depends-on): Likewise.
* modules/nstrftime-limited (Depends-on): Likewise.
* modules/c-nstrftime (Depends-on): Likewise.
* modules/fprintftime (Depends-on): Likewise.
* modules/striconv (Depends-on): Likewise.
* modules/strncat (Depends-on): Likewise.
* modules/term-style-control (Depends-on): Likewise.
* modules/time_rz (Depends-on): Likewise.
* modules/vc-mtime (Depends-on): Likewise.
* modules/savedir-tests (Depends-on): Likewise.

Copyright-paperwork-exempt: Yes

2 months agostrnul: Respect GNULIB_NAMESPACE.
Bruno Haible [Tue, 24 Feb 2026 00:13:43 +0000 (01:13 +0100)] 
strnul: Respect GNULIB_NAMESPACE.

* lib/string.in.h (strnul): Use _GL_BEGIN_NAMESPACE, _GL_END_NAMESPACE.
* tests/test-strnul-c++2.cc: New file, based on tests/test-strnul.c.
* modules/strnul-c++-tests (Files): Add it.
(Makefile.am): Arrange to compile and run test-strnul-c++2.

2 months agostrnul: Accept 'void *' and 'const void *' arguments in C mode.
Bruno Haible [Mon, 23 Feb 2026 14:07:30 +0000 (15:07 +0100)] 
strnul: Accept 'void *' and 'const void *' arguments in C mode.

Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00170.html>.

* lib/string.in.h (strnul): Use a conditional expression in _Generic.
* tests/test-strnul.c (main): Add test cases with 'void *' argument.

2 months agofts: Relicense some of its source code under LGPLv2+.
Bruno Haible [Mon, 23 Feb 2026 08:40:09 +0000 (09:40 +0100)] 
fts: Relicense some of its source code under LGPLv2+.

Jim Meyering's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00109.html>.
Paul Eggert's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00106.html>.
Bruno Haible's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00111.html>.
Pádraig Brady's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00113.html>.
Kamil Dudka's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00199.html>.

* lib/fts.in.h: Change license notice to LGPLv2+.
* lib/fts.c: Likewise.
* lib/fts-cycle.c: Likewise.

2 months agoFix comment misspelling of "against"
Paul Eggert [Mon, 23 Feb 2026 02:42:30 +0000 (18:42 -0800)] 
Fix comment misspelling of "against"

2 months agocrypto: don’t add 72 to malloc size
Paul Eggert [Mon, 23 Feb 2026 01:13:58 +0000 (17:13 -0800)] 
crypto: don’t add 72 to malloc size

The ‘BLOCKSIZE + 72’ business apparently dates back to 30 years
ago when the buffer was local (not heap allocated) and was multi-use.
That code died long ago, so stop allocating the cargo-cult bytes.
* lib/md2-stream.c (md2_stream):
* lib/md4-stream.c (md4_stream):
* lib/md5-stream.c (md5_stream):
* lib/sha1-stream.c (sha1_stream):
* lib/sha256-stream.c (shaxxx_stream):
* lib/sha3-stream.c (sha3_xxx_stream):
* lib/sha512-stream.c (shaxxx_stream):
* lib/sm3-stream.c (sm3_stream):
Don’t allocate an unnecessary 72 extra bytes.

2 months agosha3: add a few ‘restrict’s that I forgot
Paul Eggert [Mon, 23 Feb 2026 00:36:11 +0000 (16:36 -0800)] 
sha3: add a few ‘restrict’s that I forgot

* lib/sha3-stream.c (sha3_xxx_stream):
* lib/sha3.c (sha3_##SIZE##_buffer):
Add some more ‘restrict’s.

2 months agocrypto: add ‘restrict’ to .h files
Paul Eggert [Sun, 22 Feb 2026 23:08:59 +0000 (15:08 -0800)] 
crypto: add ‘restrict’ to .h files

Use ‘restrict’ on pointer args when appropriate.
It suffices to do this in .h files, as .c files inherit it.
For style, prefer qualifiers after types, to be consistent with
putting ‘restrict’ after types.
* lib/af_alg.h (afalg_buffer, afalg_stream):
* lib/arcfour.h (arcfour_stream, arcfour_setkey):
* lib/arctwo.h (arctwo_setkey_ekb, arctwo_encrypt, arctwo_decrypt):
* lib/des.h (gl_des_setkey, gl_des_makekey, gl_des_ecb_crypt)
(gl_3des_set2keys, gl_3des_set3keys, gl_3des_makekey)
(gl_3des_ecb_crypt):
* lib/gc.h (gc_cipher_setkey, gc_cipher_setiv)
(gc_cipher_encrypt_inline, gc_cipher_decrypt_inline, gc_hash_clone)
(gc_hash_hmac_setkey, gc_hash_write, gc_hash_buffer, gc_md2)
(gc_md4, gc_md5, gc_sha1, gc_sha256, gc_sha512, gc_sm3)
(gc_hmac_md5, gc_hmac_sha1, gc_hmac_sha256, gc_hmac_sha512)
(gc_pbkdf2_hmac, gc_pbkdf2_sha1):
* lib/gl_openssl.h (GL_CRYPTO_FN (_process_bytes))
(GL_CRYPTO_FN (_process_block), GL_CRYPTO_FN (_finish_ctx))
(GL_CRYPTO_FN (_buffer), GL_CRYPTO_FN (_read_ctx)):
* lib/hmac.h (hmac_md5, hmac_sha1, hmac_sha256, hmac_sha512):
* lib/md2.h (md2_process_block, md2_process_bytes, md2_finish_ctx)
(md2_read_ctx, md2_buffer, md2_stream):
* lib/md4.h (md4_process_block, md4_process_bytes, md4_finish_ctx)
(md4_read_ctx, md4_buffer, md4_stream):
* lib/md5.h (__md5_process_block, __md5_process_bytes, __md5_finish_ctx)
(__md5_read_ctx, __md5_buffer, __md5_stream):
* lib/rijndael-alg-fst.h (rijndaelKeySetupEnc)
(rijndaelKeySetupDec, rijndaelEncrypt, rijndaelDecrypt):
* lib/rijndael-api-fst.h (rijndaelMakeKey, rijndaelCipherInit)
(rijndaelBlockEncrypt, rijndaelPadEncrypt, rijndaelBlockDecrypt)
(rijndaelPadDecrypt):
* lib/sha1.h (sha1_process_block, sha1_process_bytes)
(sha1_finish_ctx, sha1_read_ctx, sha1_buffer, sha1_stream):
* lib/sha256.h (sha256_process_block, sha256_process_bytes)
(sha256_finish_ctx, sha224_finish_ctx, sha256_read_ctx)
(sha224_read_ctx, sha256_buffer, sha224_buffer, sha256_stream)
(sha224_stream):
* lib/sha3.h (sha3_process_block, sha3_process_bytes)
(sha3_finish_ctx, sha3_read_ctx, sha3_224_buffer, sha3_256_buffer)
(sha3_384_buffer, sha3_512_buffer, sha3_224_stream)
(sha3_256_stream, sha3_384_stream, sha3_512_stream):
* lib/sha512.h (sha512_process_block, sha512_process_bytes)
(sha512_finish_ctx, sha384_finish_ctx, sha512_read_ctx)
(sha384_read_ctx, sha512_buffer, sha384_buffer, sha512_stream)
(sha384_stream):
* lib/sm3.h (sm3_process_block, sm3_process_bytes, sm3_finish_ctx)
(sm3_read_ctx, sm3_buffer, sm3_stream):
Add ‘restrict’ to pointer args.  All implementations changed.

2 months agocrypto/sha3: Don’t leak if init fails and no free
Paul Eggert [Sun, 22 Feb 2026 21:06:34 +0000 (13:06 -0800)] 
crypto/sha3: Don’t leak if init fails and no free

If the init_ctx functions fail, it’s natural for callers to
immediately fail too.  Change the init_ctx functions to not leak
when failing.  This doesn’t invalidate any callers that free
if the init functions fail, as that free now becomes a no-op.
* lib/sha3.c (sha3_##SIZE##_init_ctx): Before failing,
free any storage that was allocated before failure was discovered.
* tests/test-sha3-224-buffer.c:
* tests/test-sha3-256-buffer.c:
* tests/test-sha3-384-buffer.c:
* tests/test-sha3-512-buffer.c:
(check, main): Test more cases of multiple frees.
Also, fix a memory leak.

2 months agocrypto/sha3: fix sha3_read_ctx reset bug
Paul Eggert [Sun, 22 Feb 2026 19:51:26 +0000 (11:51 -0800)] 
crypto/sha3: fix sha3_read_ctx reset bug

* lib/sha3.c (sha3_read_ctx): When using OpenSSL, don’t update the
internal context; we’re supposed to read it, not write it.
Instead, clone it and update the clone.
* tests/test-sha3-224-buffer.c:
* tests/test-sha3-256-buffer.c:
* tests/test-sha3-384-buffer.c:
* tests/test-sha3-512-buffer.c:
(check): Test for the bug.

2 months agocrypto/sha3: EVP_MD_CTX_create → EVP_MD_CTX_new
Paul Eggert [Sun, 22 Feb 2026 18:11:12 +0000 (10:11 -0800)] 
crypto/sha3: EVP_MD_CTX_create → EVP_MD_CTX_new

* lib/sha3.c (sha3_##SIZE##_init_ctx): Avoid deprecated macro name.

2 months agocrypto/sha3: fix errno when freeing
Paul Eggert [Sun, 22 Feb 2026 17:58:37 +0000 (09:58 -0800)] 
crypto/sha3: fix errno when freeing

* lib/sha3.c (sha3_free_ctx): Preserve errno.
* modules/crypto/sha3 (Depends-on):
* modules/crypto/sha3-buffer (Depends-on):
Depend on free-posix.

2 months agocrypto/sha3: fix memory leak with OpenSSL wrapper
Paul Eggert [Sun, 22 Feb 2026 17:52:17 +0000 (09:52 -0800)] 
crypto/sha3: fix memory leak with OpenSSL wrapper

* lib/sha3.c (sha3_##SIZE##_buffer):
Free ctx before returning.

* lib/sha3.c (sha3_process_bytes): Simplify, and replace * with -.

2 months agocrypto/sha3: simplify full-block processing
Paul Eggert [Sun, 22 Feb 2026 17:24:45 +0000 (09:24 -0800)] 
crypto/sha3: simplify full-block processing

* lib/sha3.c (sha3_process_bytes): Simplify.

2 months agocrypto/sha3: fix partial-buffer bug
Paul Eggert [Sun, 22 Feb 2026 16:53:14 +0000 (08:53 -0800)] 
crypto/sha3: fix partial-buffer bug

* lib/sha3.c (sha3_process_bytes):
Update ctx->buflen to 0 if all bytes were processed.
* tests/test-sha3-224-buffer.c:
* tests/test-sha3-256-buffer.c:
* tests/test-sha3-384-buffer.c:
* tests/test-sha3-512-buffer.c:
(mismatch): New function.
(check): Check for the bug.

2 months agostrnul-bench-tests: New module.
Bruno Haible [Sun, 22 Feb 2026 07:58:11 +0000 (08:58 +0100)] 
strnul-bench-tests: New module.

* tests/bench-strnul.c: New file.
* modules/strnul-bench-tests: New file.

2 months agocdefs: omit ungrammatical (and unnecessary) #error
Paul Eggert [Sat, 21 Feb 2026 23:25:40 +0000 (15:25 -0800)] 
cdefs: omit ungrammatical (and unnecessary) #error

* lib/cdefs.h: Remove an ungrammatical #error diagnostic
that is not needed any more, now that people no longer
try to use glibc or Gnulib with K&R C compilers.

2 months agocdefs: merge from glibc
Paul Eggert [Sat, 21 Feb 2026 23:23:26 +0000 (15:23 -0800)] 
cdefs: merge from glibc

Also, minimize whitespace differences from glibc,
to simplify comparison.
* lib/cdefs.h: Do not issue header warning if C++.
(__COLD, __attribute_overloadable__, __REDIRECT_FORTIFY)
(__REDIRECT_FORTIFY_NTH, __glibc_const_generic)
(__attribute_struct_may_alias__): New macros.
Several other new macros are defined if !__GNULIB_CDEFS.
(__glibc_safe_or_unknown_len): Check that __osz is a constant.
(__REDIRECT_LDBL): Optimize error redirects for ieeelongdouble.
(__fortified_attr_access): Drop access attribute for _FORTIFY_SOURCE=3.

2 months agostrnul: Add tests.
Bruno Haible [Sat, 21 Feb 2026 09:28:11 +0000 (10:28 +0100)] 
strnul: Add tests.

* tests/test-strnul.c: New file.
* tests/test-strnul-c++.cc: New file.
* modules/strnul-tests: New file.
* modules/strnul-c++-tests: New file.

2 months agostrnul: New module.
Bruno Haible [Sat, 21 Feb 2026 09:26:13 +0000 (10:26 +0100)] 
strnul: New module.

Suggested by Alejandro Colomar <alx@kernel.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00121.html>.

* lib/string.in.h (gl_strnul): New function.
(strnul): New macro or template.
* lib/string.c: Update comment.
* m4/string_h.m4 (gl_STRING_H_REQUIRE_DEFAULTS): Initialize
GNULIB_STRNUL.
* modules/string-h (Makefile.am): Substitute GNULIB_STRNUL.
* modules/strnul: New file.

2 months agostreq: Rename to streq-opt.
Bruno Haible [Sat, 21 Feb 2026 07:02:52 +0000 (08:02 +0100)] 
streq: Rename to streq-opt.

* lib/streq-opt.h: Renamed from lib/streq.h.
* modules/streq-opt: Renamed from modules/streq.
* NEWS: Mention the change.
* lib/c32is-impl.h: Include streq-opt.h instead of streq.h.
* lib/c32to-impl.h: Likewise.
* lib/c32rtomb.c: Likewise.
* lib/c32width.c: Likewise.
* lib/lc-charset-dispatch.c: Likewise.
* lib/lc-charset-unicode.c: Likewise.
* lib/mbrtoc32.c: Likewise.
* lib/uniwidth/cjk.h: Likewise.
* lib/wcwidth.c: Likewise.
* modules/c32is* (Depends-on): Add streq-opt. Remove streq.
* modules/c32to* (Depends-on): Likewise.
* modules/c32rtomb (Depends-on): Likewise.
* modules/mbrtoc32 (Depends-on): Likewise.
* modules/mbrtowc (Depends-on): Likewise.
* modules/uchar-h-c23 (Depends-on): Likewise.
* modules/unilbrk/u*-possible-linebreaks (Depends-on): Likewise.
* modules/uniwidth/width (Depends-on): Likewise.
* modules/wcwidth (Depends-on): Likewise.
* MODULES.html.sh: Update.

2 months agocsharpcomp: Use str_endswith.
Bruno Haible [Sat, 21 Feb 2026 00:48:07 +0000 (01:48 +0100)] 
csharpcomp: Use str_endswith.

Suggested by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00129.html>.

* lib/csharpcomp.c (compile_csharp_using_mono,
compile_csharp_using_dotnet, compile_csharp_using_sscli,
compile_csharp_class): Use str_endswith.
* modules/csharpcomp (Depends-on): Add str_endswith.

2 months agoSay B5000 and U1103 don’t do C23
Paul Eggert [Fri, 20 Feb 2026 21:54:10 +0000 (13:54 -0800)] 
Say B5000 and U1103 don’t do C23

2 months agoMention CheriBSD as tested
Paul Eggert [Fri, 20 Feb 2026 21:52:39 +0000 (13:52 -0800)] 
Mention CheriBSD as tested

2 months agodoc: fix ChangeLog and mention xlc versions
Paul Eggert [Fri, 20 Feb 2026 21:29:25 +0000 (13:29 -0800)] 
doc: fix ChangeLog and mention xlc versions

2 months agoi-ring: Relicense under LGPLv2+.
Bruno Haible [Fri, 20 Feb 2026 12:50:45 +0000 (13:50 +0100)] 
i-ring: Relicense under LGPLv2+.

* modules/i-ring (License): Change to LGPLv2+.
* lib/i-ring.h: Update license notice.
* lib/i-ring.c: Likewise.

2 months agocycle-check: Relicense under LGPLv2+.
Bruno Haible [Thu, 19 Feb 2026 14:00:04 +0000 (15:00 +0100)] 
cycle-check: Relicense under LGPLv2+.

Jim Meyering's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00109.html>.
Paul Eggert's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00106.html>.

* modules/cycle-check (License): Change to LGPLv2+.
* lib/cycle-check.h: Update license notice.
* lib/cycle-check.c: Likewise.

2 months agodev-ino: Relicense under LGPLv2+.
Bruno Haible [Thu, 19 Feb 2026 13:53:22 +0000 (14:53 +0100)] 
dev-ino: Relicense under LGPLv2+.

Jim Meyering's permission is at
<https://lists.gnu.org/archive/html/bug-gnulib/2026-02/msg00109.html>.

* modules/dev-ino (License): Change to LGPLv2+.
* lib/dev-ino.h: Update license notice.

2 months agocpu-supports: Fix typos.
Collin Funk [Thu, 19 Feb 2026 03:02:58 +0000 (19:02 -0800)] 
cpu-supports: Fix typos.

* lib/cpu-supports.h (gcc_feature_to_glibc_hwcap): Fix typos in
comments.

2 months agocpu-supports: Add detection for Advanced SIMD (Neon) instructions.
Collin Funk [Thu, 19 Feb 2026 03:00:31 +0000 (19:00 -0800)] 
cpu-supports: Add detection for Advanced SIMD (Neon) instructions.

* lib/cpu-supports.h (gcc_feature_to_glibc_hwcap): Map "asimd" to
"-ASIMD". Add a comment on where to find aarch64 hwcaps in glibc.