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

27719 Commits

Author SHA1 Message Date
Paul Eggert
0256ff8d87 dfa: fix lib/localeinfo.c char32_t comments 2026-04-27 23:16:25 -07:00
Paul Eggert
b2c97c592b 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.
2026-04-27 15:01:18 -07:00
Paul Eggert
f2bbb4391e 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.
2026-04-27 15:01:18 -07:00
Paul Eggert
41aa686604 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.
2026-04-27 13:17:24 -07:00
Karl Berry
2b447deed7 autoupdate 2026-04-27 08:00:44 -07:00
Paul Eggert
45a8afb5e8 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.
2026-04-26 15:10:44 -07:00
Karl Berry
12cde4bfec autoupdate 2026-04-26 07:51:44 -07:00
Paul Eggert
3a0e8d5283 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.
2026-04-25 15:39:32 -07:00
Paul Eggert
88bde746d9 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.
2026-04-25 15:39:32 -07:00
Paul Eggert
c04d5cfcd3 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”.
2026-04-25 15:39:32 -07:00
Paul Eggert
6bce2d2f70 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!).
2026-04-25 09:42:17 -07:00
Paul Eggert
dd1e3c7219 thread: pacify gcc -Wsuggest-attribute=noreturn
* lib/glthread/thread.c (gl_thread_create):
When threading is disabled, this function is _Noreturn.
2026-04-25 09:42:17 -07:00
Bruno Haible
558143e30b regex: Remove misplaced comment.
* modules/regex (Depends-on): Don't mention uchar-h-c23.
2026-04-25 18:16:12 +02:00
Bruno Haible
5d9d0509e3 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.
2026-04-25 18:16:12 +02:00
Bruno Haible
e2fb3d721a regex: Fix link error on macOS and FreeBSD (regression yesterday).
* modules/regex (Link): Add $(LIBUNISTRING), $(LIBC32CONV).
* modules/regex-tests (Makefile.am): Link test-regex with
$(LIBUNISTRING) and $(LIBC32CONV).
2026-04-25 11:36:31 +02:00
Bruno Haible
b71d745ac2 uchar-h tests: Strengthen tests.
* tests/test-uchar-h.c: Move #include <wchar.h> after most other tests
are done.
2026-04-25 10:09:58 +02:00
Paul Eggert
8b9452edea regex: be consistent with dfa
In the regex code, use the char32_t functions instead of the
wchar_t functions, so that regex stays in sync with dfa.
This should fix a bug in Gnu grep reported by Dennis Clarke for
OpenBSD <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=80774#47>.
A similar bug occurs in some macOS releases.
* modules/regex (Depends-on): Replace btowc, iswctype, mbrtowc,
wchar-h, wcrtomb, wctype-h, and wctype with btoc32,
c32_apply_type_test, c32_get_type_test, c32isalnum, c32rtomb,
c32tolower, c32toupper, mbrtoc32-regular, uchar-h.
* lib/regex_internal.h [!_LIBC]: Do not include <wchar.h>, <wctype.h>.
Instead, include <uchar.h> and #define wchar_t, wctype_t,
__wctype, __iswalnum, __iswctype, __towlower, __towupper, __btowc,
__mbrtowc, and __wcrtomb to their char32_t counterparts.
2026-04-24 17:29:50 -07:00
Paul Eggert
4731b2d916 dfa: always use char32_t not wchar_t
This should help merges changes from Gawk, which always uses the
char32_t API though that’s sometimes implemented with the wchar_t
API even on platforms where wchar_t and char32_t act differently.
The idea is to use char32_t uniformly in both the dfa and regex
modules, so that they get consistent answers on all platforms.
* lib/dfa.c, lib/localeinfo.c, lib/localeinfo.h: If GAWK, do not
include <wctype.h> or redefine the Gnulib char32_t types and
functions to be wchar.h and wctype.h functions or define mbszero
and streq, as I think I have a better way to do this with Gawk
that is less intrusive here; instead, always include <uchar.h>.
* lib/dfa.c: Do not include <wchar.h>.  Include "getext.h" before
including "xalloc.h" and "localinfo.h", as Gnulib doesn’t care
about the order and this works better with Gawk’s way of overriding Gnulib.
(parse_bracket_exp): Use && instead of &; either is correct and
both are equally fast nowadays but && triggers a warning in some
Gawk compiles.
* lib/dfa.h (_GL_ATTRIBUTE_MALLOC, _GL_ATTRIBUTE_DEALLOC)
(_GL_ATTRIBUTE_DEALLOC_FREE)
(_GL_ATTRIBUTE_RETURNS_NONNULL) [!_GL_ATTRIBUTE_MALLOC]:
Remove, as Gawk’s custom.h can define them.
* lib/localeinfo.c: Go back to using <verify.h> and ‘verify’
instead of using static_assert which Gawk can’t easily use because
it does not use Gnulib’s assert-h module.
* lib/localeinfo.h: Do not include <limits.h>, avoding some
namespace pollution.
(struct localeinfo): Use (unsigned char) -1 instead of UCHAR_MAX
to avoid the need to include <limits.h>.
* modules/dfa (Depends-on): Remove wchar-h.
2026-04-24 17:29:50 -07:00
Paul Eggert
b6d5b2f729 uchar-h: <string.h> etc. namespace cleanup
This is only a partial cleanup; to be cleaner we’d need to
move declarations of Gnulib extensions like c32isalpha
into a separate .h file.  However, if no Gnulib modules that
extend <uchar.h> are used, Gnulib <uchar.h> is now pretty clean on
recent GNUish platforms.
* lib/uchar.in.h: On GNUish platforms, include <stdint.h>,
<wchar.h>, <wctype.h> only if needed.  Do not include <string.h>,
as we never need it directly: even if we use <string.h>’s memset
via mbszero, <wchar.h> should include <string.h> if needed, as
<wchar.h> defines mbszero.  Move a static_assert from here to tests,
as the static_assert uses a symbol that is no longer guaranteed
to be visible.
* modules/uchar-h (Depends-on): Do not depend on assert-h.
* tests/test-uchar-h.c: Move a static_assert here from lib/uchar.in.h,
and include <wchar.h> so that wchar_t is guaranteed to be visible.
2026-04-24 16:11:27 -07:00
Paul Eggert
cfe5d0405f 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.
2026-04-24 14:14:51 -07:00
Bruno Haible
9b9fada8f1 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.
2026-04-24 15:58:31 +02:00
Bruno Haible
6f68489dda 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.
2026-04-24 15:58:30 +02:00
Paul Eggert
5926e89900 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.
2026-04-23 13:00:31 -07:00
Karl Berry
37abddd3db autoupdate 2026-04-20 07:27:13 -07:00
Karl Berry
8a4f822596 autoupdate 2026-04-20 07:22:45 -07:00
Jim Meyering
15211966de 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.
2026-04-19 19:36:03 -07:00
Paul Eggert
fb7312fa8d regex tests: pacify -Wshadow
* tests/test-regex.c (main):
Rename a local to avoid shadowing confusion.
2026-04-19 11:22:52 -07:00
Paul Eggert
f5351961e1 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.
2026-04-19 11:12:50 -07:00
Jim Meyering
76eb993a7b 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
2026-04-19 09:54:22 -07:00
Bruno Haible
1a8421ada2 regex tests: Add a test case that triggers an assertion failure.
* tests/test-regex.c (main): Add a test case related to back references.
2026-04-19 15:18:55 +02:00
Collin Funk
d8d9e3289f 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.
2026-04-18 19:48:16 -07:00
Paul Eggert
d8e2a2e266 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.
2026-04-17 09:14:49 -07:00
Collin Funk
b6e096af38 regex: Silence -Wzero-as-null-pointer-constant warning.
* lib/regexec.c (merge_state_with_log): Check the pointer against NULL.
2026-04-16 21:50:27 -07:00
Bruno Haible
acff3d2250 byteswap: Fix compilation on Solaris OpenIndiana (regr. 2026-03-20).
* lib/byteswap.in.h: Include <stdint.h>.
* modules/byteswap (Depends-on): Add stdint-h.
2026-04-16 18:49:36 +02:00
Bruno Haible
0d791d4881 sigdelay: Don't use out-of-range signal numbers.
* lib/sigdelay.c (states): Change number of elements to NSIG.
2026-04-16 14:15:52 +02:00
Bruno Haible
9bb54c2fe5 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.
2026-04-16 14:14:38 +02:00
Bruno Haible
2b070755bc sigprocmask: Fix sigismember function.
* lib/sigprocmask.c (sigismember): If the signal argument is invalid,
return -1 instead of 0.
2026-04-16 13:03:39 +02:00
Bruno Haible
a297266a67 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.
2026-04-16 00:29:42 +02:00
Paul Eggert
9ab4bbed73 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.
2026-04-15 14:47:55 -07:00
Paul Eggert
f5ee21eacc 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.
2026-04-15 14:45:53 -07:00
Bruno Haible
001a315786 sigdelay: Add tests.
* tests/test-sigdelay1.c: New file, based on
tests/test-pthread_sigmask1.c.
* tests/test-sigdelay2.c: New file, based on
tests/test-pthread_sigmask2.c.
* modules/sigdelay-tests: New file.
2026-04-15 13:46:08 +02:00
Bruno Haible
006d544083 sigdelay: New module.
* lib/sigdelay.h: New file.
* lib/sigdelay.c: New file.
* modules/sigdelay: New file.
2026-04-15 13:45:52 +02:00
Bruno Haible
2448235dbf 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.
2026-04-15 13:45:44 +02:00
Bruno Haible
3daeaa60a1 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.
2026-04-15 13:45:35 +02:00
Bruno Haible
1943cae989 sigprocmask: On mingw, avoid dependency on libwinpthread.
* lib/sigprocmask.c: Include windows-tls.h, windows-once.h.
(thread_local): Remove macro.
(struct per_thread): New type.
(tls_key): New variable.
(keys_init): New function.
(keys_init_once): New variable.
(get_per_thread): New function.
(per_thread_singleton): New variable.
(blocked_set, pending_array): Remove variables.
(sigpending, override_handler, pthread_sigmask, _gl_raise_SIGPIPE):
Invoke get_per_thread, to access blocked_set or pending_array.
* modules/sigprocmask (Depends-on): Add windows-once, windows-tls.
2026-04-14 21:56:00 +02:00
Bruno Haible
e304c84784 sigaction: Fix test failure on native Windows.
* lib/sigaction.c (sigaction): Hide the sigaction_handler from the
caller.
2026-04-14 20:38:58 +02:00
Paul Eggert
acbecf6ea2 error_h: fix icx version in commentary 2026-04-13 19:19:09 -07:00
Bruno Haible
e1532bc0fe 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.
2026-04-13 23:44:57 +02:00
Paul Eggert
67f60dc421 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.
2026-04-13 14:02:16 -07:00
Paul Eggert
8b62743170 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
2026-04-13 13:27:29 -07:00