]> git.ipfire.org Git - thirdparty/gnulib.git/log
thirdparty/gnulib.git
11 hours agoerror-h: Support multiple gnulib-tool invocations in the same package. master
Bruno Haible [Tue, 28 Apr 2026 23:52:17 +0000 (01:52 +0200)] 
error-h: Support multiple gnulib-tool invocations in the same package.

* lib/error.in.h (GNULIB_defined_error, GNULIB_defined_error_at_line):
New macros.
(verror): Test GNULIB_defined_verror, for consistency with the idiom.
(verror_at_line): Test GNULIB_defined_verror_at_line, for consistency
with the idiom.

11 hours agorealloc-posix: Support multiple gnulib-tool invocations in a package.
Bruno Haible [Tue, 28 Apr 2026 23:49:40 +0000 (01:49 +0200)] 
realloc-posix: Support multiple gnulib-tool invocations in a package.

* lib/stdlib.in.h (rpl_realloc): Don't define if _GL_INLINE_RPL_REALLOC
is already defined.

11 hours agostring-h: Support multiple gnulib-tool invocations in the same package.
Bruno Haible [Tue, 28 Apr 2026 23:47:39 +0000 (01:47 +0200)] 
string-h: Support multiple gnulib-tool invocations in the same package.

* lib/string.in.h (GNULIB_defined_memeq, GNULIB_defined_streq,
GNULIB_defined_strnul): New macros.

11 hours agostdbit-h: Support multiple gnulib-tool invocations in the same package.
Bruno Haible [Tue, 28 Apr 2026 23:46:06 +0000 (01:46 +0200)] 
stdbit-h: Support multiple gnulib-tool invocations in the same package.

* lib/stdbit.in.h (GNULIB_defined_clz_functions,
GNULIB_defined_stdc_leading_zeros_functions,
GNULIB_defined_stdc_leading_ones_functions,
GNULIB_defined_ctz_functions,
GNULIB_defined_stdc_trailing_zeros_functions,
GNULIB_defined_stdc_trailing_ones_functions,
GNULIB_defined_stdc_first_leading_zero_functions,
GNULIB_defined_stdc_first_leading_one_functions,
GNULIB_defined_stdc_first_trailing_zero_functions,
GNULIB_defined_stdc_first_trailing_one_functions,
GNULIB_defined_popcount_functions,
GNULIB_defined_stdc_count_ones_functions,
GNULIB_defined_stdc_count_zeros_functions,
GNULIB_defined_stdc_has_single_bit_functions,
GNULIB_defined_stdc_bit_width_functions,
GNULIB_defined_stdc_bit_floor_functions,
GNULIB_defined_stdc_bit_ceil_functions,
GNULIB_defined_stdc_rotate_left_functions,
GNULIB_defined_stdc_rotate_right_functions,
GNULIB_defined_stdc_memreverse8,
GNULIB_defined_stdc_memreverse8u_functions,
GNULIB_defined_stdc_load8_functions,
GNULIB_defined_stdc_load8_aligned_functions,
GNULIB_defined_stdc_store8_functions,
GNULIB_defined_stdc_store8_aligned_functions): New macros.

11 hours agoendian: Support multiple gnulib-tool invocations in the same package.
Bruno Haible [Tue, 28 Apr 2026 23:40:18 +0000 (01:40 +0200)] 
endian: Support multiple gnulib-tool invocations in the same package.

* lib/endian.in.h (GNULIB_defined_be16toh, GNULIB_defined_be32toh,
GNULIB_defined_be64toh, GNULIB_defined_htobe16, GNULIB_defined_htobe32,
GNULIB_defined_htobe64, GNULIB_defined_le16toh, GNULIB_defined_le32toh,
GNULIB_defined_le64toh, GNULIB_defined_htole16, GNULIB_defined_htole32,
GNULIB_defined_htole64): New macros.

11 hours agoarpa_inet-h: Support multiple gnulib-tool invocations in a package.
Bruno Haible [Tue, 28 Apr 2026 23:37:37 +0000 (01:37 +0200)] 
arpa_inet-h: Support multiple gnulib-tool invocations in a package.

* lib/arpa_inet.in.h (GNULIB_defined_htons, GNULIB_defined_htonl,
GNULIB_defined_ntohs, GNULIB_defined_ntohl): New macros.

12 hours agostdbit-h: Fix syntax error in C++ mode.
Bruno Haible [Tue, 28 Apr 2026 23:19:10 +0000 (01:19 +0200)] 
stdbit-h: Fix syntax error in C++ mode.

* lib/stdbit.in.h (__STDC_ENDIAN_*): Define also in C++ mode.

12 hours agostdbit-h: Fix syntax errors in C++ mode (regression 2026-03-16).
Bruno Haible [Tue, 28 Apr 2026 23:23:23 +0000 (01:23 +0200)] 
stdbit-h: Fix syntax errors in C++ mode (regression 2026-03-16).

* lib/stdbit.in.h: Include <stddef.h> also for the stdc_memreverse8
module. Include <stdint.h> also when HAVE_STDBIT_H is 1 and
__UINT_FAST64_TYPE__ is defined and some module needs it.

19 hours agouchar-h: Support multiple gnulib-tool invocations in the same package.
Bruno Haible [Tue, 28 Apr 2026 15:45:52 +0000 (17:45 +0200)] 
uchar-h: Support multiple gnulib-tool invocations in the same package.

