Tom G. Christensen wrote: > > Generally, these C++ tests are supported on glibc systems with > > modern GCC. For testing Solaris 10, try passing the option > > '--without-c++-tests' to gnulib-tool. > > > > This does not seem to have any effect. > > I tried running gnulib-tool like this: > ./gnulib-tool --create-testdir --dir=./testdir --single-configure > --without-privileged-tests --without-c++-tests > > However the testdir still includes the C++ tests. > > To avoid the C++ tests I needed to pass the option '--disable-c++' to > ./configure.
OK, so I guessed wrong regarding the cause of the problem. Did some experiments, and it seems the cause is the combination of the 'posixcheck' module and C++. With a testdir created through ./gnulib-tool --create-testdir --dir=../testdir1 --single-configure --with-c++-tests \ array-list avltreehash-list avltree-list carray-list linkedhash-list \ linked-list list rbtreehash-list rbtree-list sublist xlist xsublist list-c++ \ posixcheck strpbrk I get compilation errors even on glibc systems: In file included from ../../gltests/test-list-c++.cc:23:0: ../gllib/string.h:660:1: error: type of ‘memchr’ is unknown _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " ^ ../gllib/string.h:660:1: error: ‘int memchr’ redeclared as different kind of symbol _GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " ^ In file included from ../gllib/string.h:41:0, from ../../gltests/test-list-c++.cc:23: /usr/include/string.h:85:1: note: previous declaration ‘const void* memchr(const void*, int, size_t)’ memchr (const void *__s, int __c, size_t __n) __THROW ^ In file included from ../../gltests/test-list-c++.cc:23:0: ../gllib/string.h:744:1: error: type of ‘memrchr’ is unknown _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " ^ ../gllib/string.h:744:1: error: ‘int memrchr’ redeclared as different kind of symbol _GL_WARN_ON_USE (memrchr, "memrchr is unportable - " ^ In file included from ../gllib/string.h:41:0, from ../../gltests/test-list-c++.cc:23: /usr/include/string.h:114:26: note: previous declaration ‘const void* memrchr(const void*, int, size_t)’ extern "C++" const void *memrchr (const void *__s, int __c, size_t __n) ^ In file included from ../../gltests/test-list-c++.cc:23:0: ../gllib/string.h:774:1: error: type of ‘rawmemchr’ is unknown _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " ^ ../gllib/string.h:774:1: error: ‘int rawmemchr’ redeclared as different kind of symbol _GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " ^ In file included from ../gllib/string.h:41:0, from ../../gltests/test-list-c++.cc:23: /usr/include/string.h:103:26: note: previous declaration ‘const void* rawmemchr(const void*, int)’ extern "C++" const void *rawmemchr (const void *__s, int __c) ^ In file included from ../../gltests/test-list-c++.cc:23:0: ../gllib/string.h:878:1: error: type of ‘strchrnul’ is unknown _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " ^ ../gllib/string.h:878:1: error: ‘int strchrnul’ redeclared as different kind of symbol _GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " ^ In file included from ../gllib/string.h:41:0, from ../../gltests/test-list-c++.cc:23: /usr/include/string.h:269:26: note: previous declaration ‘const char* strchrnul(const char*, int)’ extern "C++" const char *strchrnul (const char *__s, int __c) ^ In file included from ../../gltests/test-list-c++.cc:23:0: ../gllib/string.h:1151:1: error: type of ‘strstr’ is unknown _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " ^ ../gllib/string.h:1151:1: error: ‘int strstr’ redeclared as different kind of symbol _GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " ^ In file included from ../gllib/string.h:41:0, from ../../gltests/test-list-c++.cc:23: /usr/include/string.h:330:1: note: previous declaration ‘const char* strstr(const char*, const char*)’ strstr (const char *__haystack, const char *__needle) __THROW ^ In file included from ../../gltests/test-list-c++.cc:23:0: ../gllib/string.h:1199:1: error: type of ‘strcasestr’ is unknown _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " ^ ../gllib/string.h:1199:1: error: ‘int strcasestr’ redeclared as different kind of symbol _GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " ^ In file included from ../gllib/string.h:41:0, from ../../gltests/test-list-c++.cc:23: /usr/include/string.h:364:26: note: previous declaration ‘const char* strcasestr(const char*, const char*)’ extern "C++" const char *strcasestr (const char *__haystack, ^ That's too much effort to fix, given that C++ mode is only of secondary importance to Gnulib. I'm therefore disabling this combination: 2020-11-17 Bruno Haible <br...@clisp.org> posixcheck: Don't enable GNULIB_POSIXCHECK in C++ mode. Reported by Tom G. Christensen <t...@jupiterrise.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-11/msg00062.html>. * m4/posixcheck.m4 (gl_POSIXCHECK): Don't define GNULIB_POSIXCHECK in C++ mode. diff --git a/m4/posixcheck.m4 b/m4/posixcheck.m4 index d9a3d6c..2ee1b25 100644 --- a/m4/posixcheck.m4 +++ b/m4/posixcheck.m4 @@ -6,7 +6,11 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_POSIXCHECK], [ - AC_DEFINE([GNULIB_POSIXCHECK], [1], - [Define to enable warnings for determining which Gnulib modules to use, - for portability of POSIX functions.]) + AH_VERBATIM([POSIXCHECK], + [/* Define to enable warnings for determining which Gnulib modules to use, for + portability of POSIX functions. This does not work well in C++ mode. */ +#ifndef __cplusplus +# define GNULIB_POSIXCHECK 1 +#endif +]) ])