public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Define GNULIB_NAMESPACE in unittests/string_view-selftests.c
@ 2018-05-03 21:25 Simon Marchi
  2018-05-04 16:55 ` Joel Brobecker
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Marchi @ 2018-05-03 21:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

When building with x86_64-w64-mingw32-g++ (to test cross-compiling for
Windows), I get this error:

unittests/string_view-selftests.o: In function `selftests::string_view::inserters_2::test05(unsigned long long)':
/home/emaisin/src/binutils-gdb/gdb/unittests/basic_string_view/inserters/char/2.cc:60: undefined reference to `std::basic_ofstream<char, std::char_traits<char> >::rpl_close()'

This is caused by gnulib redefining "close" as "rpl_close", and
therefore messing up the declaration of basic_ofstream in the libstdc++
header.  The solution would be to use gnulib namespaces [1].  Until we
use them across GDB, we can use them locally in files that are
problematic, like this one.

gdb/ChangeLog:

	* unittests/string_view-selftests.c: Define GNULIB_NAMESPACE.
---
 gdb/unittests/string_view-selftests.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/unittests/string_view-selftests.c b/gdb/unittests/string_view-selftests.c
index 182a5df..55ffe64 100644
--- a/gdb/unittests/string_view-selftests.c
+++ b/gdb/unittests/string_view-selftests.c
@@ -21,6 +21,8 @@
    the "real" version.  */
 #if __cplusplus < 201703L
 
+#define GNULIB_NAMESPACE gnulib
+
 #include "defs.h"
 #include "selftest.h"
 #include "common/gdb_string_view.h"
-- 
2.7.4

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

end of thread, other threads:[~2018-05-09 15:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 21:25 [PATCH] Define GNULIB_NAMESPACE in unittests/string_view-selftests.c Simon Marchi
2018-05-04 16:55 ` Joel Brobecker
2018-05-04 16:59   ` Joel Brobecker
2018-05-04 17:11   ` Pedro Alves
2018-05-04 17:24     ` Joel Brobecker
2018-05-08 20:47     ` Simon Marchi
2018-05-08 21:22       ` Joel Brobecker
2018-05-09 13:50       ` Pedro Alves
2018-05-09 14:00         ` Joel Brobecker
2018-05-09 15:19         ` Simon Marchi
2018-05-04 17:14   ` Simon Marchi
2018-05-04 17:20     ` Joel Brobecker

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).