Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Use Solaris iconv
@ 2026-08-19 12:23 Rainer Orth
  2026-08-20 16:33 ` Tom Tromey
  0 siblings, 1 reply; 6+ messages in thread
From: Rainer Orth @ 2026-08-19 12:23 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 904 bytes --]

Currently hundreds of tests FAIL on Solaris with

warning: could not convert '...' from the host encoding (ISO-8859-1) to UTF-32.
This normally should not happen, please file a bug report.

This happens because the system headers don't define __STDC_ISO_10646__
which was only introduced in C17.  However, Solaris libc only conforms
to C11.  Consequently PHONY_ICONV is defined, leading to those failures.

However, Solaris 11.4 iconv is good enough to use: enabling its use
fixes 300+ failures.

The results are on par with those using GNU libiconv 1.17, while
forcibly disabling HAVE_ICONV on Linux/x86_64 adds causes the same
amount of failures.

Tested on sparcv9-sun-solaris2.11, x86_64-pc-solaris2.11, and
x86_64-pc-solaris2.11.

Ok for trunk?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol2-iconv.patch --]
[-- Type: text/x-patch, Size: 1949 bytes --]

# HG changeset patch
# Parent  97bd89d84470fc76016c1f0a387cad83b62d0c7a
Use Solaris iconv

diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
--- a/gdb/gdb_wchar.h
+++ b/gdb/gdb_wchar.h
@@ -34,10 +34,12 @@
    functionality is available to the user, but many characters (those
    outside the narrow range) will be displayed as escapes.
 
-   Finally, some systems do not have iconv, or are really broken
-   (e.g., Solaris, which almost has all of this working, but where
-   just enough is broken to make it too hard to use).  Here we provide
-   a phony iconv which only handles a single character set, and we
+   While the Solaris 11.4 system headers don't define __STDC_ISO_10646__
+   (it's a C17 addition while Solaris libc only conforms to C11), the
+   system iconv works well enough.
+
+   Finally, some systems do not have iconv, or are really broken.  Here we
+   provide a phony iconv which only handles a single character set, and we
    provide wrappers for the wchar_t functionality we use.  */
 
 
@@ -59,7 +61,8 @@
    iconvlist.  */
 #if defined (HAVE_ICONV) && defined (HAVE_BTOWC) \
   && (defined (__STDC_ISO_10646__) \
-      || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108))
+      || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108) \
+      || (defined (__sun__) && defined (__svr4__)))
 
 using gdb_wchar_t = wchar_t;
 using gdb_wint_t = wint_t;
@@ -88,7 +91,8 @@ using gdb_wint_t = wint_t;
    Sonoma specifically, but it is desirable for binaries built for
    older versions of macOS to still work on newer ones such as Sonoma,
    so there is no version check here for this workaround.  */
-#if defined (__STDC_ISO_10646__) || defined (__APPLE__)
+#if defined (__STDC_ISO_10646__) || defined (__APPLE__) \
+  || (defined (__sun__) && defined (__svr4__))
 #define USE_INTERMEDIATE_ENCODING_FUNCTION
 #define INTERMEDIATE_ENCODING intermediate_encoding ()
 const char *intermediate_encoding (void);

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-08-22 20:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-19 12:23 [PATCH] Use Solaris iconv Rainer Orth
2026-08-20 16:33 ` Tom Tromey
2026-08-20 18:00   ` Rainer Orth
2026-08-20 18:27     ` Simon Marchi
2026-08-21 15:08     ` Tom Tromey
2026-08-22 20:19       ` Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox