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: Pretty printers for versioned namespace


I tried to use your patch but failed so far. Situation with autoreconf is a little bit strange. On my system the default autoreconf is version 2.69. When using it I have:

/home/fdt/dev/gcc/git/libstdc++-v3>/usr/bin/autoreconf error: Please use exactly Autoconf 2.64 instead of 2.69.

    So I install version 2.64 and when using it I now have:

/home/fdt/dev/gcc/git/libstdc++-v3>autoreconf error: Autoconf version 2.65 or higher is required

Is there some doc about this ?

I don't know what is the impact of it but is there a plan to allow version 2.69 to work out of the box ?


So after I install the version 2.64 as required

On 19/01/2017 22:21, Jonathan Wakely wrote:
On 19/01/17 22:01 +0100, François Dumont wrote:
On 10/01/2017 13:39, Jonathan Wakely wrote:
I've committed the attached patch, which passes the tests for the
default configuration and the versioned namespace configuration.

I added another helper function, strip_versioned_namespace, which is
more expressive than doing typename.replace(vers_nsp, '') everywhere.
I've also renamed vers_nsp to _versioned_namespace (using the naming
convention for global variables private to the module). I've added
checks so that if that variable is None then the extra printers and
special cases for the versioned namespace are skipped. That's not
currently used, but it would allow us to optimise things later if

Very nice feature indeed, see below.

I also needed to update the new SharedPtrMethodsMatcher to add
"(__\d+)?" to the regular expression.

@@ -1392,47 +1406,54 @@ def register_type_printers(obj):
   add_one_type_printer(obj, 'discard_block_engine', 'ranlux48')
   add_one_type_printer(obj, 'shuffle_order_engine', 'knuth_b')

+    # Consider optional versioned namespace
+    opt_nsp = '(' + vers_nsp + ')?'
   # Do not show defaulted template arguments in class templates
   add_one_template_type_printer(obj, 'unique_ptr<T>',
-            'unique_ptr<(.*), std::default_delete<\\1 ?> >',
-            'unique_ptr<{1}>')
+        '{0}unique_ptr<(.*), std::{0}default_delete<\\2 ?>
+        'unique_ptr<{2}>')

This is ugly. Mixing python string formatting with regular expressions
makes it harder to read, and is inconsistent with how the versioned
namespace is handled elsewhere. In Printer.add_version and
add_one_type_printer we just register two names, one using std:: and
one using std::__7::. We can do the same for the template type

Yes, your approach is much nicer even if it results in more type printer registered.

My plan was to submit the attached patch but this doesn't work as the python module seems to be loaded before If you know a way to test for versioned namespace before starting registering printers this patch might still be useful. Otherwise I will just forget it.

See the attached patch, which decides at configure-time whether to
enable the versioned namespace printers or not. This is what I had in

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