* nstrftime: omit locking code from module dependencies
@ 2024-02-15 21:44 Bruno Haible
0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2024-02-15 21:44 UTC (permalink / raw)
To: bug-gnulib
[-- Attachment #1: Type: text/plain, Size: 941 bytes --]
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 <bruno@clisp.org>
nstrftime: Optimize module dependencies.
* modules/nstrftime (Depends-on): Remove localename-unsafe. Add
localename-unsafe-limited.
2024-02-15 Bruno Haible <bruno@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.
[-- Attachment #2: 0001-localename-unsafe-limited-New-module.patch --]
[-- Type: text/x-patch, Size: 3597 bytes --]
From b17d8b199128f3872773d5ceb6a12897723c1dfa Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@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 <bruno@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 <bruno@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
[-- Attachment #3: 0002-nstrftime-Optimize-module-dependencies.patch --]
[-- Type: text/x-patch, Size: 1085 bytes --]
From d5191e456737661d4a0df5287f6c2064ab74dbbe Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@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 <bruno@clisp.org>
+
+ nstrftime: Optimize module dependencies.
+ * modules/nstrftime (Depends-on): Remove localename-unsafe. Add
+ localename-unsafe-limited.
+
2024-02-15 Bruno Haible <bruno@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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-15 21:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-15 21:44 nstrftime: omit locking code from module dependencies Bruno Haible
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).