Bruno Haible [Fri, 21 Feb 2025 10:38:35 +0000 (11:38 +0100)]
host-cpu-c-abi: Improve support for loongarch32.
Reported by <wuruilong@loongson.cn>
in <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1098478>
via Simon Josefsson.
* m4/host-cpu-c-abi.m4 (gl_HOST_CPU_C_ABI): Prepare template for
__loongarch32__ in config.h.
(gl_HOST_CPU_C_ABI_32BIT): Speed up the configure test on loongarch*.
Bruno Haible [Fri, 21 Feb 2025 10:25:51 +0000 (11:25 +0100)]
getlocalename_l-simple: New module.
* lib/locale.in.h (newlocale, duplocale, freelocale): Now enabled by
module 'getlocalename_l-simple'.
(getlocalename_l): New declaration.
* lib/getlocalename_l.c: New file, based on lib/localename-unsafe.c,
with modifications for glibc systems, NetBSD, OpenBSD, Android.
* lib/localename-table.h (LCMIN): New macro.
* lib/struniq.h: Update a comment.
* lib/localename-unsafe.c: Don't define the
LOCALENAME_ENHANCE_LOCALE_FUNCS overrides here. Moved to
lib/getlocalename_l.c.
(gl_locale_name_thread_unsafe): Invoke getlocalename_l. Previous code
moved to lib/getlocalename_l.c.
* m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): Improve support
for OpenBSD: Set gt_nameless_locales to yes and
gt_localename_enhances_locale_funcs to yes also when $gt_fake_locales is
yes.
* m4/getlocalename_l.m4: New file, based on m4/localename.m4.
* m4/localename.m4 (gl_LOCALENAME_UNSAFE, gl_LOCALENAME_UNSAFE_LIMITED):
Remove code that was moved to m4/getlocalename_l.m4.
* m4/locale_h.m4 (gl_LOCALE_H): Test whether getlocalename_l is
declared.
(gl_LOCALE_H_REQUIRE_DEFAULTS): Initialize GNULIB_GETLOCALENAME_L.
(gl_LOCALE_H_DEFAULTS): Initialize HAVE_GETLOCALENAME_L.
* modules/locale-h (Makefile.am): Substitute GNULIB_GETLOCALENAME_L,
HAVE_GETLOCALENAME_L.
* modules/getlocalename_l-simple: New file.
* modules/localename-unsafe (Files): Remove lib/localename-table.h,
lib/localename-table.c, lib/struniq.h.
(Depends-on): Add getlocalename_l-simple. Remove bool, flexmember,
free-posix, langinfo-h, thread-optim.
(Makefile.am): Don't compile localename-table.c.
* modules/localename-unsafe-limited (Depends-on): Add
getlocalename_l-simple.
* modules/newlocale (Link): New section.
* modules/duplocale (Link): Link with $(GETLOCALENAME_L_LIB).
* modules/freelocale (Link): New section.
* modules/newlocale-tests (Makefile.am): Link the test program with
$(GETLOCALENAME_L_LIB).
* modules/duplocale-tests (Makefile.am): Likewise.
* modules/freelocale-tests (Makefile.am): Likewise.
* modules/is*_l-tests (Makefile.am): Likewise.
* modules/tolower_l-tests (Makefile.am): Likewise.
* modules/toupper_l-tests (Makefile.am): Likewise.
* modules/strcasecmp_l-tests (Makefile.am): Likewise.
* modules/strncasecmp_l-tests (Makefile.am): Likewise.
* modules/strerror_l-tests (Makefile.am): Likewise.
* doc/posix-functions/getlocalename_l.texi: Mention the new module.
Bruno Haible [Fri, 21 Feb 2025 08:31:12 +0000 (09:31 +0100)]
setlocale-messages: New module.
* lib/setlocale-messages.h: New file.
* lib/setlocale-messages.c: New file, based on lib/setlocale.c.
* modules/setlocale-messages: New file.
* lib/setlocale.c: Include setlocale-messages.h.
(lc_messages_name): Remove variable.
(setlocale_single): Just invoke setlocale_messages.
* modules/setlocale (Depends-on): Add setlocale-messages.
Bruno Haible [Wed, 19 Feb 2025 22:46:37 +0000 (23:46 +0100)]
readutmp: Let callers distinguish LOGINs from USERs.
Reported by Paul Eggert in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-02/msg00123.html>.
* lib/readutmp.h (LOGIN_PROCESS, UT_TYPE_LOGIN_PROCESS): New macros.
* lib/readutmp.c (read_utmp_from_systemd): Possibly use LOGIN_PROCESS
instead of USER_PROCESS, depending on the session's class.
Bruno Haible [Tue, 18 Feb 2025 11:03:37 +0000 (12:03 +0100)]
at-init: Add tests.
* tests/test-at-init.sh: New file.
* tests/test-at-init.c: New file.
* tests/test-at-init-2.c: New file.
* tests/test-at-init-3.c: New file.
* modules/at-init-tests: New file.
Collin Funk [Sun, 16 Feb 2025 21:58:35 +0000 (13:58 -0800)]
doc: Adjust platforms that define O_CLOEXEC in unistd.h.
Suggested by Bruno Haible.
* posix-headers/unistd.texi: Mention that macOS 12 and AIX 7.3 do not
define O_CLOEXEC in this header. Remove redundant MSVC.
Bruno Haible [Sun, 16 Feb 2025 21:32:33 +0000 (22:32 +0100)]
strncasecmp_l: New module.
* lib/strings.in.h (strncasecmp_l): New declaration.
* lib/strncasecmp_l.c: New file, based on lib/strncasecmp.c.
* m4/strncasecmp_l.m4: New file.
* m4/strings_h.m4 (gl_STRINGS_H): Test for strncasecmp_l.
(gl_STRINGS_H_REQUIRE_DEFAULTS): Initialize GNULIB_STRNCASECMP_L.
(gl_STRINGS_H_DEFAULTS): Initialize HAVE_STRNCASECMP_L,
REPLACE_STRNCASECMP_L.
* modules/strings-h (Makefile.am): Substitute GNULIB_STRNCASECMP_L,
HAVE_STRNCASECMP_L, REPLACE_STRNCASECMP_L.
* modules/strncasecmp_l: New file.
* tests/test-strings-h-c++.cc: Check declaration of strncasecmp_l.
* doc/posix-functions/strncasecmp_l.texi: Mention the new module and the
macOS, Solaris, Cygwin bugs.
Bruno Haible [Sun, 16 Feb 2025 21:32:02 +0000 (22:32 +0100)]
strcasecmp_l: New module.
* lib/strings.in.h: Include <locale.h>.
(strcasecmp_l): New declaration.
* lib/strcasecmp_l.c: New file, based on lib/strcasecmp.c.
* m4/strcasecmp_l.m4: New file.
* m4/strings_h.m4 (gl_STRINGS_H): Test for strcasecmp_l.
(gl_STRINGS_H_REQUIRE_DEFAULTS): Initialize GNULIB_STRCASECMP_L.
(gl_STRINGS_H_DEFAULTS): Initialize HAVE_STRCASECMP_L,
REPLACE_STRCASECMP_L.
* modules/strings-h (Makefile.am): Substitute GNULIB_STRCASECMP_L,
HAVE_STRCASECMP_L, REPLACE_STRCASECMP_L.
* modules/strcasecmp_l: New file.
* tests/test-strings-h-c++.cc: Check declaration of strcasecmp_l.
* doc/posix-functions/strcasecmp_l.texi: Mention the new module and the
macOS, Solaris, Cygwin bugs.
Collin Funk [Sun, 16 Feb 2025 20:23:57 +0000 (12:23 -0800)]
unistd-h: Make sure O_CLOEXEC is defined.
* modules/unistd-h (Depends-on): Add fcntl-h.
* lib/unistd.in.h: Include fcntl.h if inclusion of unistd.h does not
define O_CLOEXEC.
* doc/posix-headers/unistd.texi: Document the platforms that do not
define O_CLOEXEC in unistd.h.
Bruno Haible [Sun, 16 Feb 2025 17:24:16 +0000 (18:24 +0100)]
strncasecmp: Add tests.
* tests/test-strncasecmp-1.sh: New file.
* tests/test-strncasecmp-2.sh: New file.
* tests/test-strncasecmp.c: New file.
* modules/strncasecmp-tests: New file.
Bruno Haible [Sun, 16 Feb 2025 17:02:00 +0000 (18:02 +0100)]
strcasecmp: Add tests.
* tests/test-strcasecmp-1.sh: New file.
* tests/test-strcasecmp-2.sh: New file.
* tests/test-strcasecmp.c: New file.
* modules/strcasecmp-tests: New file.
Bruno Haible [Sun, 16 Feb 2025 12:43:40 +0000 (13:43 +0100)]
bootstrap: Fix recognition of --depth option with recent git releases.
Reported by Benno Schulenberg <bensberg@telfort.nl> in
<https://lists.gnu.org/archive/html/bug-gnulib/2025-02/msg00106.html>.
* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): Assume that
'git clone' and 'git fetch' support the --depth option.
* build-aux/bootstrap: Regenerated.
Paul Eggert [Sat, 15 Feb 2025 02:04:54 +0000 (18:04 -0800)]
isascii: stop using it
* doc/pastposix-functions/isascii.texi: There is no isascii module.
* m4/mbswidth.m4 (gl_MBSWIDTH): Do not check for isascii,
as it no longer seems to be used here.
* tests/test-c-ctype.c (test_agree_with_C_locale):
Do not assume isascii exists, as POSIX no longer requires it.
Bruno Haible [Fri, 14 Feb 2025 05:17:24 +0000 (06:17 +0100)]
isalnum_l: New module.
* lib/ctype.in.h: Include <locale.h>.
(isalnum_l): New declaration.
* lib/isalnum_l.c: New file.
* lib/is_l-impl.h: New file.
* m4/isalnum_l.m4: New file.
* m4/ctype_h.m4 (gl_CTYPE_H): Test for isalnum_l.
(gl_CTYPE_H_REQUIRE_DEFAULTS): Initialize GNULIB_ISALNUM_L.
(gl_CTYPE_H_DEFAULTS): Initialize HAVE_ISALNUM_L.
* modules/ctype-h (Makefile.am): Substitute GNULIB_ISALNUM_L,
HAVE_ISALNUM_L.
* modules/isalnum_l: New file.
* tests/test-ctype-h-c++.cc: Check declaration of isalnum_l.
* doc/posix-functions/isalnum_l.texi: Mention the new module.
Bruno Haible [Fri, 14 Feb 2025 14:42:22 +0000 (15:42 +0100)]
newlocale: Work around NetBSD bug.
* lib/newlocale.c (newlocale) [NetBSD]: Test whether the locale name is
valid; fail with error ENOENT if not.
* doc/posix-functions/newlocale.texi: Mention the NetBSD bug.
Bruno Haible [Fri, 14 Feb 2025 14:24:54 +0000 (15:24 +0100)]
newlocale: Work around macOS, NetBSD, Solaris 11 OpenIndiana bug.
* m4/newlocale.m4 (gl_FUNC_NEWLOCALE): Test for the "null base" bug.
Set REPLACE_NEWLOCALE to 1 if it has the bug.
* lib/newlocale.c (newlocale): Add alternative implementation that uses
the system's newlocale().
* modules/newlocale (configure.ac): Consider REPLACE_NEWLOCALE.
* tests/test-newlocale.c: Include <langinfo.h>.
(main): Verify fix for the "null base" bug.
* modules/newlocale-tests (configure.ac): Test for nl_langinfo_l.
* doc/posix-functions/newlocale.texi: Mention the "null base" bug.
Bruno Haible [Fri, 14 Feb 2025 04:56:55 +0000 (05:56 +0100)]
duplocale: Support all platforms.
* lib/locale.in.h (duplocale): Declare also on platforms that don't
already have a duplocale function. Don't define HAVE_WORKING_DUPLOCALE.
* lib/duplocale.c: Include <stdlib.h>.
(duplocale): Renamed from rpl_duplocale. Add implementation for
platforms without native locale_t.
* modules/duplocale (Depends-on): Add newlocale, freelocale.
(configure.ac): Compile also on platforms without native locale_t.
* tests/test-duplocale.c: Ignore HAVE_WORKING_DUPLOCALE.
* tests/test-locale-h-c++.cc: Likewise.
* doc/posix-functions/duplocale.texi: Mention the change.
Bruno Haible [Thu, 13 Feb 2025 01:18:05 +0000 (02:18 +0100)]
setlocale: Update info about Galician and Tamil.
* lib/setlocale.c (locales_with_principal_territory): Galician is
mostly spoken in Spain, not Portugal. Tamil is mostly spoken in India,
not Sri Lanka.
Bruno Haible [Wed, 12 Feb 2025 19:03:29 +0000 (20:03 +0100)]
getaddrinfo: Support the AI_NUMERICHOST flag.
* lib/getaddrinfo.c (is_numeric_host): New function.
(getaddrinfo): Accept and implement the AI_NUMERICHOST flag.
* modules/getaddrinfo (Depends-on): Add inet_pton.
* tests/test-getaddrinfo.c: Include <ctype.h>.
(simple): In pass 3, pass the AI_NUMERICHOST flag.
(main): Add a pass 3.
Bruno Haible [Wed, 12 Feb 2025 17:43:59 +0000 (18:43 +0100)]
netdb-h: Ensure AI_NUMERICHOST and AI_NUMERICSERV are defined.
* lib/netdb.in.h (AI_NUMERICHOST): New macro.
* tests/test-netdb-h.c: Verify that AI_NUMERICHOST and AI_NUMERICSERV
are defined.
* doc/posix-headers/netdb.texi: Mention the platform support for
AI_NUMERICHOST and AI_NUMERICSERV.
Bruno Haible [Sun, 9 Feb 2025 21:02:27 +0000 (22:02 +0100)]
string-buffer, string-buffer-reversed: Allow for better static analysis.
* lib/string-buffer.h (sb_appendvf, sb_appendf, sb_xappendvf,
sb_xappendf): Don't declare if SB_NO_APPENDF is defined.
(sb_xdupfree_c): Declare a non-NULL return value if SB_NO_APPENDF is
defined.
* lib/string-buffer-reversed.h (sbr_prependvf, sbr_prependf,
sbr_xprependvf, sbr_xprependf): Don't declare if SBR_NO_PREPENDF is
defined.
(sbr_xdupfree_c): Declare a non-NULL return value if SBR_NO_PREPENDF is
defined.