On OmniOS a testdir of all modules fails to build like so: $ uname -a SunOS omnios 5.11 omnios-r151052-dbe4644ba92 i86pc i386 i86pc $ gcc --version gcc (OmniOS 151052/14.2.0-il-1) 14.2.0 $ ./configure $ make [...] gcc -std=gnu23 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC -DEXEEXT=\"\" -I. -I.. -DGNULIB_STRICT_CHECKING=1 -D_REENTRANT -fvisibility=hidden -g -O2 -MT lc-charset-unicode.o -MD -MP -MF $depbase.Tpo -c -o lc-charset-unicode.o lc-charset-unicode.c &&\ mv -f $depbase.Tpo $depbase.Po lc-charset-unicode.c: In function 'locale_encoding_to_unicode': lc-charset-unicode.c:178:25: error: passing argument 2 of 'iconv' from incompatible pointer type [-Wincompatible-pointer-types] 178 | &mbptr, &mbsize, | ^~~~~~ | | | char ** In file included from ./iconv.h:27, from lc-charset-unicode.c:32: /usr/include/iconv.h:47:32: note: expected 'const char ** restrict' but argument is of type 'char **' 47 | extern size_t iconv(iconv_t, const char **_RESTRICT_KYWD, lc-charset-unicode.c: In function 'unicode_to_locale_encoding': lc-charset-unicode.c:237:25: error: passing argument 2 of 'iconv' from incompatible pointer type [-Wincompatible-pointer-types] 237 | &utf8ptr, &utf8size, | ^~~~~~~~ | | | char ** /usr/include/iconv.h:47:32: note: expected 'const char ** restrict' but argument is of type 'char **' 47 | extern size_t iconv(iconv_t, const char **_RESTRICT_KYWD, *** Error code 1 make: Fatal error: Command failed for target `lc-charset-unicode.o'
I've pushed the attached patch to cast using the ICONV_CONST macro, which allows it to build. Collin
>From 218917cf37d3c8fbf568946acdf2ffe5e10f488b Mon Sep 17 00:00:00 2001 From: Collin Funk <collin.fu...@gmail.com> Date: Thu, 23 Jan 2025 21:14:43 -0800 Subject: [PATCH] char-h-c23: Fix compilation error on OmniOS. * lib/lc-charset-unicode.c (locale_encoding_to_unicode) (unicode_to_locale_encoding): Cast the argument to iconv with ICONV_CONST. --- ChangeLog | 7 +++++++ lib/lc-charset-unicode.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c6b369348..359e50a4af 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-01-23 Collin Funk <collin.fu...@gmail.com> + + char-h-c23: Fix compilation error on OmniOS. + * lib/lc-charset-unicode.c (locale_encoding_to_unicode) + (unicode_to_locale_encoding): Cast the argument to iconv with + ICONV_CONST. + 2025-01-23 Bruno Haible <br...@clisp.org> bootstrap: Make it work with module 'package-version'. diff --git a/lib/lc-charset-unicode.c b/lib/lc-charset-unicode.c index 9542873609..448619b687 100644 --- a/lib/lc-charset-unicode.c +++ b/lib/lc-charset-unicode.c @@ -175,7 +175,7 @@ locale_encoding_to_unicode (wchar_t wc) char *utf8ptr = utf8buf; size_t utf8size = sizeof (utf8buf); size_t ret = iconv (conv->cd_locale_to_utf8, - &mbptr, &mbsize, + (ICONV_CONST char **) &mbptr, &mbsize, &utf8ptr, &utf8size); if (ret == (size_t)(-1)) /* Conversion error. */ @@ -234,7 +234,7 @@ unicode_to_locale_encoding (char32_t uc) char *mbptr = mbbuf; size_t mbsize = sizeof (mbbuf); size_t ret = iconv (conv->cd_utf8_to_locale, - &utf8ptr, &utf8size, + (ICONV_CONST char **) &utf8ptr, &utf8size, &mbptr, &mbsize); if (ret == (size_t)(-1)) /* Conversion error. */ -- 2.48.1