bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compile error with xlclang++ on AIX


From: Bruno Haible
Subject: Re: Compile error with xlclang++ on AIX
Date: Sat, 07 Dec 2019 18:53:12 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; )

Christian Biesinger wrote:
> (tested on the GCC compile farm, gcc119, /opt/IBM/xlC/16.1.0/bin/xlclang++)
> 
> /opt/IBM/xlC/16.1.0/include2/c++/__bsd_locale_fallbacks.h:50:12:
> error: no matching function for call to
>       'wcsnrtombs'
>     return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
>            ^~~~~~~~~~
> /usr/include/wchar.h:444:15: note: candidate function not viable: no
> known conversion from 'rpl_mbstate_t *'
>       (aka 'int *') to 'mbstate_t *' (aka 'char **') for 5th argument
> extern size_t wcsnrtombs(char *, const wchar_t **, size_t, size_t, mbstate_t 
> *);
>               ^
> 
> /opt/IBM/xlC/16.1.0/include2/c++/__bsd_locale_fallbacks.h:87:12:
> error: no matching function for call to 'mbrlen'
>     return mbrlen(__s, __n, __ps);
>            ^~~~~~
> /usr/include/wchar.h:354:15: note: candidate function not viable: no
> known conversion from 'rpl_mbstate_t *'
>       (aka 'int *') to 'mbstate_t *' (aka 'char **') for 3rd argument
> extern size_t mbrlen(const char * __restrict__, size_t, mbstate_t
> *__restrict__);
>               ^
> 
> (similar for a few other mb*/wc* functions)
> 
> Testcase:
> #include "gnulib/config.h"
> #include <wchar.h> // optional
> #include <sstream>


This patch fixes it. Other issues still exist on macOS, FreeBSD, OpenBSD, HP-UX,
though.


2019-12-07  Bruno Haible  <address@hidden>

        Fix compilation errors in C++ mode on AIX with xlclang++.
        Reported by Christian Biesinger <address@hidden> in
        <https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00009.html>.
        * lib/wchar.in.h (mbstate_t): Don't override on AIX.

diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index 71b1efe..af019e6 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -137,8 +137,11 @@ typedef unsigned int rpl_wint_t;
 
 /* Override mbstate_t if it is too small.
    On IRIX 6.5, sizeof (mbstate_t) == 1, which is not sufficient for
-   implementing mbrtowc for encodings like UTF-8.  */
-#if !(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@
+   implementing mbrtowc for encodings like UTF-8.
+   On AIX, mbrtowc needs to be overridden, but mbstate_t exists and is large
+   enough and overriding it would cause problems in C++ mode.  */
+#if (!(@HAVE_MBSINIT@ && @HAVE_MBRTOWC@) || @REPLACE_MBSTATE_T@) \
+    && !defined _AIX
 # if !GNULIB_defined_mbstate_t
 typedef int rpl_mbstate_t;
 #  undef mbstate_t




reply via email to

[Prev in Thread] Current Thread [Next in Thread]