* lib/uchar.in.h (GNULIB_defined_btoc32, GNULIB_defined_c32isalnum,
GNULIB_defined_c32isalpha, GNULIB_defined_c32isblank,
GNULIB_defined_c32iscntrl, GNULIB_defined_c32isdigit,
GNULIB_defined_c32isgraph, GNULIB_defined_c32islower,
GNULIB_defined_c32isprint, GNULIB_defined_c32ispunct,
GNULIB_defined_c32isspace, GNULIB_defined_c32isupper,
GNULIB_defined_c32isxdigit, GNULIB_defined_c32tolower,
GNULIB_defined_c32toupper, GNULIB_defined_c32width,
GNULIB_defined_c32snrtombs, GNULIB_defined_c32srtombs,
GNULIB_defined_c32stombs, GNULIB_defined_c32swidth,
GNULIB_defined_c32tob, GNULIB_defined_mbsnrtoc32s,
GNULIB_defined_mbsrtoc32s, GNULIB_defined_mbstoc32s,
GNULIB_defined_c32_get_type_test, GNULIB_defined_c32_apply_type_test,
GNULIB_defined_c32_get_mapping, GNULIB_defined_c32_apply_mapping): New
macros.

20 hours agoregex: pacify gcc -Wint-in-bool-context
Paul Eggert [Tue, 28 Apr 2026 15:19:08 +0000 (08:19 -0700)] 
regex: pacify gcc -Wint-in-bool-context

* lib/regex_internal.h (re_malloc): Rewrite so that callers
don’t do the equivalent of !(2 * n), which elicits the warning.

20 hours agoautoupdate
Karl Berry [Tue, 28 Apr 2026 15:07:25 +0000 (08:07 -0700)] 
autoupdate

20 hours agowindows-cygpath: Handle UNC file names on Cygwin correctly.
Bruno Haible [Tue, 28 Apr 2026 14:49:45 +0000 (16:49 +0200)] 
windows-cygpath: Handle UNC file names on Cygwin correctly.

Reported and initial patch by Vaclav Slavik <vaclav@slavik.io> in
<https://savannah.gnu.org/bugs/?68291>.

* lib/windows-cygpath.c (windows_cygpath_w): Treat file names that start
with '//' like absolute native Windows file names.

26 hours agoidx: Remove redundant #include.
Bruno Haible [Tue, 28 Apr 2026 09:23:21 +0000 (11:23 +0200)] 
idx: Remove redundant #include.

* lib/idx.h: Drop the second #include <stddef.h>.

26 hours agoc-strtod tests: Improve last patch.
Bruno Haible [Tue, 28 Apr 2026 09:06:24 +0000 (11:06 +0200)] 
c-strtod tests: Improve last patch.

* tests/test-c-strtof-mt.c: Revert addition of dead code.
* tests/test-c-strtod-mt.c: Likewise.
* tests/test-c-strtold-mt.c: Likewise.
* tests/test-c-strtof-mt.sh: Don't assume that if one invocation of the
test program has exit code 77, the other invocation will have exit code
77 as well.
* tests/test-c-strtod-mt.sh: Likewise.
* tests/test-c-strtold-mt.sh: Likewise.

27 hours agothread: Fix possible link error (regression 2026-04-25).
Bruno Haible [Tue, 28 Apr 2026 08:20:06 +0000 (10:20 +0200)] 
thread: Fix possible link error (regression 2026-04-25).

* lib/glthread/thread.c (gl_thread_create): Define always. Ignore
-Wsuggest-attribute=noreturn warning.

27 hours agothread: Improve no-op macros.
Bruno Haible [Tue, 28 Apr 2026 06:11:49 +0000 (08:11 +0200)] 
thread: Improve no-op macros.

* lib/glthread/thread.h (glthread_atfork, glthread_create,
glthread_sigmask, glthread_join): Improve indentation.
(gl_thread_exit): Simplify.

29 hours agodfa: fix lib/localeinfo.c char32_t comments
Paul Eggert [Tue, 28 Apr 2026 06:16:03 +0000 (23:16 -0700)] 
dfa: fix lib/localeinfo.c char32_t comments

37 hours agoregex: port to non-GNU malloc
Paul Eggert [Mon, 27 Apr 2026 21:55:39 +0000 (14:55 -0700)] 
regex: port to non-GNU malloc

This is for Gawk, which does not use malloc-gnu.
* lib/regex.c (_GL_USE_STDLIB_ALLOC) [!_LIBC]:
Define, since this module is now safe for AIX-like malloc.
* lib/regex_internal.h (re_malloc) [!_LIBC && !HAVE_MALLOC_0_NONNULL]:
Don’t pass 0 to malloc.

37 hours agoregex: SSIZE_MAX porting
Paul Eggert [Mon, 27 Apr 2026 21:15:40 +0000 (14:15 -0700)] 
regex: SSIZE_MAX porting

* lib/regex_internal.h (IDX_MAX) [_REGEX_LARGE_OFFSETS]:
Port to non-POSIX platforms where limits.h does not define SSIZE_MAX.
This is for Gawk, which does not use Gnulib limits.h.

39 hours agoidx: cleaner namespace on GNU
Paul Eggert [Mon, 27 Apr 2026 20:05:32 +0000 (13:05 -0700)] 
idx: cleaner namespace on GNU

