This is the mail archive of the mailing list for the libstdc++ 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]

Re: [PATCH] PR libstdc++/80276 fix pretty printers for array smart pointers

On 13/01/18 00:29 +0000, Jonathan Wakely wrote:
Secondly, std::experimental::optional no longer omits the
fundamentals_v1 inline namespace ... but then it didn't work properly
anyway because it displayed as "std::experimental::optional<\1>". So
arguably it's better to have no type printer than one that displays
the wrong type! I've also removed the type printer for
std::experimental::any was bogus, because it tried to match a
template, and any isn't a template!

Here's a patch that just fixes the optional<\1> bug, which I'll commit
to the branches.

diff --git a/libstdc++-v3/python/libstdcxx/v6/ b/libstdc++-v3/python/libstdcxx/v6/
index a67b27ab736..8f1023949bb 100644
--- a/libstdc++-v3/python/libstdcxx/v6/
+++ b/libstdc++-v3/python/libstdcxx/v6/
@@ -1277,7 +1277,7 @@ class TemplateTypePrinter(object):
     Recognizes type names that match a regular expression.
     Replaces them with a formatted string which can use replacement field
     {N} to refer to the \N subgroup of the regex match.
-    Type printers are recusively applied to the subgroups.
+    Type printers are recursively applied to the subgroups.
     This allows recognizing e.g. "std::vector<(.*), std::allocator<\\1> >"
     and replacing it with "std::vector<{1}>", omitting the template argument
@@ -1473,15 +1473,15 @@ def register_type_printers(obj):
     # strip the "fundamentals_v1" inline namespace from these types
-    add_one_template_type_printer(obj, 'any<T>',
-            'experimental::fundamentals_v\d::any<(.*)>',
-            'experimental::any<\\1>')
+    add_one_template_type_printer(obj, 'any',
+            'experimental::fundamentals_v\d::any',
+            'experimental::any')
     add_one_template_type_printer(obj, 'optional<T>',
-            'experimental::optional<\\1>')
+            'experimental::optional<{1}>')
     add_one_template_type_printer(obj, 'basic_string_view<C>',
             'experimental::fundamentals_v\d::basic_string_view<(.*), std::char_traits<\\1> >',
-            'experimental::basic_string_view<\\1>')
+            'experimental::basic_string_view<{1}>')
 def register_libstdcxx_printers (obj):
     "Register libstdc++ pretty-printers with objfile Obj."

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