GNU Binutils with patches for OS216
Revisão | 5ac588997c3c2d032d5d5145d9245eb37354c23b (tree) |
---|---|
Hora | 2020-06-30 22:53:03 |
Autor | Tom Tromey <tromey@adac...> |
Commiter | Tom Tromey |
Do not define basic_string_view::to_string
gdb's copy of basic_string_view includes a to_string method. However,
according to cppreference, this is not a method on the real
std::basic_string_view:
https://en.cppreference.com/w/cpp/string/basic_string_view
This difference matters because gdb_string_view.h will use the
standard implementation when built with a C++17 or later. This caused
PR build/26183.
This patch fixes the problem by changing the method to be a standalone
helper function, and then rewriting the uses. Tested by rebuilding
with a version of GCC that defaults to C++17.
(Note that the build still is not clean; and also I noticed that the
libstdc++ string_view forbids the use of nullptr ... I wonder if gdb
violates that.)
gdb/ChangeLog
2020-06-30 Tom Tromey <tromey@adacore.com>
PR build/26183:
* ada-lang.c (ada_lookup_name_info::ada_lookup_name_info): Use
gdb::to_string.
gdbsupport/ChangeLog
2020-06-30 Tom Tromey <tromey@adacore.com>
PR build/26183:
* gdb_string_view.h (basic_string_view::to_string): Remove.
(gdb::to_string): New function.
@@ -1,3 +1,9 @@ | ||
1 | +2020-06-30 Tom Tromey <tromey@adacore.com> | |
2 | + | |
3 | + PR build/26183: | |
4 | + * ada-lang.c (ada_lookup_name_info::ada_lookup_name_info): Use | |
5 | + gdb::to_string. | |
6 | + | |
1 | 7 | 2020-06-29 Simon Marchi <simon.marchi@efficios.com> |
2 | 8 | |
3 | 9 | * gdbarch.sh (displaced_step_copy_insn): Update doc. |
@@ -13553,10 +13553,10 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name) | ||
13553 | 13553 | { |
13554 | 13554 | if (user_name.back () == '>') |
13555 | 13555 | m_encoded_name |
13556 | - = user_name.substr (1, user_name.size () - 2).to_string (); | |
13556 | + = gdb::to_string (user_name.substr (1, user_name.size () - 2)); | |
13557 | 13557 | else |
13558 | 13558 | m_encoded_name |
13559 | - = user_name.substr (1, user_name.size () - 1).to_string (); | |
13559 | + = gdb::to_string (user_name.substr (1, user_name.size () - 1)); | |
13560 | 13560 | m_encoded_p = true; |
13561 | 13561 | m_verbatim_p = true; |
13562 | 13562 | m_wild_match_p = false; |
@@ -13575,10 +13575,10 @@ ada_lookup_name_info::ada_lookup_name_info (const lookup_name_info &lookup_name) | ||
13575 | 13575 | if (encoded != NULL) |
13576 | 13576 | m_encoded_name = encoded; |
13577 | 13577 | else |
13578 | - m_encoded_name = user_name.to_string (); | |
13578 | + m_encoded_name = gdb::to_string (user_name); | |
13579 | 13579 | } |
13580 | 13580 | else |
13581 | - m_encoded_name = user_name.to_string (); | |
13581 | + m_encoded_name = gdb::to_string (user_name); | |
13582 | 13582 | |
13583 | 13583 | /* Handle the 'package Standard' special case. See description |
13584 | 13584 | of m_standard_p. */ |
@@ -1,3 +1,9 @@ | ||
1 | +2020-06-30 Tom Tromey <tromey@adacore.com> | |
2 | + | |
3 | + PR build/26183: | |
4 | + * gdb_string_view.h (basic_string_view::to_string): Remove. | |
5 | + (gdb::to_string): New function. | |
6 | + | |
1 | 7 | 2020-06-27 Simon Marchi <simon.marchi@efficios.com> |
2 | 8 | |
3 | 9 | * tdesc.h (class print_xml_feature) <add_line>: Add |
@@ -245,13 +245,6 @@ namespace gdb { | ||
245 | 245 | return { this->_M_str, this->_M_len }; |
246 | 246 | } |
247 | 247 | |
248 | - template<typename _Allocator = std::allocator<_CharT>> | |
249 | - std::basic_string<_CharT, _Traits, _Allocator> | |
250 | - to_string(const _Allocator& __alloc = _Allocator()) const | |
251 | - { | |
252 | - return { this->_M_str, this->_M_len, __alloc }; | |
253 | - } | |
254 | - | |
255 | 248 | size_type |
256 | 249 | copy(_CharT* __str, size_type __n, size_type __pos = 0) const |
257 | 250 | { |
@@ -560,4 +553,14 @@ namespace gdb { | ||
560 | 553 | |
561 | 554 | #endif // __cplusplus < 201703L |
562 | 555 | |
556 | +namespace gdb { | |
557 | + | |
558 | +static inline std::string | |
559 | +to_string(const gdb::string_view &view) | |
560 | +{ | |
561 | + return { view.data (), view.size () }; | |
562 | +} | |
563 | + | |
564 | +} | |
565 | + | |
563 | 566 | #endif /* COMMON_GDB_STRING_VIEW_H */ |