[PATCH][gdb/testsuite] Fix gdb.cp/break-f-std-string.cc with older gcc

Tom de Vries tdevries@suse.de
Thu May 12 12:57:33 GMT 2022


On 5/12/22 14:47, Pedro Alves wrote:
> On 2022-05-12 12:45, Tom de Vries wrote:
> 
>> [gdb/testsuite] Fix gdb.cp/break-f-std-string.cc with older gcc
>>
>> ---
>>   gdb/testsuite/gdb.cp/break-f-std-string.cc | 14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>>
>> diff --git a/gdb/testsuite/gdb.cp/break-f-std-string.cc b/gdb/testsuite/gdb.cp/break-f-std-string.cc
>> index 454ab4c42ea..cbbfeebac60 100644
>> --- a/gdb/testsuite/gdb.cp/break-f-std-string.cc
>> +++ b/gdb/testsuite/gdb.cp/break-f-std-string.cc
>> @@ -17,6 +17,20 @@
>>   
>>   #include <string>
>>   
>> +#if _GLIBCXX_USE_CXX11_ABI == 1
>> +#if defined (__GNUC__) && (__GNUC__ >= 5) && (__GNUC__ <= 8)
>> +
>> +// Work around missing std::string typedef before gcc commit
>> +// "Define std::string and related typedefs outside __cxx11 namespace".
> 
> Since we try to follow the GDB conventions in the tests too, this should
> use /**/ comments.
> 

Ack, fixed.

>> +
>> +namespace std {
>> +using namespace __cxx11;
> 
> Why is this "using namespace __cxx11;" needed?  I guess something about the
> "related typedefs" mentioned in the comment?  The test passes for me without
> that, on GCC 6.5 (the only affected compiler I have handy atm), like:
> 
> namespace std {
> typedef __cxx11::string string;
> }
> 

Works for me as well, so removed.

> Otherwise LGTM.
> 

Thanks for the review, committed.

Thanks,
- Tom

> Pedro Alves
> 
>> +typedef __cxx11::string string;
>> +}
>> +
>> +#endif
>> +#endif
>> +
>>   void
>>   f (std::string s)
>>   {
>>
> 


More information about the Gdb-patches mailing list