* lib/idx.h: Include <stddef.h>, <stdint.h> only if needed.
(idx_t, IDX_MAX): Rely on builtin macros __PTRDIFF_TYPE__,
__PTRDIFF_MAX__ if present; this avoids polluting the namespace on
GNUish systems.

44 hours agoautoupdate
Karl Berry [Mon, 27 Apr 2026 15:00:44 +0000 (08:00 -0700)] 
autoupdate

2 days agolocalename-unsafe: respect --disable-threads
Paul Eggert [Sun, 26 Apr 2026 22:09:00 +0000 (15:09 -0700)] 
localename-unsafe: respect --disable-threads

Respect --disable-threads on native MS-Windows.
* lib/localename-unsafe.c (GLWTHREAD_MUTEX_INIT, glwthread_mutex_t)
(glwthread_mutex_lock, glwthread_mutex_unlock)
[AVOID_ANY_THREADS && _WIN32 && !__CYGWIN]:
Instead of including "windows-mutex.h", provide no-op substitutes
for its symbols used here.

2 days agoautoupdate
Karl Berry [Sun, 26 Apr 2026 14:51:44 +0000 (07:51 -0700)] 
autoupdate

3 days agoc-strtod-tests: port to single-threaded builds
Paul Eggert [Sat, 25 Apr 2026 22:25:09 +0000 (15:25 -0700)] 
c-strtod-tests: port to single-threaded builds

* tests/test-c-strtod-mt.c:
* tests/test-c-strtof-mt.c:
* tests/test-c-strtold-mt.c:
(main): The tests make no sense when single-threaded, so skip them
by exiting with status 77.
* tests/test-c-strtod-mt.sh:
* tests/test-c-strtof-mt.sh:
* tests/test-c-strtold-mt.sh:
Exit with the failing test’s status, so that if it exits with
status 77 then we do too.

3 days agocond: always include glthread/lock.h
Paul Eggert [Sat, 25 Apr 2026 22:19:27 +0000 (15:19 -0700)] 
cond: always include glthread/lock.h

* lib/glthread/cond.h: Revert my 2026-03-31 namespace cleanup
patch, which was incorrect because this header’s
gl_cond_timedwait_func function uses lock_t even when threading is
disabled.

3 days agothread: better nonreturn fix for gl_thread_create
Paul Eggert [Sat, 25 Apr 2026 22:15:48 +0000 (15:15 -0700)] 
thread: better nonreturn fix for gl_thread_create

* lib/glthread/thread.c (gl_thread_create):
Define as a function only if multithreading.
This is cleaner than my previous patch today that sometimes made
it _Noreturn, as the function’s definition and declaration now always
agree on noreturnedness, and it pushes the noreturnedness issue up
to the caller.  Also, it suppresses GCC’s “warning: function
declared 'noreturn' has a 'return' statement”.

3 days agothread: pacify gcc -Wunused-value
Paul Eggert [Sat, 25 Apr 2026 16:40:41 +0000 (09:40 -0700)] 
thread: pacify gcc -Wunused-value

* lib/glthread/thread.h (glthread_atfork, glthread_sigmask)
(glthread_create, glthread_join): Evaluate arguments even when
these macros are no-ops.  Type-check the arguments too.  This is
cleaner anyway, in case the args have the wrong types (or have
side effects!).

3 days agothread: pacify gcc -Wsuggest-attribute=noreturn
Paul Eggert [Sat, 25 Apr 2026 16:40:41 +0000 (09:40 -0700)] 
thread: pacify gcc -Wsuggest-attribute=noreturn

* lib/glthread/thread.c (gl_thread_create):
When threading is disabled, this function is _Noreturn.

3 days agoregex: Remove misplaced comment.
Bruno Haible [Sat, 25 Apr 2026 09:41:27 +0000 (11:41 +0200)] 
regex: Remove misplaced comment.

* modules/regex (Depends-on): Don't mention uchar-h-c23.

3 days agoxstrtol tests: Don't rely on is_GNULIB_strtol.
Bruno Haible [Sat, 25 Apr 2026 16:15:46 +0000 (18:15 +0200)] 
xstrtol tests: Don't rely on is_GNULIB_strtol.

In a testdir, the Gnulib replacement for strtol may be used in gltests/
but not in gllib/.

* tests/test-xstrtol.c (is_GNULIB_strtol): Remove macro.
(main): Accept both behaviours of strtol on all platforms except MSVC.
* tests/test-xstrtoll.c (is_GNULIB_strtol): Remove macro.

4 days agoregex: Fix link error on macOS and FreeBSD (regression yesterday).
Bruno Haible [Sat, 25 Apr 2026 09:26:37 +0000 (11:26 +0200)] 
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).

4 days agouchar-h tests: Strengthen tests.
Bruno Haible [Sat, 25 Apr 2026 08:09:58 +0000 (10:09 +0200)] 
uchar-h tests: Strengthen tests.

* tests/test-uchar-h.c: Move #include <wchar.h> after most other tests
are done.

4 days agoregex: be consistent with dfa
Paul Eggert [Sat, 25 Apr 2026 00:28:58 +0000 (17:28 -0700)] 
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.

4 days agodfa: always use char32_t not wchar_t
Paul Eggert [Sat, 25 Apr 2026 00:14:22 +0000 (17:14 -0700)] 
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.

