With the last two patches, nstrftime no longer does any locking while retrieving a locale name. But the locking code is still present, as part of module dependencies.
These two patches fix that: The module dependencies are restructured so that nstrftime no longer indirectly depends on the 'lock' module (and still passes its test suite on Solaris and NetBSD, of course). 2024-02-15 Bruno Haible <br...@clisp.org> nstrftime: Optimize module dependencies. * modules/nstrftime (Depends-on): Remove localename-unsafe. Add localename-unsafe-limited. 2024-02-15 Bruno Haible <br...@clisp.org> localename-unsafe-limited: New module. * m4/localename.m4 (gl_LOCALENAME_UNSAFE_LIMITED): New macro. * modules/localename-unsafe-limited: New file. * modules/localename-unsafe (Depends-on): Add localename-unsafe-limited. (Makefile.am): Compile localename-unsafe.c only if the module localename-unsafe-limited does not already do it.
>From b17d8b199128f3872773d5ceb6a12897723c1dfa Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Thu, 15 Feb 2024 20:47:28 +0100 Subject: [PATCH 1/2] localename-unsafe-limited: New module. * m4/localename.m4 (gl_LOCALENAME_UNSAFE_LIMITED): New macro. * modules/localename-unsafe-limited: New file. * modules/localename-unsafe (Depends-on): Add localename-unsafe-limited. (Makefile.am): Compile localename-unsafe.c only if the module localename-unsafe-limited does not already do it. --- ChangeLog | 9 +++++++ m4/localename.m4 | 8 ++++++- modules/localename-unsafe | 6 ++++- modules/localename-unsafe-limited | 39 +++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 modules/localename-unsafe-limited diff --git a/ChangeLog b/ChangeLog index 68a0050a68..0550e82a04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-02-15 Bruno Haible <br...@clisp.org> + + localename-unsafe-limited: New module. + * m4/localename.m4 (gl_LOCALENAME_UNSAFE_LIMITED): New macro. + * modules/localename-unsafe-limited: New file. + * modules/localename-unsafe (Depends-on): Add localename-unsafe-limited. + (Makefile.am): Compile localename-unsafe.c only if the module + localename-unsafe-limited does not already do it. + 2024-02-15 Bruno Haible <br...@clisp.org> nstrftime, fprintftime: Optimize. diff --git a/m4/localename.m4 b/m4/localename.m4 index 189aee6346..d91fd5deb4 100644 --- a/m4/localename.m4 +++ b/m4/localename.m4 @@ -1,4 +1,4 @@ -# localename.m4 serial 11 +# localename.m4 serial 12 dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -53,3 +53,9 @@ AC_DEFUN([gl_LOCALENAME_UNSAFE] REPLACE_FREELOCALE=1 fi ]) + +AC_DEFUN([gl_LOCALENAME_UNSAFE_LIMITED], +[ + AC_REQUIRE([gt_LC_MESSAGES]) + AC_REQUIRE([gt_INTL_THREAD_LOCALE_NAME]) +]) diff --git a/modules/localename-unsafe b/modules/localename-unsafe index 4b8ad0279b..3bcdbcad7b 100644 --- a/modules/localename-unsafe +++ b/modules/localename-unsafe @@ -15,6 +15,7 @@ m4/lcmessage.m4 m4/musl.m4 Depends-on: +localename-unsafe-limited extensions stdbool locale @@ -33,7 +34,10 @@ gl_LOCALE_MODULE_INDICATOR([localename-unsafe]) gl_MUSL_LIBC Makefile.am: -lib_SOURCES += localename-unsafe.c localename-table.c +if !GL_COND_OBJ_LOCALENAME_UNSAFE_LIMITED +lib_SOURCES += localename-unsafe.c +endif +lib_SOURCES += localename-table.c Include: "localename.h" diff --git a/modules/localename-unsafe-limited b/modules/localename-unsafe-limited new file mode 100644 index 0000000000..b9f845bfbd --- /dev/null +++ b/modules/localename-unsafe-limited @@ -0,0 +1,39 @@ +Description: +Return current locale's name, according to glibc naming conventions, +in thread-local (unsafe) storage. +Only works on a limited set of platforms: on NetBSD and Solaris. + +Files: +lib/localename.h +lib/localename-unsafe.c +m4/localename.m4 +m4/intl-thread-locale.m4 +m4/lcmessage.m4 + +Depends-on: +extensions +locale +setlocale-null-unlocked + +configure.ac: +gl_LOCALENAME_UNSAFE_LIMITED +AC_REQUIRE([AC_CANONICAL_HOST]) +gl_CONDITIONAL([GL_COND_OBJ_LOCALENAME_UNSAFE_LIMITED], + [case "$host_os" in netbsd* | solaris*) true;; *) false;; esac]) + +Makefile.am: +if GL_COND_OBJ_LOCALENAME_UNSAFE_LIMITED +lib_SOURCES += localename-unsafe.c +endif + +Include: +"localename.h" + +Link: +$(LIBTHREAD) + +License: +LGPLv2+ + +Maintainer: +all -- 2.34.1
>From d5191e456737661d4a0df5287f6c2064ab74dbbe Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Thu, 15 Feb 2024 20:48:59 +0100 Subject: [PATCH 2/2] nstrftime: Optimize module dependencies. * modules/nstrftime (Depends-on): Remove localename-unsafe. Add localename-unsafe-limited. --- ChangeLog | 6 ++++++ modules/nstrftime | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0550e82a04..6a990dd0e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-02-15 Bruno Haible <br...@clisp.org> + + nstrftime: Optimize module dependencies. + * modules/nstrftime (Depends-on): Remove localename-unsafe. Add + localename-unsafe-limited. + 2024-02-15 Bruno Haible <br...@clisp.org> localename-unsafe-limited: New module. diff --git a/modules/nstrftime b/modules/nstrftime index c5ab2710c0..69b9d84605 100644 --- a/modules/nstrftime +++ b/modules/nstrftime @@ -15,7 +15,7 @@ errno extensions intprops libc-config -localename-unsafe +localename-unsafe-limited stdbool stdckdint time_rz -- 2.34.1