This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Define GNULIB_NAMESPACE in unittests/string_view-selftests.c


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7402fbcae1c282e27aafd5c5c90aca7eabbdf45c

commit 7402fbcae1c282e27aafd5c5c90aca7eabbdf45c
Author: Simon Marchi <simon.marchi@ericsson.com>
Date:   Tue May 8 16:45:02 2018 -0400

    Define GNULIB_NAMESPACE in unittests/string_view-selftests.c
    
    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.

Diff:
---
 gdb/ChangeLog                         | 4 ++++
 gdb/unittests/string_view-selftests.c | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8314945..a1059aef 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2018-05-08  Simon Marchi  <simon.marchi@ericsson.com>
+
+	* unittests/string_view-selftests.c: Define GNULIB_NAMESPACE.
+
 2018-05-08  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* common/x86-xstate.h (I387_FCTRL_INIT_VAL): New constant.
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"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]