4 days agouchar-h: <string.h> etc. namespace cleanup
Paul Eggert [Fri, 24 Apr 2026 23:00:34 +0000 (16:00 -0700)] 
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.

4 days agodoc: document namespace pollution allowed by POSIX
Paul Eggert [Fri, 24 Apr 2026 21:09:31 +0000 (14:09 -0700)] 
doc: document namespace pollution allowed by POSIX

In the manual, document where POSIX.1-2024 allows namespace pollution.
Although it might be nice to add something like GNULIB_POSIXCHECK to
detect when Gnulib-using code is unportable in this area, I don’t
offhand see a good way to do that.

4 days agoversion-etc: Optionally emit another line for the man page.
Bruno Haible [Fri, 24 Apr 2026 13:31:00 +0000 (15:31 +0200)] 
version-etc: Optionally emit another line for the man page.

* lib/version-etc.c: Include <stdlib.h>.
(emit_bug_reporting_address): Terminate the "Report bugs to" sentence,
as suggested in
https://www.gnu.org/software/gettext/manual/html_node/Bug-Report-Address.html.
Add a "Report any translation bugs to" sentence, but only when producing
a man page.

4 days agobcp47: Fix handling of variants of length 4.
Bruno Haible [Fri, 24 Apr 2026 13:57:52 +0000 (15:57 +0200)] 
bcp47: Fix handling of variants of length 4.

Reported by Patrice Dumas <pertusus@gnu.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2026-04/msg00154.html>.

* lib/bcp47.c (bcp47_to_xpg): Don't parse a variant of length 4 that
contains some digits as a script.
* tests/test-bcp47.c (main): Add a test case with a variant of length 4.

5 days agowchar-h: <string.h> namespace cleanup
Paul Eggert [Thu, 23 Apr 2026 19:59:52 +0000 (12:59 -0700)] 
wchar-h: <string.h> namespace cleanup

Do not pollute <wchar.h> includers with <string.h> names
on GCC-compatible platforms.
* lib/wchar.in.h (_GL_WCHAR_MEMSET) [@GNULIB_MBSZERO@]: New macro.
(mbszero): Use it.

8 days agoautoupdate
Karl Berry [Mon, 20 Apr 2026 14:27:13 +0000 (07:27 -0700)] 
autoupdate

8 days agoautoupdate
Karl Berry [Mon, 20 Apr 2026 14:22:45 +0000 (07:22 -0700)] 
autoupdate

9 days agomaint.mk: fix sc_Wundef_boolean race with parallel syntax-check
Jim Meyering [Mon, 20 Apr 2026 02:36:03 +0000 (19:36 -0700)] 
maint.mk: fix sc_Wundef_boolean race with parallel syntax-check

With highly parallel "make syntax-check", sc_Wundef_boolean's
in_files='config.h' was matched as an unanchored, unescaped regex
by "find | grep -E", so the '.' matched any character and the lack
of anchoring matched anywhere in a path.  This made it match the
.sc-start-sc_*config_h* marker files created by parallel rules.
Symptom: I saw see these go by:
  grep: ./.sc-start-sc_require_config_h_first: No such file or directory
  grep: ./.sc-start-sc_prohibit_have_config_h: No such file or directory
  grep: ./.sc-start-sc_require_config_h: No such file or directory
* top/maint.mk (sc_Wundef_boolean): Use '(^|/)config\.h$' rather
than bare 'config.h' as the in_files ERE.

9 days agoregex tests: pacify -Wshadow
Paul Eggert [Sun, 19 Apr 2026 18:21:49 +0000 (11:21 -0700)] 
regex tests: pacify -Wshadow

* tests/test-regex.c (main):
Rename a local to avoid shadowing confusion.

9 days agoreadutmp: greeters are not users
Paul Eggert [Sun, 19 Apr 2026 18:12:16 +0000 (11:12 -0700)] 
readutmp: greeters are not users

* lib/readutmp.c (read_utmp_from_systemd):
Do not merely treat a "manager*" class as a login process.
Instead, treat all non-"user*" processes as login processes.
With current systemd, this changes the treatment of "greeter",
"lock-screen", "background", "background-light", and "none"
classes so that they are now considered to be login processes, not
user processes.

9 days agoregex: avoid a UBSAN failure: remove an unnecessary DEBUG_ASSERT
Jim Meyering [Sun, 19 Apr 2026 16:52:26 +0000 (09:52 -0700)] 
regex: avoid a UBSAN failure: remove an unnecessary DEBUG_ASSERT

* lib/regex_internal.c (re_node_set_insert): Remove the DEBUG_ASSERT
and instead return early for an attempt to insert an ELEM that is
already present in the set.  Relax the function's comment that says
there should be no duplicate.  This function is called from many
places and has been working fine.  With its nontrivial backrefs,
the sample regexp apparently elicits enough backtracking retries
and state-set merges to trigger this duplicate insertion attempt.
Reported by Bruno Haible in
https://lists.gnu.org/r/bug-gnulib/2026-04/msg00138.html

9 days agoregex tests: Add a test case that triggers an assertion failure.
Bruno Haible [Sun, 19 Apr 2026 13:18:55 +0000 (15:18 +0200)] 
regex tests: Add a test case that triggers an assertion failure.

* tests/test-regex.c (main): Add a test case related to back references.

