From 08529be2425599726e0f4e77a4e0c998c9706e6b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 15 Feb 2024 14:35:53 +0100 Subject: [PATCH] localename: Add more comments. * m4/intl-thread-locale.m4: Document expected configuration results. * doc/posix-functions/uselocale.texi: Update platforms list. * lib/localename.c: Likewise. --- ChangeLog | 7 +++++++ doc/posix-functions/uselocale.texi | 5 +++-- lib/localename.c | 6 ++++-- m4/intl-thread-locale.m4 | 13 ++++++++++++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 531d5ffa57..365a8d07e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-02-15 Bruno Haible + + localename: Add more comments. + * m4/intl-thread-locale.m4: Document expected configuration results. + * doc/posix-functions/uselocale.texi: Update platforms list. + * lib/localename.c: Likewise. + 2024-02-15 Bruno Haible localename: Add parameter validation. diff --git a/doc/posix-functions/uselocale.texi b/doc/posix-functions/uselocale.texi index e6ded0caf4..600d4c1e28 100644 --- a/doc/posix-functions/uselocale.texi +++ b/doc/posix-functions/uselocale.texi @@ -14,7 +14,8 @@ Portability problems not fixed by Gnulib: @itemize @item This function is missing on many platforms: -FreeBSD 9.0, NetBSD 9.0, OpenBSD 6.1, Minix 3.1.8, AIX 6.1, HP-UX 11, IRIX 6.5, Solaris 11.3, Cygwin 2.5.x, mingw, MSVC 14, Android 4.4. +@c For NetBSD, see https://mail-index.netbsd.org/tech-userlevel/2015/12/29/msg009556.html +FreeBSD 9.0, NetBSD 10.0, OpenBSD 6.1, Minix 3.1.8, AIX 6.1, HP-UX 11, IRIX 6.5, Solaris 11.3, Cygwin 2.5.x, mingw, MSVC 14, Android API level 20. @item This function is not documented and leads to crashes in subsequent @code{setlocale} invocations on some platforms: @@ -26,5 +27,5 @@ z/OS. @item This function is useless because the @code{locale_t} type contains basically no information on some platforms: -OpenBSD 6.3. +OpenBSD 7.4. @end itemize diff --git a/lib/localename.c b/lib/localename.c index 72f773bbed..1bdc73f1cb 100644 --- a/lib/localename.c +++ b/lib/localename.c @@ -2630,8 +2630,10 @@ get_lcid (const char *locale_name) #endif -#if HAVE_GOOD_USELOCALE /* glibc, Mac OS X, FreeBSD >= 9.1, Cygwin >= 2.6, - Solaris 11 OpenIndiana, or Solaris >= 11.4 */ +#if HAVE_GOOD_USELOCALE /* glibc, musl libc, macOS, FreeBSD >= 9.1, AIX 7.1, + AIX >= 7.3, Solaris >= 11.4, Solaris 11 OpenIndiana, + Solaris 11 OmniOS, Cygwin >= 2.6, + Android API level >= 21 */ /* Simple hash set of strings. We don't want to drag in lots of hash table code here. */ diff --git a/m4/intl-thread-locale.m4 b/m4/intl-thread-locale.m4 index 74a2654b65..9710cb6d84 100644 --- a/m4/intl-thread-locale.m4 +++ b/m4/intl-thread-locale.m4 @@ -1,4 +1,4 @@ -# intl-thread-locale.m4 serial 10 +# intl-thread-locale.m4 serial 11 dnl Copyright (C) 2015-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, @@ -38,6 +38,7 @@ AC_DEFUN([gt_INTL_THREAD_LOCALE_NAME], dnl they did not think about the programs. dnl In this situation, even the HAVE_NAMELESS_LOCALES support does not work. dnl So, define HAVE_FAKE_LOCALES and disable all locale_t support. + dnl Expected result: HAVE_FAKE_LOCALES is defined on OpenBSD ≥ 6.2. case "$gt_cv_func_uselocale_works" in *yes) AC_CHECK_HEADERS_ONCE([xlocale.h]) @@ -81,6 +82,7 @@ int main () ;; esac + dnl Expected result: HAVE_SOLARIS114_LOCALES is defined on Solaris ≥ 11.4. case "$gt_cv_func_uselocale_works" in *yes) AC_CACHE_CHECK([for Solaris 11.4 locale system], @@ -128,6 +130,7 @@ int main () dnl requires the gnulib overrides of 'newlocale', 'duplocale', 'freelocale', dnl which is a problem for GNU libunistring. Therefore try hard to avoid dnl enabling this code! + dnl Expected result: HAVE_NAMELESS_LOCALES is defined on AIX. gt_nameless_locales=no case "$host_os" in dnl It's needed on AIX 7.2. @@ -141,6 +144,9 @@ int main () dnl We cannot support uselocale() on platforms where the locale_t type is dnl fake. So, set dnl gt_good_uselocale = gt_working_uselocale && !gt_fake_locales. + dnl Expected result: HAVE_GOOD_USELOCALE is defined on all platforms except + dnl FreeBSD < 9.1, NetBSD, OpenBSD, Minix, AIX < 7, AIX 7.2, HP-UX, IRIX, + dnl Solaris < 11.4, Cygwin < 2.6, mingw, MSVC 14, Android API level < 21. if test $gt_working_uselocale = yes && test $gt_fake_locales = no; then gt_good_uselocale=yes AC_DEFINE([HAVE_GOOD_USELOCALE], [1], @@ -152,6 +158,8 @@ int main () dnl Set gt_localename_enhances_locale_funcs to indicate whether localename.c dnl overrides newlocale(), duplocale(), freelocale() to keep track of locale dnl names. + dnl Expected result: LOCALENAME_ENHANCE_LOCALE_FUNCS is defined on + dnl AIX 7.1, AIX ≥ 7.3. if test $gt_good_uselocale = yes && test $gt_nameless_locales = yes; then gt_localename_enhances_locale_funcs=yes LOCALENAME_ENHANCE_LOCALE_FUNCS=1 @@ -164,6 +172,9 @@ int main () dnl Tests whether uselocale() exists and is usable. dnl Sets gt_working_uselocale and defines HAVE_WORKING_USELOCALE. +dnl Expected result: HAVE_WORKING_USELOCALE is defined on all platforms except +dnl FreeBSD < 9.1, NetBSD, OpenBSD < 6.2, Minix, AIX < 7, AIX 7.2, HP-UX, IRIX, +dnl Solaris < 11.4, Cygwin < 2.6, mingw, MSVC 14, Android API level < 21. AC_DEFUN([gt_FUNC_USELOCALE], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles -- 2.39.5