[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
fix compilation error in C++ mode on Solaris 11 OpenIndiana
From: |
Bruno Haible |
Subject: |
fix compilation error in C++ mode on Solaris 11 OpenIndiana |
Date: |
Wed, 04 Dec 2019 12:27:02 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-166-generic; KDE/5.18.0; x86_64; ; ) |
A testdir built with
./gnulib-tool --create-testdir --dir=../testdir1 --single-configure
--with-c++-tests `./posix-modules`
does not compile on Solaris 11 OpenIndiana:
depbase=`echo test-wchar-c++.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -m64 -O2 -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700 -DHAVE_CONFIG_H -DEXEEXT=\"\"
-I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I.
-I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib
-I/export/home/bruno/prefix64/include -Wall -D_REENTRANT -MT test-wchar-c++.o
-MD -MP -MF $depbase.Tpo -c -o test-wchar-c++.o ../../gltests/test-wchar-c++.cc
&&\
mv -f $depbase.Tpo $depbase.Po
In file included from /usr/include/sys/time.h:462:0,
from ../gllib/sys/time.h:39,
from /usr/include/sys/select.h:53,
from ../gllib/sys/select.h:36,
from /usr/include/sys/types.h:631,
from ../gllib/sys/types.h:39,
from ../gllib/stdio.h:58,
from ../gllib/wchar.h:79,
from ../../gltests/test-wchar-c++.cc:22:
../gllib/wchar.h: In member function 'gnulib::_gl_wcsnrtombs_wrapper::operator
gnulib::_gl_wcsnrtombs_wrapper::type() const':
../gllib/wchar.h:919:1: error: '::wcsnrtombs' has not been declared
_GL_CXXALIAS_SYS (wcsnrtombs, size_t,
^
../gllib/wchar.h:919:1: note: suggested alternative:
In file included from /usr/include/wchar.h:31:0,
from ../gllib/wchar.h:87,
from ../../gltests/test-wchar-c++.cc:22:
/usr/include/iso/wchar_iso.h:310:15: note: 'std::wcsnrtombs'
extern size_t wcsnrtombs(char *_RESTRICT_KYWD, const wchar_t **_RESTRICT_KYWD,
^~~~~~~~~~
gmake[4]: *** [Makefile:9708: test-wchar-c++.o] Error 1
The reason is that on Solaris OpenIndiana, in C++ mode, the system's <wchar.h>
defines std::wcsnrtombs but not ::wcsnrtombs. (A 'using std::wcsnrtombs;'
statement is missing.) This workaround fixes the problem. I'm not using an
autoconf test here, because the Autoconf tests are executed with the C compiler
whereas the problem is with the C++ mode.
2019-12-04 Bruno Haible <address@hidden>
Fix compilation error in C++ mode on Solaris 11 OpenIndiana.
* lib/wchar.in.h (wcsnrtombs): Force declaration in C++ mode on Solaris.
* doc/posix-functions/wcsnrtombs.texi: Mention the issue.
diff --git a/doc/posix-functions/wcsnrtombs.texi
b/doc/posix-functions/wcsnrtombs.texi
index 39415d9..08aeebb 100644
--- a/doc/posix-functions/wcsnrtombs.texi
+++ b/doc/posix-functions/wcsnrtombs.texi
@@ -15,6 +15,10 @@ FreeBSD 5.2.1, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, HP-UX
11, IRIX 6.5, Solaris
This function cannot consume valid sequences of wide characters
on some platforms:
Solaris 11.4.
+@item
+In C++ mode, the system's @code{<wchar.h>} defines @code{std::wcsnrtombs} but
+not @code{::wcsnrtombs} on some platforms:
+Solaris 11 OpenIndiana.
@end itemize
Portability problems not fixed by Gnulib:
diff --git a/lib/wchar.in.h b/lib/wchar.in.h
index f081be6..71b1efe 100644
--- a/lib/wchar.in.h
+++ b/lib/wchar.in.h
@@ -436,7 +436,7 @@ _GL_CXXALIAS_RPL (wcsnrtombs, size_t,
(char *dest, const wchar_t **srcp, size_t srclen, size_t len,
mbstate_t *ps));
# else
-# if !@HAVE_WCSNRTOMBS@
+# if !@HAVE_WCSNRTOMBS@ || (defined __cplusplus && defined __sun)
_GL_FUNCDECL_SYS (wcsnrtombs, size_t,
(char *dest, const wchar_t **srcp, size_t srclen, size_t len,
mbstate_t *ps)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- fix compilation error in C++ mode on Solaris 11 OpenIndiana,
Bruno Haible <=