10 days agoreadutmp: Silence -Wzero-as-null-pointer-constant warning.
Collin Funk [Sun, 19 Apr 2026 02:42:21 +0000 (19:42 -0700)] 
readutmp: Silence -Wzero-as-null-pointer-constant warning.

* lib/readutmp.c (read_utmp_from_systemd): Initialize all of the struct
members and use NULL for the pointer.

11 days agodoc: doc FTS_NOSTAT with FIFO, not directory
Paul Eggert [Fri, 17 Apr 2026 16:14:49 +0000 (09:14 -0700)] 
doc: doc FTS_NOSTAT with FIFO, not directory

* lib/fts.in.h (FTS_NOSTAT): Use a FIFO, not a directory,
in the commentary’s example.  This is a better example
because directories never have FTS_NSOK.

12 days agoregex: Silence -Wzero-as-null-pointer-constant warning.
Collin Funk [Fri, 17 Apr 2026 04:50:27 +0000 (21:50 -0700)] 
regex: Silence -Wzero-as-null-pointer-constant warning.

* lib/regexec.c (merge_state_with_log): Check the pointer against NULL.

12 days agobyteswap: Fix compilation on Solaris OpenIndiana (regr. 2026-03-20).
Bruno Haible [Thu, 16 Apr 2026 16:49:36 +0000 (18:49 +0200)] 
byteswap: Fix compilation on Solaris OpenIndiana (regr. 2026-03-20).

* lib/byteswap.in.h: Include <stdint.h>.
* modules/byteswap (Depends-on): Add stdint-h.

12 days agosigdelay: Don't use out-of-range signal numbers.
Bruno Haible [Thu, 16 Apr 2026 12:15:52 +0000 (14:15 +0200)] 
sigdelay: Don't use out-of-range signal numbers.

* lib/sigdelay.c (states): Change number of elements to NSIG.

12 days agosigdelay, posix-spawn-internal: Ignore out-of-range signal numbers.
Bruno Haible [Thu, 16 Apr 2026 12:14:38 +0000 (14:14 +0200)] 
sigdelay, posix-spawn-internal: Ignore out-of-range signal numbers.

* lib/sigdelay.c (sigdelay): Do nothing when sigismember() returns -1.
* lib/spawni.c (__spawni): Likewise.

13 days agosigprocmask: Fix sigismember function.
Bruno Haible [Thu, 16 Apr 2026 11:03:39 +0000 (13:03 +0200)] 
sigprocmask: Fix sigismember function.

* lib/sigprocmask.c (sigismember): If the signal argument is invalid,
return -1 instead of 0.

13 days agopthread_sigmask tests: Fix test failure on Solaris, AIX (regr. today).
Bruno Haible [Wed, 15 Apr 2026 22:28:43 +0000 (00:28 +0200)] 
pthread_sigmask tests: Fix test failure on Solaris, AIX (regr. today).

Reported by Pádraig Brady.

* tests/test-pthread_sigmask2.c (main): Reestablish the signal handler
after SIGINT arrived.
* tests/test-sigdelay2.c (main): Likewise.

13 days agodoc: doc FTS_NOSTAT similarity to FTS_DEFER_STAT
Paul Eggert [Wed, 15 Apr 2026 21:47:55 +0000 (14:47 -0700)] 
doc: doc FTS_NOSTAT similarity to FTS_DEFER_STAT

* lib/fts.in.h (FTS_NOSTAT, FTS_DEFER_STAT):
Document that FTS_NOSTAT updates fts_statp->st_mode
similarly with FTS_DEFER_STAT.

13 days agofts: match doc for FTS_DEFER_STAT mode
Paul Eggert [Wed, 15 Apr 2026 21:45:53 +0000 (14:45 -0700)] 
fts: match doc for FTS_DEFER_STAT mode

* lib/fts.c (fts_open): Clear fts_statp->fts_mode for the
FTS_DEFER_STAT case too, since it’s documented to work since 2008.

13 days agosigdelay: Add tests.
Bruno Haible [Wed, 15 Apr 2026 11:45:58 +0000 (13:45 +0200)] 
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.

13 days agosigdelay: New module.
Bruno Haible [Wed, 15 Apr 2026 11:45:52 +0000 (13:45 +0200)] 
sigdelay: New module.

* lib/sigdelay.h: New file.
* lib/sigdelay.c: New file.
* modules/sigdelay: New file.

13 days agopthread_sigmask tests: Enhance test.
Bruno Haible [Wed, 15 Apr 2026 11:45:44 +0000 (13:45 +0200)] 
pthread_sigmask tests: Enhance test.

* tests/test-pthread_sigmask2.c (killer_thread1): Renamed from
killer_thread.
(killer_thread2): New variable.
(killer_thread1_func): Renamed from killer_thread_func.
(killer_thread2_func): New function.
(main): Add a second test with killer_thread2.

13 days agopthread_sigmask tests: More details about VirtualBox / KVM bug.
Bruno Haible [Wed, 15 Apr 2026 11:45:35 +0000 (13:45 +0200)] 
pthread_sigmask tests: More details about VirtualBox / KVM bug.

* tests/test-pthread_sigmask1.c (main): Refine comment regarding
VirtualBox / KVM bug.
* tests/test-pthread_sigmask2.c (main): Likewise.

2 weeks agosigprocmask: On mingw, avoid dependency on libwinpthread.
Bruno Haible [Tue, 14 Apr 2026 19:56:00 +0000 (21:56 +0200)] 
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.

