bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* cannot figure out how to work with GNULIB_NAMESPACE without warnings
@ 2021-01-13 16:54 Alexandre Duret-Lutz
  2021-01-14  0:58 ` Bruno Haible
  0 siblings, 1 reply; 6+ messages in thread
From: Alexandre Duret-Lutz @ 2021-01-13 16:54 UTC (permalink / raw)
  To: bug-gnulib

Hi

Testing my updated version of gnulib (as specified yesterday
in https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00177.html)

I ran into the following linking issue, which I did not have 8 months ago.

/usr/bin/i686-w64-mingw32-ld: misc/.libs/libmisc.a(satsolver.o): in function `ZNSt13basic_filebufIcSt11char_traitsIcEED4Ev':
/usr/lib/gcc/i686-w64-mingw32/10-posix/include/c++/fstream:249: undefined reference to `std::basic_filebuf<char, std::char_traits<char> >::rpl_close()'
collect2: error: ld returned 1 exit status

[That's a cross compilation for MinGW, obviously.]

Since this seems to the kind of error documented on
https://www.gnu.org/software/gnulib/manual/html_node/A-C_002b_002b-namespace-for-gnulib.html
I tried to do

   AC_DEFINE_UNQUOTED([GNULIB_NAMESPACE], [gnulib])

(knowing that I would then have to track down the use of many replaced
function, and prefix them with gnulib::)

However then compilation failed with a message telling me that a
system-installed header should use gnulib::vsnprintf instead
of std::vsnprintf!

libtool: compile:  clang++ -Qunused-arguments -DHAVE_CONFIG_H -I. -I../.. -I../.. -I../.. -I../../buddy/src -I../../lib -I../../lib -W -Wall -Werror -Wint-to-void-pointer-cast -Wcast-align -Wpointer-arith -Wwrite-strings -Wcast-qual -DXTSTRINGDEFINES -Wdocumentation -Wmissing-declarations -Woverloaded-virtual -Wmisleading-indentation -Wimplicit-fallthrough -Wnull-dereference -Wsuggest-override -Wpedantic -fvisibility=hidden -fvisibility-inlines-hidden -DSPOT_BUILD -std=c++20 -g -O -MT clz.lo -MD -MP -MF .deps/clz.Tpo -c clz.cc  -fPIC -DPIC -o .libs/clz.o
In file included from bitvect.cc:23:
In file included from ../../spot/misc/bitvect.hh:22:
In file included from ../../spot/misc/common.hh:21:
In file included from /usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/stdexcept:39:
In file included from /usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/string:55:
/usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/basic_string.h:6652:50: error: The symbol ::vsnprintf refers to the system function. Use gnulib::vsnprintf instead. [-Werror,-Wuser-defined-warnings]
    return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
                                                 ^
../../lib/stdio.h:2104:1: note: from 'diagnose_if' attribute on 'vsnprintf':
_GL_CXXALIASWARN (vsnprintf);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../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:553:19: note: expanded from macro '_GL_WARN_ON_USE'
  __attribute__ ((__diagnose_if__ (1, message, "warning")))
                  ^                ~

This was clang++ 11.0.0 on Arch linux.


Since the original issue I have is with rpl_close(), and that I don't
really care about the issues it fixes, I've tried to use "gnulib-tool
--avoid=close" but in that case I get "#define close _close", which does
not help either.


Any clue ?
-- 
Alexandre Duret-Lutz


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-15 12:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 16:54 cannot figure out how to work with GNULIB_NAMESPACE without warnings Alexandre Duret-Lutz
2021-01-14  0:58 ` Bruno Haible
2021-01-14 10:35   ` Alexandre Duret-Lutz
2021-01-14 13:43     ` clang++ hard failure with GNULIB_NAMESPACE Alexandre Duret-Lutz
2021-01-15  9:51       ` Bruno Haible
2021-01-15 12:19         ` Alexandre Duret-Lutz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).