With the strenghened tests, the iswdigit, iswxdigit tests fail.
Using an English Unicode locale instead of a French Unicode locale in the
configure tests catches these bugs, activates the Gnulib replacements, and
this works arounds the bugs.


2024-08-31  Bruno Haible  <br...@clisp.org>

        iswxdigit: Work around OpenBSD, Android, Haiku bug.
        * m4/iswxdigit.m4 (gl_FUNC_ISWXDIGIT): Require gt_LOCALE_EN_UTF8 instead
        of gt_LOCALE_FR_UTF8. Use LOCALE_EN_UTF8 instead of LOCALE_FR_UTF8.
        Update cross-compilation guess.
        * modules/iswxdigit (Files): Add m4/locale-en.m4. Remove 
m4/locale-fr.m4.
        * doc/posix-functions/iswxdigit.texi: Update list of platforms.

2024-08-31  Bruno Haible  <br...@clisp.org>

        iswdigit: Work around OpenBSD, Android, Haiku bug.
        * m4/iswdigit.m4 (gl_FUNC_ISWDIGIT): Require gt_LOCALE_EN_UTF8 instead
        of gt_LOCALE_FR_UTF8. Use LOCALE_EN_UTF8 instead of LOCALE_FR_UTF8.
        Update cross-compilation guess.
        * modules/iswdigit (Files): Add m4/locale-en.m4.
        * doc/posix-functions/iswdigit.texi: Update list of platforms.

>From 602a6728736b731f8333db99f8b223d145afcef3 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 1 Sep 2024 00:11:12 +0200
Subject: [PATCH 1/4] iswdigit: Work around OpenBSD, Android, Haiku bug.

* m4/iswdigit.m4 (gl_FUNC_ISWDIGIT): Require gt_LOCALE_EN_UTF8 instead
of gt_LOCALE_FR_UTF8. Use LOCALE_EN_UTF8 instead of LOCALE_FR_UTF8.
Update cross-compilation guess.
* modules/iswdigit (Files): Add m4/locale-en.m4.
* doc/posix-functions/iswdigit.texi: Update list of platforms.
---
 ChangeLog                         |  9 +++++++++
 doc/posix-functions/iswdigit.texi |  2 +-
 m4/iswdigit.m4                    | 18 +++++++++---------
 modules/iswdigit                  |  1 +
 4 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5cd4d0671e..b3922f2262 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-08-31  Bruno Haible  <br...@clisp.org>
+
+	iswdigit: Work around OpenBSD, Android, Haiku bug.
+	* m4/iswdigit.m4 (gl_FUNC_ISWDIGIT): Require gt_LOCALE_EN_UTF8 instead
+	of gt_LOCALE_FR_UTF8. Use LOCALE_EN_UTF8 instead of LOCALE_FR_UTF8.
+	Update cross-compilation guess.
+	* modules/iswdigit (Files): Add m4/locale-en.m4.
+	* doc/posix-functions/iswdigit.texi: Update list of platforms.
+
 2024-08-31  Bruno Haible  <br...@clisp.org>
 
 	tests: Strengthen LC_CTYPE tests on OpenBSD, Android, Haiku.
diff --git a/doc/posix-functions/iswdigit.texi b/doc/posix-functions/iswdigit.texi
index 6945fc2d32..474a7f46c9 100644
--- a/doc/posix-functions/iswdigit.texi
+++ b/doc/posix-functions/iswdigit.texi
@@ -17,7 +17,7 @@
 macOS 10.8.
 @item
 This function is not ISO C 99 compliant on some platforms:
-FreeBSD 14.0, NetBSD 10.0, Solaris 11.4, mingw, MSVC 14.
+FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, mingw, MSVC 14, Haiku, Android.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/m4/iswdigit.m4 b/m4/iswdigit.m4
index 999acd2891..4c71007a63 100644
--- a/m4/iswdigit.m4
+++ b/m4/iswdigit.m4
@@ -1,5 +1,5 @@
 # iswdigit.m4
-# serial 7
+# serial 8
 dnl Copyright (C) 2020-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,