2 weeks agosigaction: Fix test failure on native Windows.
Bruno Haible [Tue, 14 Apr 2026 18:38:39 +0000 (20:38 +0200)] 
sigaction: Fix test failure on native Windows.

* lib/sigaction.c (sigaction): Hide the sigaction_handler from the
caller.

2 weeks agoerror_h: fix icx version in commentary
Paul Eggert [Tue, 14 Apr 2026 02:19:09 +0000 (19:19 -0700)] 
error_h: fix icx version in commentary

2 weeks agostdbit-h: Port to Intel icpx C++ compiler.
Bruno Haible [Mon, 13 Apr 2026 21:44:24 +0000 (23:44 +0200)] 
stdbit-h: Port to Intel icpx C++ compiler.

* lib/stdbit.in.h: With the Intel icpx C++ compiler, include <stddef.h>
and <stdint.h>, and define the __STDC_ENDIAN_* macros.
* doc/posix-headers/stdbit.texi: Document the Intel icpx bug.

2 weeks agoerror-h: port to Intel OneAPI icx 2026.0.0
Paul Eggert [Mon, 13 Apr 2026 21:01:36 +0000 (14:01 -0700)] 
error-h: port to Intel OneAPI icx 2026.0.0

Problem reported by Harmen Stoppels in:
https://lists.gnu.org/r/bug-gnulib/2026-04/msg00085.html
* m4/error_h.m4 (gl_ERROR_H): Plant an alarm in case error infloops.

2 weeks agoregex: omit unnecessary check_halt_state_context
Paul Eggert [Mon, 13 Apr 2026 20:26:58 +0000 (13:26 -0700)] 
regex: omit unnecessary check_halt_state_context

* lib/regexec.c (prune_impossible_nodes):
Avoid unnecessary call to check_halt_state_context.
Suggested by Florian Weimer in:
https://sourceware.org/pipermail/libc-alpha/2026-April/176627.html

2 weeks agoregex: Fix use of uninitialized variable (regression yesterday).
Bruno Haible [Mon, 13 Apr 2026 15:14:26 +0000 (17:14 +0200)] 
regex: Fix use of uninitialized variable (regression yesterday).

Reported by Coverity.

* lib/regexec.c (re_search_internal): Move initialization of variable
'save_state_log' further up.

2 weeks agoregex: small simplification
Jim Meyering [Mon, 13 Apr 2026 06:07:09 +0000 (23:07 -0700)] 
regex: small simplification

* lib/regexec.c (re_search_internal): Use only one copy
of the 5-line reg-initialization code, removing that else block,
at the tiny cost of moving a small test into the loop.

2 weeks agoregex: fix missed short match with backrefs
Jim Meyering [Sun, 12 Apr 2026 19:36:45 +0000 (12:36 -0700)] 
regex: fix missed short match with backrefs

With a backref pattern like ^(.?)(.?).?\2\1 (no $), the engine
could miss valid short matches.  For example, "ab" should match
via all-empty groups, yet regexec returned no-match because
set_regs failed at the longest structural match (match_last=2)
and never retried at a shorter match_last.
* lib/regexec.c (re_search_internal): When set_regs fails for a
backref pattern, retry prune_impossible_nodes and set_regs at
progressively shorter match lengths.  Save a copy of state_log
before pruning so shorter retries can re-sift from the original
states.
* m4/regex.m4: Also reject system regex with this bug.
* tests/test-regex.c (main): Add a test for this bug.
Reported by Ed Morton in https://bugs.gnu.org/68725
Co-authored-by: Claude <noreply@anthropic.com>
2 weeks agodoc: update documentation about fopen with the 'e' mode character
Collin Funk [Sun, 12 Apr 2026 19:07:00 +0000 (12:07 -0700)] 
doc: update documentation about fopen with the 'e' mode character

* doc/posix-functions/fopen.texi: Mention the 'e' mode character was
added in POSIX.1-2024 instead of a future revision.

2 weeks agoregex: fix false match with backrefs and $ anchor
Jim Meyering [Sun, 12 Apr 2026 17:27:03 +0000 (10:27 -0700)] 
regex: fix false match with backrefs and $ anchor

Use of sed or grep with both backreferences and an end-of-line
anchor could get false matches.  For example, this grep command
would falsely declare "ab" to be a palindrome:
  grep -E '^(.?)(.?).?\2\1$' <<< ab
In prune_impossible_nodes, falling back to a shorter match
skipped the halt-state context check, so $ was not verified.
* lib/regexec.c (prune_impossible_nodes): Also require
check_halt_state_context to succeed in the loop that searches
for an earlier halt state.
* m4/regex.m4: Bump serial to 82.  Reject any system regex
implementation with this bug.
* tests/test-regex.c (main): Add a test for this bug.
Reported by Ed Morton in https://bugs.gnu.org/68725

2 weeks agotempname: call ‘clock’ only if !CLOCK_REALTIME
Paul Eggert [Sat, 11 Apr 2026 21:06:09 +0000 (14:06 -0700)] 
tempname: call ‘clock’ only if !CLOCK_REALTIME

