On 2025-09-05 02:34, Bruno Haible wrote:
While it is an interesting experiment to use __has_include instead of
AC_CHECK_HEADERS, it has two drawbacks:
   - It does not work with all C compilers, in particular
     AIX xlc, Sun C, TinyC.

Yes, and I figured it was OK here to fall back on ASCII in these old environments.

   - It does not guard against header files with syntax errors.

Ouch, I didn't know Haiku was that flawed. Thanks for the fix. I saw two tiny possibilities for simplification (one that had already been there) and installed the attached.
From f92122f98a81ad4b47055d6acf7db33dc44b5e25 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Fri, 5 Sep 2025 08:28:56 -0700
Subject: [PATCH] propername-lite: simplify USE_MBRTOC32 away

* lib/propername-lite.c (USE_MBRTOC32): Remove.
Replace its use with HAVE_UCHAR_H.
---
 ChangeLog             | 6 ++++++
 lib/propername-lite.c | 5 ++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ad35468023..0837b6c821 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2025-09-05  Paul Eggert  <[email protected]>
+
+	propername-lite: simplify USE_MBRTOC32 away
+	* lib/propername-lite.c (USE_MBRTOC32): Remove.
+	Replace its use with HAVE_UCHAR_H.
+
 2025-09-05  Bruno Haible  <[email protected]>
 
 	propername-lite: Fix compilation error on Haiku r1/beta4 (regr. today).
diff --git a/lib/propername-lite.c b/lib/propername-lite.c
index 4bcb860303..d465548238 100644
--- a/lib/propername-lite.c
+++ b/lib/propername-lite.c
@@ -29,7 +29,6 @@
 # ifdef __GLIBC__
 #  undef mbrtoc32
 # endif
-# define USE_MBRTOC32
 #endif
 
 /* Return the localization of the name spelled NAME_ASCII in ASCII,
@@ -42,9 +41,9 @@ proper_name_lite (char const *name_ascii, _GL_UNUSED char const *name_utf8)
   if (translation != name_ascii)
     return translation;
 
-#ifdef USE_MBRTOC32
+#if HAVE_UCHAR_H
   /* If DF BF decodes to 07FF, assume it is UTF-8.  */
-  static char const utf07FF[2] = { 0xDF, 0xBF };
+  static char const utf07FF[] = { 0xDF, 0xBF };
   char32_t w;
   mbstate_t mbstate = {0,};
   if (mbrtoc32 (&w, utf07FF, 2, &mbstate) == 2 && w == 0x07FF)
-- 
2.48.1

Reply via email to