@@ -11,7 +11,7 @@ AC_DEFUN([gl_FUNC_ISWDIGIT]
   AC_REQUIRE([gl_WCTYPE_H])
   AC_REQUIRE([gt_LOCALE_FR])
   AC_REQUIRE([gt_LOCALE_JA])
-  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([gt_LOCALE_EN_UTF8])
   AC_REQUIRE([gt_LOCALE_ZH_CN])
   AC_REQUIRE([AC_CANONICAL_HOST])
 
@@ -26,14 +26,14 @@ AC_DEFUN([gl_FUNC_ISWDIGIT]
        dnl is present.
 changequote(,)dnl
        case "$host_os" in
-         # Guess no on FreeBSD, NetBSD, Solaris, native Windows.
-         freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*)
+         # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android.
+         freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*)
            gl_cv_func_iswdigit_works="guessing no" ;;
          # Guess yes otherwise.
          *) gl_cv_func_iswdigit_works="guessing yes" ;;
        esac
 changequote([,])dnl
-       if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then
+       if test $LOCALE_FR != none || test $LOCALE_JA != none || test $LOCALE_EN_UTF8 != none || test $LOCALE_ZH_CN != none; then
          AC_RUN_IFELSE(
            [AC_LANG_SOURCE([[
 #include <locale.h>
@@ -83,15 +83,15 @@ AC_DEFUN([gl_FUNC_ISWDIGIT]
       if (!(is == 0))
         result |= 2;
     }
-  if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
-      && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+  if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
     {
-      /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14.  */
+      /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android.  */
       /* U+0663 ARABIC-INDIC DIGIT THREE */
       is = for_character ("\331\243", 2);
       if (!(is == 0))
         result |= 4;
-      /* This fails on FreeBSD 13.0, NetBSD 10.0, MSVC 14.  */
+      /* This fails on FreeBSD 13.0, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android.  */
       /* U+FF11 FULLWIDTH DIGIT ONE */
       is = for_character ("\357\274\221", 3);
       if (!(is == 0))
diff --git a/modules/iswdigit b/modules/iswdigit
index afa30b8de5..1a0091a01c 100644
--- a/modules/iswdigit
+++ b/modules/iswdigit
@@ -4,6 +4,7 @@ iswdigit() function: test wide character for being a digit.
 Files:
 lib/iswdigit.c
 m4/iswdigit.m4
+m4/locale-en.m4
 m4/locale-fr.m4
 m4/locale-ja.m4
 m4/locale-zh.m4
-- 
2.34.1

>From cc08d989adc443a96e326d97302c9ca7b159e394 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 1 Sep 2024 00:12:54 +0200
Subject: [PATCH 2/4] iswxdigit: Work around OpenBSD, Android, Haiku bug.

* m4/iswxdigit.m4 (gl_FUNC_ISWXDIGIT): Require gt_LOCALE_EN_UTF8 instead
of gt_LOCALE_FR_UTF8. Use LOCALE_EN_UTF8 instead of LOCALE_FR_UTF8.
Update cross-compilation guess.
* modules/iswxdigit (Files): Add m4/locale-en.m4. Remove m4/locale-fr.m4.
* doc/posix-functions/iswxdigit.texi: Update list of platforms.
---
 ChangeLog                          |  9 +++++++++
 doc/posix-functions/iswxdigit.texi |  2 +-
 m4/iswxdigit.m4                    | 18 +++++++++---------
 modules/iswxdigit                  |  2 +-
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b3922f2262..f510a7f72e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-08-31  Bruno Haible  <br...@clisp.org>
+
+	iswxdigit: Work around OpenBSD, Android, Haiku bug.
+	* m4/iswxdigit.m4 (gl_FUNC_ISWXDIGIT): Require gt_LOCALE_EN_UTF8 instead
+	of gt_LOCALE_FR_UTF8. Use LOCALE_EN_UTF8 instead of LOCALE_FR_UTF8.
+	Update cross-compilation guess.
+	* modules/iswxdigit (Files): Add m4/locale-en.m4. Remove m4/locale-fr.m4.
+	* doc/posix-functions/iswxdigit.texi: Update list of platforms.
+
 2024-08-31  Bruno Haible  <br...@clisp.org>
 
 	iswdigit: Work around OpenBSD, Android, Haiku bug.
diff --git a/doc/posix-functions/iswxdigit.texi b/doc/posix-functions/iswxdigit.texi
index 145d76ad9c..6c4e388a0c 100644
--- a/doc/posix-functions/iswxdigit.texi
+++ b/doc/posix-functions/iswxdigit.texi
@@ -17,7 +17,7 @@
 macOS 10.8.
 @item
 This function is not ISO C 99 compliant on some platforms:
-FreeBSD 14.0, NetBSD 10.0, Solaris 11.4, MSVC 14.
+FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, MSVC 14, Haiku, Android.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/m4/iswxdigit.m4 b/m4/iswxdigit.m4
index 6085bf6b01..b5ca40e058 100644
--- a/m4/iswxdigit.m4
+++ b/m4/iswxdigit.m4
@@ -1,5 +1,5 @@
 # iswxdigit.m4
-# serial 7
+# serial 8
 dnl Copyright (C) 2020-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,
@@ -10,7 +10,7 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT]
   AC_REQUIRE([gl_WCTYPE_H_DEFAULTS])
   AC_REQUIRE([gl_WCTYPE_H])
   AC_REQUIRE([gt_LOCALE_JA])
-  AC_REQUIRE([gt_LOCALE_FR_UTF8])
+  AC_REQUIRE([gt_LOCALE_EN_UTF8])
   AC_REQUIRE([gt_LOCALE_ZH_CN])
   AC_REQUIRE([AC_CANONICAL_HOST])
 
@@ -25,14 +25,14 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT]
        dnl is present.
 changequote(,)dnl
        case "$host_os" in
-         # Guess no on FreeBSD, NetBSD, Solaris, native Windows.
-         freebsd* | dragonfly* | netbsd* | solaris* | mingw* | windows*)
+         # Guess no on FreeBSD, NetBSD, OpenBSD, Solaris, native Windows, Haiku, Android.
+         freebsd* | dragonfly* | netbsd* | openbsd* | solaris* | mingw* | windows* | haiku* | *-android*)
            gl_cv_func_iswxdigit_works="guessing no" ;;
          # Guess yes otherwise.
          *) gl_cv_func_iswxdigit_works="guessing yes" ;;
        esac
 changequote([,])dnl
-       if test $LOCALE_JA != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_ZH_CN != none; then
+       if test $LOCALE_JA != none || test $LOCALE_EN_UTF8 != none || test $LOCALE_ZH_CN != none; then
          AC_RUN_IFELSE(
            [AC_LANG_SOURCE([[
 #include <locale.h>
@@ -73,15 +73,15 @@ AC_DEFUN([gl_FUNC_ISWXDIGIT]
       if (!(is == 0))
         result |= 1;
     }
-  if (strcmp ("$LOCALE_FR_UTF8", "none") != 0
-      && setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL)
+  if (strcmp ("$LOCALE_EN_UTF8", "none") != 0
+      && setlocale (LC_ALL, "$LOCALE_EN_UTF8") != NULL)
     {
-      /* This fails on FreeBSD 13.0.  */
+      /* This fails on FreeBSD 13.0, Haiku, Android.  */
       /* U+0663 ARABIC-INDIC DIGIT THREE */
       is = for_character ("\331\243", 2);
       if (!(is == 0))
         result |= 2;
-      /* This fails on NetBSD 10.0, MSVC 14.  */
+      /* This fails on NetBSD 10.0, OpenBSD 7.5, MSVC 14, Haiku, Android.  */
       /* U+FF21 FULLWIDTH LATIN CAPITAL LETTER A */
       is = for_character ("\357\274\241", 3);
       if (!(is == 0))
diff --git a/modules/iswxdigit b/modules/iswxdigit
index 9261524c6e..a0cb6c5945 100644
--- a/modules/iswxdigit
+++ b/modules/iswxdigit
@@ -4,7 +4,7 @@ iswxdigit() function: test wide character for being a hexadecimal digit.
 Files:
 lib/iswxdigit.c
 m4/iswxdigit.m4
-m4/locale-fr.m4
+m4/locale-en.m4
 m4/locale-ja.m4
 m4/locale-zh.m4
 m4/codeset.m4
-- 
2.34.1

Reply via email to