* lib/tempname.c (random_bits) [CLOCK_REALTIME]: Do not call
‘clock’, as an optimization.  There is no need to call ‘clock’, as
it likely gives us less info than clock_gettime, and if
clock_gettime fails then ‘clock’ will likely fail too.
This patch is a simplified version of the patch made in glibc commit
5f62cf88c4530c11904482775b7582bd7f6d80d2 dated 2024-09-25,
and Gnulib lib/tempname.c should now be suitable as-is for
replacing Glibc sysdeps/posix/tempname.c.

2 weeks agodoc: fix typos in previous doc patch
Paul Eggert [Sat, 11 Apr 2026 20:29:07 +0000 (13:29 -0700)] 
doc: fix typos in previous doc patch

2 weeks agodoc: be more like POSIX in threading terms
Paul Eggert [Sat, 11 Apr 2026 20:19:43 +0000 (13:19 -0700)] 
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.

2 weeks agosigprocmask: clarify GNULIB_SIGPROCMASK_SINGLE_THREAD doc
Paul Eggert [Sat, 11 Apr 2026 16:36:46 +0000 (09:36 -0700)] 
sigprocmask: clarify GNULIB_SIGPROCMASK_SINGLE_THREAD doc

2 weeks agofenv-exceptions-trapping tests: Make test more debugging friendly.
Bruno Haible [Fri, 10 Apr 2026 23:16:35 +0000 (01:16 +0200)] 
fenv-exceptions-trapping tests: Make test more debugging friendly.

Suggested by Pali Rohár <pali.rohar@gmail.com>.

* tests/test-fenv-except-trapping-1.c (main): Add an assertion.

2 weeks agosigprocmask: Allow single-thread optimization again.
Bruno Haible [Fri, 10 Apr 2026 21:11:40 +0000 (23:11 +0200)] 
sigprocmask: Allow single-thread optimization again.

* lib/sigprocmask.c (glwthread_spin_lock, glwthread_spin_unlock): Define
to empty if GNULIB_SIGPROCMASK_SINGLE_THREAD is defined.
(overrides_mt_lock, overrides_handler_lock): Don't define if
GNULIB_SIGPROCMASK_SINGLE_THREAD is defined.
* doc/multithread.texi (Multithreading Optimizations): Document
GNULIB_SIGPROCMASK_SINGLE_THREAD instead of
GNULIB_PTHREAD_SIGMASK_SINGLE_THREAD.

2 weeks agosigprocmask: Fix a signal-handler hang in case of a race condition.
Bruno Haible [Fri, 10 Apr 2026 20:57:04 +0000 (22:57 +0200)] 
sigprocmask: Fix a signal-handler hang in case of a race condition.

* lib/sigprocmask.c (overrides_handler_lock): Renamed from
overrides_lock.
(overrides_mt_lock): New variable.
(pthread_sigmask): Lock both locks.
(rpl_signal): Lock overrides_mt_lock, not overrides_lock.

2 weeks agosigprocmask: Support multithreaded applications on native Windows.
Bruno Haible [Fri, 10 Apr 2026 15:22:07 +0000 (17:22 +0200)] 
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.

3 weeks agostat: Update doc regarding mingw bug.
Bruno Haible [Mon, 6 Apr 2026 11:38:22 +0000 (13:38 +0200)] 
stat: Update doc regarding mingw bug.

* doc/posix-functions/stat.texi: Update regarding mingw bug.

3 weeks agombrtowc, mbrtoc32: Silence -Wshadow warnings (regr. 2026-04-02).
Bruno Haible [Mon, 6 Apr 2026 11:21:56 +0000 (13:21 +0200)] 
mbrtowc, mbrtoc32: Silence -Wshadow warnings (regr. 2026-04-02).

Reported by Collin Funk.

* lib/mbrtowc.c (rpl_mbrtowc): Enclose the #include in a block.
* lib/mbrtoc32.c (mbrtoc32): Likewise.

3 weeks agosigprocmask: add NEWS entry
Paul Eggert [Sun, 5 Apr 2026 22:20:39 +0000 (15:20 -0700)] 
sigprocmask: add NEWS entry

3 weeks agoterm-style-control: use pthread_sigmask
Paul Eggert [Sun, 5 Apr 2026 18:29:48 +0000 (11:29 -0700)] 
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.

3 weeks agofatal-signal: use pthread_sigmask
Paul Eggert [Sun, 5 Apr 2026 18:28:19 +0000 (11:28 -0700)] 
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.

3 weeks agosigaction: use pthread_sigmask
Paul Eggert [Sun, 5 Apr 2026 18:26:56 +0000 (11:26 -0700)] 
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.

3 weeks agopthread_sigmask: lock here, not in sigprocmask
Paul Eggert [Sun, 5 Apr 2026 18:25:05 +0000 (11:25 -0700)] 
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’.

3 weeks agomcel: remove forced use of GLIBC's mbrtoc32
Pádraig Brady [Sun, 5 Apr 2026 11:30:21 +0000 (12:30 +0100)] 
mcel: remove forced use of GLIBC's mbrtoc32

This is a performance win on GLIBC,
as tested on the coreutils multi-byte update to cut(1):

   $ yes $(yes éééááé | head -n9 | paste -s -d,) |
     head -n1M > mb.in

   $ time LC_ALL=C.UTF-8 src/cut-before -c1 mb.in >/dev/null
   real    0m1.582s

   $ time LC_ALL=C.UTF-8 src/cut-after -c1 mb.in >/dev/null
   real    0m0.592s

