bug-gnulib
[Top][All Lists]
Advanced

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

Fix a compilation error in C++ mode on Solaris 11.4


From: Bruno Haible
Subject: Fix a compilation error in C++ mode on Solaris 11.4
Date: Sun, 04 Sep 2022 02:54:37 +0200

On Solaris 11.4, I see this compilation error from a testdir:

depbase=`echo test-uchar-c++.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -O2 -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  -Wno-error -g -O2 -MT 
test-uchar-c++.o -MD -MP -MF $depbase.Tpo -c -o test-uchar-c++.o 
../../gltests/test-uchar-c++.cc &&\
mv -f $depbase.Tpo $depbase.Po
In file included from /usr/include/sys/time.h:447:0,
                 from ../gllib/sys/time.h:39,
                 from /usr/include/sys/select.h:27,
                 from ../gllib/sys/select.h:36,
                 from /usr/include/sys/types.h:665,
                 from ../gllib/sys/types.h:39,
                 from ../gllib/stdio.h:58,
                 from /usr/include/iso/wchar_iso.h:32,
                 from 
/usr/gcc/7/lib/gcc/x86_64-pc-solaris2.11/7.3.0/include-fixed/wchar.h:18,
                 from ../gllib/wchar.h:80,
                 from ../gllib/uchar.h:39,
                 from ../../gltests/test-uchar-c++.cc:22:
../gllib/uchar.h:505:1: error: 'std::size_t c32rtomb(char*, char32_t, 
std::mbstate_t*)' conflicts with a previous declaration
 _GL_CXXALIASWARN (c32rtomb);
 ^
In file included from /usr/include/uchar.h:9:0,
                 from ../gllib/uchar.h:32,
                 from ../../gltests/test-uchar-c++.cc:22:
/usr/include/iso/uchar_iso.h:59:15: note: previous declaration 'std::size_t 
std::c32rtomb(char*, char32_t, std::mbstate_t*)'
 extern size_t c32rtomb(char *_RESTRICT_KYWD, char32_t,
               ^~~~~~~~
In file included from /usr/include/sys/time.h:447:0,
                 from ../gllib/sys/time.h:39,
                 from /usr/include/sys/select.h:27,
                 from ../gllib/sys/select.h:36,
                 from /usr/include/sys/types.h:665,
                 from ../gllib/sys/types.h:39,
                 from ../gllib/stdio.h:58,
                 from /usr/include/iso/wchar_iso.h:32,
                 from 
/usr/gcc/7/lib/gcc/x86_64-pc-solaris2.11/7.3.0/include-fixed/wchar.h:18,
                 from ../gllib/wchar.h:80,
                 from ../gllib/uchar.h:39,
                 from ../../gltests/test-uchar-c++.cc:22:
../gllib/uchar.h:580:1: error: 'std::size_t mbrtoc32(char32_t*, const char*, 
std::size_t, std::mbstate_t*)' conflicts with a previous declaration
 _GL_CXXALIASWARN (mbrtoc32);
 ^
In file included from /usr/include/uchar.h:9:0,
                 from ../gllib/uchar.h:32,
                 from ../../gltests/test-uchar-c++.cc:22:
/usr/include/iso/uchar_iso.h:57:15: note: previous declaration 'std::size_t 
std::mbrtoc32(char32_t*, const char*, std::size_t, std::mbstate_t*)'
 extern size_t mbrtoc32(char32_t *_RESTRICT_KYWD, const char *_RESTRICT_KYWD,
               ^~~~~~~~
gmake[4]: *** [Makefile:23380: test-uchar-c++.o] Error 1

The cause is, again, a 'restrict' mismatch between declarations.
This patch fixes it.


2022-09-03  Bruno Haible  <bruno@clisp.org>

        Fix a compilation error in C++ mode on Solaris 11.4.
        * lib/uchar.in.h (c32rtomb): Enable the C++ alias warning only on
        glibc ≥ 2.16 systems. Fix a GNULIB_POSIXCHECK mistake.
        (mbrtoc32): Enable the C++ alias warning only on glibc ≥ 2.16 systems.

diff --git a/lib/uchar.in.h b/lib/uchar.in.h
index 13913a3dad..e6a5cddf86 100644
--- a/lib/uchar.in.h
+++ b/lib/uchar.in.h
@@ -170,11 +170,13 @@ _GL_FUNCDECL_SYS (c32rtomb, size_t, (char *s, char32_t 
wc, mbstate_t *ps));
 #  endif
 _GL_CXXALIAS_SYS (c32rtomb, size_t, (char *s, char32_t wc, mbstate_t *ps));
 # endif
+# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
 _GL_CXXALIASWARN (c32rtomb);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef c32rtomb
 # if HAVE_RAW_DECL_C32RTOMB
-_GL_WARN_ON_USE (mbrtoc32, "c32rtomb is not portable - "
+_GL_WARN_ON_USE (c32rtomb, "c32rtomb is not portable - "
                  "use gnulib module c32rtomb for portability");
 # endif
 #endif
@@ -245,7 +247,9 @@ _GL_FUNCDECL_SYS (mbrtoc32, size_t,
 _GL_CXXALIAS_SYS (mbrtoc32, size_t,
                   (char32_t *pc, const char *s, size_t n, mbstate_t *ps));
 # endif
+# if __GLIBC__ + (__GLIBC_MINOR__ >= 16) > 2
 _GL_CXXALIASWARN (mbrtoc32);
+# endif
 #elif defined GNULIB_POSIXCHECK
 # undef mbrtoc32
 # if HAVE_RAW_DECL_MBRTOC32






reply via email to

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