Pretty printers for versioned namespace
François Dumont
frs.dumont@gmail.com
Sat Dec 24 13:48:00 GMT 2016
On 15/12/2016 15:57, Jonathan Wakely wrote:
>
> And we could avoid three re.match expressions with complicated regular
> expressions by creating a helper function to do the "startswith"
> checks:
>
> def is_specialization_of(type, template_name):
> return re.match('^std::(%s)?%s<.*>$' % (vers_nsp, template_name),
> type) is not None
>
> Then replace impl_type.startswith('std::__uniq_ptr_impl<') with
> is_specialization_of(impl_type, '__uniq_ptr_impl')
>
> And replace impl_type.startswith('std::tuple<') with
> is_specialization_of(impl_type, 'tuple')
>
> And replace nodetype.name.startswith('std::_Rb_tree_node') with
> is_specialization_of(nodetype.name, '_Rb_tree_node')
>
> That makes the code much easier to read.
>
>
I agree that hiding the version namespace will be nicer. I just hope it
is possible. I don't think we can really dictate gdb to hide this
namespace during the rendering. In the attached path you will see what I
tried to do. Problem is that I am not sure that printers.py is
intercepting rendering of all types so version namespace will stay
visible in those cases.
I think the 2 failures that I have with this patch are reflecting this
problem:
type = holder<std::__7::basic_string<unsigned char,
std::__7::char_traits<unsigned char>, std::__7::allocator<unsigned char> > >
got: type = holder<std::__7::basic_string<unsigned char,
std::__7::char_traits<unsigned char>, std::__7::allocator<unsigned char> > >
FAIL: libstdc++-prettyprinters/whatis.cc whatis ustring_holder
type = holder<std::__7::basic_string<signed char,
std::__7::char_traits<signed char>, std::__7::allocator<signed char> > >
got: type = holder<std::__7::basic_string<signed char,
std::__7::char_traits<signed char>, std::__7::allocator<signed char> > >
FAIL: libstdc++-prettyprinters/whatis.cc whatis sstring_holder
Shall I simply use regex in those cases and adopt this approach ?
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prettyprinters.patch
Type: text/x-patch
Size: 19600 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20161224/b8bcc156/attachment.bin>
More information about the Libstdc++
mailing list