* lib/mcel.h: While GLIBC's mbrtoc32 is functional for mcel,
it is seen to be 2.6x slower than gnulib's implementation
due to GLIBC's per call locale handling.

3 weeks agoposix_spawn-internal: Remove a FIXME.
Bruno Haible [Sat, 4 Apr 2026 21:17:59 +0000 (23:17 +0200)] 
posix_spawn-internal: Remove a FIXME.

* lib/spawni.c (__spawni): Add comment regarding sigprocmask.

3 weeks agolinked-list-unportable-tests: Prefer pthread_sigmask over sigprocmask.
Bruno Haible [Sat, 4 Apr 2026 20:55:34 +0000 (22:55 +0200)] 
linked-list-unportable-tests: Prefer pthread_sigmask over sigprocmask.

Suggested by Paul Eggert.

* tests/test-asyncsafe-linked_list-strong.c (block_sigint): Use
pthread_sigmask instead of sigprocmask.
* tests/test-asyncsafe-linked_list-weak.c (block_sigint): Likewise.

3 weeks agoasyncsafe-spin: Prefer pthread_sigmask over sigprocmask.
Bruno Haible [Sat, 4 Apr 2026 20:44:10 +0000 (22:44 +0200)] 
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).

3 weeks agospawn-pipe: Prefer pthread_sigmask over sigprocmask.
Bruno Haible [Sat, 4 Apr 2026 20:26:25 +0000 (22:26 +0200)] 
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.

3 weeks agoexecute: Prefer pthread_sigmask over sigprocmask.
Bruno Haible [Sat, 4 Apr 2026 20:15:24 +0000 (22:15 +0200)] 
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.

3 weeks agosigpipe-die: Relax specification.
Bruno Haible [Sat, 4 Apr 2026 20:01:56 +0000 (22:01 +0200)] 
sigpipe-die: Relax specification.

* lib/sigpipe-die.h (install_sigpipe_die_handler): Clarify how to use
this function in a multithreaded program.

3 weeks agopthread_sigmask: Make it usable without -lpthread on most platforms.
Bruno Haible [Sat, 4 Apr 2026 13:16:44 +0000 (15:16 +0200)] 
pthread_sigmask: Make it usable without -lpthread on most platforms.

* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Define
PTHREAD_SIGMASK_LIB to empty, except on AIX. Define
PTHREAD_SIGMASK_NOT_IN_LIBC if a workaround is needed.
* lib/pthread_sigmask.c (pthread_sigmask): If
PTHREAD_SIGMASK_NOT_IN_LIBC, just use sigprocmask.
* doc/posix-functions/pthread_sigmask.texi: Mention the dropped link
requirement. Mention that the NetBSD 9 bug is fixed.
* doc/posix-functions/sigprocmask.texi: Update note relating to
pthread_sigmask.

3 weeks agopthread_sigmask: Don't force an override on NetBSD.
Bruno Haible [Sat, 4 Apr 2026 13:16:31 +0000 (15:16 +0200)] 
pthread_sigmask: Don't force an override on NetBSD.

* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): Limit the macro test
to native Windows.

3 weeks agopthread_sigmask tests: Enable all tests on NetBSD.
Bruno Haible [Sat, 4 Apr 2026 13:16:17 +0000 (15:16 +0200)] 
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.

3 weeks agosigprocmask: document race bugs on macOS
Paul Eggert [Sat, 4 Apr 2026 02:55:48 +0000 (19:55 -0700)] 
sigprocmask: document race bugs on macOS

In documentation and comments, mention macOS sigprocmask
incompatibility with GNU and most other systems, and note Gnulib
uses of sigprocmask that can cause subtle race condition bugs on
macOS.  Although an obvious fix is to switch to pthread_sigmask as
POSIX suggests, that will require some changing to linking
instructions, and the first step is documentation.

3 weeks agosigprocmask: single-thread optimization typo fix
Paul Eggert [Fri, 3 Apr 2026 18:22:54 +0000 (11:22 -0700)] 
sigprocmask: single-thread optimization typo fix

* lib/sigprocmask.c (gl_lock_define_initialized):
Swap #if’s then- and else-parts.

3 weeks agombrtoc32: Optimize single-locale case on glibc systems.
Bruno Haible [Thu, 2 Apr 2026 19:59:58 +0000 (21:59 +0200)] 
mbrtoc32: Optimize single-locale case on glibc systems.

Suggested by Pádraig Brady.

* lib/mbrtoc32.c (is_locale_utf8, cached_is_locale_utf8,
is_locale_utf8_cached): New functions/variable, copied from
lib/wcwidth.c.
(mbrtoc32): If GNULIB_WCHAR_SINGLE_LOCALE is defined, optimize the
frequent case of an UTF-8 locale on glibc systems.

3 weeks agombrtowc: Optimize single-locale case on glibc systems.
Bruno Haible [Thu, 2 Apr 2026 19:58:36 +0000 (21:58 +0200)] 
mbrtowc: Optimize single-locale case on glibc systems.

Suggested by Pádraig Brady.

* lib/mbrtowc.c (is_locale_utf8, cached_is_locale_utf8,
is_locale_utf8_cached): New functions/variable, copied from
lib/wcwidth.c.
(rpl_mbrtowc): If GNULIB_WCHAR_SINGLE_LOCALE is defined, optimize the
frequent case of an UTF-8 locale on glibc systems.