These two patches remove dead code from lib/localename-unsafe.c:
  - Solaris 12 was cancelled in 2017.
  - On Solaris, the Autoconf macros no longer define HAVE_NAMELESS_LOCALES
    since 2018-10-23.


2025-02-21  Bruno Haible  <br...@clisp.org>

        localename-unsafe: Remove dead code.
        * lib/localename-unsafe.c (gl_locale_name_thread_unsafe): On Solaris,
        assume HAVE_NAMELESS_LOCALES is undefined.

2025-02-21  Bruno Haible  <br...@clisp.org>

        localename-unsafe: Remove support for nonexistent Solaris 12.
        * m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): Remove test for
        getlocalename_l.
        * lib/localename-unsafe.c: Ignore HAVE_GETLOCALENAME_L.

>From 329877ac214ca86f7adb6a59f4301fcc33dd8da8 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 21 Feb 2025 08:37:10 +0100
Subject: [PATCH 1/2] localename-unsafe: Remove support for nonexistent Solaris
 12.

* m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): Remove test for
getlocalename_l.
* lib/localename-unsafe.c: Ignore HAVE_GETLOCALENAME_L.
---
 ChangeLog                |  7 +++++++
 lib/localename-unsafe.c  | 10 ++--------
 m4/intl-thread-locale.m4 | 11 +----------
 3 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4b8faaeb18..609d352b51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-02-21  Bruno Haible  <br...@clisp.org>
+
+	localename-unsafe: Remove support for nonexistent Solaris 12.
+	* m4/intl-thread-locale.m4 (gt_INTL_THREAD_LOCALE_NAME): Remove test for
+	getlocalename_l.
+	* lib/localename-unsafe.c: Ignore HAVE_GETLOCALENAME_L.
+
 2025-02-21  Bruno Haible  <br...@clisp.org>
 
 	setlocale: Relicense under LGPLv2+.
diff --git a/lib/localename-unsafe.c b/lib/localename-unsafe.c
index ebdf2e9491..97d5f9af92 100644
--- a/lib/localename-unsafe.c
+++ b/lib/localename-unsafe.c
@@ -46,10 +46,7 @@
 #  include <langinfo.h>
 # endif
 # if defined __sun
-#  if HAVE_GETLOCALENAME_L
-/* Solaris >= 12.  */
-extern char * getlocalename_l(int, locale_t);
-#  elif HAVE_SOLARIS114_LOCALES
+#  if HAVE_SOLARIS114_LOCALES
 #   include <sys/localedef.h>
 #  endif
 # endif
@@ -3080,10 +3077,7 @@ gl_locale_name_thread_unsafe (int category, _GL_UNUSED const char *categoryname)
           }
         return querylocale (mask, thread_locale);
 # elif defined __sun
-#  if HAVE_GETLOCALENAME_L
-        /* Solaris >= 12.  */
-        return getlocalename_l (category, thread_locale);
-#  elif HAVE_SOLARIS114_LOCALES
+#  if HAVE_SOLARIS114_LOCALES
         /* Solaris >= 11.4.  */
         void *lcp = (*thread_locale)->core.data->lcp;
         if (lcp != NULL)
diff --git a/m4/intl-thread-locale.m4 b/m4/intl-thread-locale.m4
index 9cdbff2c20..aff83a7ad6 100644
--- a/m4/intl-thread-locale.m4
+++ b/m4/intl-thread-locale.m4
@@ -1,5 +1,5 @@
 # intl-thread-locale.m4
-# serial 12
+# serial 13
 dnl Copyright (C) 2015-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -118,15 +118,6 @@ AC_DEFUN([gt_INTL_THREAD_LOCALE_NAME]
       [Define if the locale_t type is as on Solaris 11.4.])
   fi
 
-  dnl Solaris 12 will maybe provide getlocalename_l.  If it does, it will
-  dnl improve the implementation of gl_locale_name_thread(), by removing
-  dnl the use of undocumented structures.
-  case "$gt_cv_func_uselocale_works" in
-    *yes)
-      AC_CHECK_FUNCS([getlocalename_l])
-      ;;
-  esac
-
   dnl This code is for platforms where the locale_t type does not provide access
   dnl to the name of each locale category.  This code has the drawback that it
   dnl requires the gnulib overrides of 'newlocale', 'duplocale', 'freelocale',
-- 
2.43.0

>From e019edd02000346225b276bd799defb983e36ce7 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Fri, 21 Feb 2025 08:37:16 +0100
Subject: [PATCH 2/2] localename-unsafe: Remove dead code.

* lib/localename-unsafe.c (gl_locale_name_thread_unsafe): On Solaris,
assume HAVE_NAMELESS_LOCALES is undefined.
---
 ChangeLog               | 6 ++++++
 lib/localename-unsafe.c | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 609d352b51..54005a5b39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-02-21  Bruno Haible  <br...@clisp.org>
+
+	localename-unsafe: Remove dead code.
+	* lib/localename-unsafe.c (gl_locale_name_thread_unsafe): On Solaris,
+	assume HAVE_NAMELESS_LOCALES is undefined.
+
 2025-02-21  Bruno Haible  <br...@clisp.org>
 
 	localename-unsafe: Remove support for nonexistent Solaris 12.
diff --git a/lib/localename-unsafe.c b/lib/localename-unsafe.c
index 97d5f9af92..5b34aaf906 100644
--- a/lib/localename-unsafe.c
+++ b/lib/localename-unsafe.c
@@ -3093,8 +3093,6 @@ gl_locale_name_thread_unsafe (int category, _GL_UNUSED const char *categoryname)
             default: /* We shouldn't get here.  */
               return "";
             }
-#  elif HAVE_NAMELESS_LOCALES
-        return get_locale_t_name (category, thread_locale);
 #  else
         /* Solaris 11 OpenIndiana.
            For the internal structure of locale objects, see
-- 
2.43.0

Reply via email to