Alexandre Duret-Lutz <a...@lrde.epita.fr> writes: > Bruno Haible <br...@clisp.org> writes: > >> in C++, it is easier and more robust to define GNULIB_NAMESPACE. > > OK, thanks, I'll progress this way.
Progress is not smooth. This time it's unrelated to -Werror. Using clang++ 11, compilation fails because of the overloads of memchr and friends. Note that clang++11 defines __GNUC__ and __GNU_MINOR__ as 4 and 2 (Yuck!) so the two _GL_CXXALIASWARN1 calls dealing with the two overloads in lib/string.h are not performed. In file included from bitvect.cc:28: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstring:42: ../../lib/string.h:693:1: error: reference to overloaded function could not be resolved; did you mean to call it? _GL_CXXALIASWARN (memchr); ^~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:382:4: note: expanded from macro '_GL_CXXALIASWARN' _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:384:4: note: expanded from macro '_GL_CXXALIASWARN_1' _GL_CXXALIASWARN_2 (func, namespace) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:389:5: note: expanded from macro '_GL_CXXALIASWARN_2' _GL_WARN_ON_USE (func, \ ^~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:552:19: note: expanded from macro '_GL_WARN_ON_USE' extern __typeof__ (function) function \ ^~~~~~~~~~ /usr/include/string.h:84:1: note: possible target for call memchr (const void *__s, int __c, size_t __n) __THROW ^ /usr/include/string.h:78:1: note: possible target for call memchr (void *__s, int __c, size_t __n) __THROW ^ In file included from bitvect.cc:28: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstring:42: ../../lib/string.h:807:1: error: reference to overloaded function could not be resolved; did you mean to call it? _GL_CXXALIASWARN (rawmemchr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:382:4: note: expanded from macro '_GL_CXXALIASWARN' _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:384:4: note: expanded from macro '_GL_CXXALIASWARN_1' _GL_CXXALIASWARN_2 (func, namespace) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:389:5: note: expanded from macro '_GL_CXXALIASWARN_2' _GL_WARN_ON_USE (func, \ ^~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:552:19: note: expanded from macro '_GL_WARN_ON_USE' extern __typeof__ (function) function \ ^~~~~~~~~~ /usr/include/string.h:101:26: note: possible target for call extern "C++" const void *rawmemchr (const void *__s, int __c) ^ /usr/include/string.h:99:20: note: possible target for call extern "C++" void *rawmemchr (void *__s, int __c) ^ In file included from bitvect.cc:28: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/cstring:42: ../../lib/string.h:911:1: error: reference to overloaded function could not be resolved; did you mean to call it? _GL_CXXALIASWARN (strchrnul); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:382:4: note: expanded from macro '_GL_CXXALIASWARN' _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:384:4: note: expanded from macro '_GL_CXXALIASWARN_1' _GL_CXXALIASWARN_2 (func, namespace) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:389:5: note: expanded from macro '_GL_CXXALIASWARN_2' _GL_WARN_ON_USE (func, \ ^~~~~~~~~~~~~~~~~~~~~~~~ ../../lib/wchar.h:552:19: note: expanded from macro '_GL_WARN_ON_USE' extern __typeof__ (function) function \ ^~~~~~~~~~ /usr/include/string.h:263:26: note: possible target for call extern "C++" const char *strchrnul (const char *__s, int __c) ^ /usr/include/string.h:261:20: note: possible target for call extern "C++" char *strchrnul (char *__s, int __c) ^ 3 errors generated. make[3]: *** [Makefile:1445: bitvect.lo] Error 1 make[2]: *** [Makefile:1549: all-recursive] Error 1 make[1]: *** [Makefile:1424: all-recursive] Error 1 make: *** [Makefile:1344: all] Error 2 -- Alexandre Duret-Lutz