This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Fix pretty printers for versioned namespace
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 26 Oct 2017 21:41:12 +0100
- Subject: Re: Fix pretty printers for versioned namespace
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jwakely at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0F052883BF
- References: <29900c34-03ae-453d-3e96-401620b4f5c8@gmail.com> <20171026203008.GL9153@redhat.com> <20171026203747.GM9153@redhat.com>
On 26/10/17 21:37 +0100, Jonathan Wakely wrote:
On 26/10/17 21:30 +0100, Jonathan Wakely wrote:
On 26/10/17 22:19 +0200, François Dumont wrote:
@@ -1232,7 +1232,7 @@ class Printer(object):
# Add a name using _GLIBCXX_BEGIN_NAMESPACE_CONTAINER.
def add_container(self, base, name, function):
self.add_version(base, name, function)
- self.add_version(base + '__cxx1998::', name, function)
+ self.add_version(base, '__cxx1998::' + name, function)
I don't like this change.
Previously the arguments were the namespace(s) and the type. That's
nice and simple.
Now it's the first namespace, and then all the other namespaces and
the type. That's not very clean.
There must be a way to keep the add_version and add_container calls
the same, and have it transparently handle the case where the
namespace is 'std::__8::foo' not 'std::foo'.
e.g. in add_version instead of:
if _versioned_namespace:
self.add(base + _versioned_namespace + name, function)
We should replace "std::" in base with "std::" + _versioned_namespace
That means we only have to change that function, not every call to it.
Something like this:
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1227,7 +1227,8 @@ class Printer(object):
def add_version(self, base, name, function):
self.add(base + name, function)
if _versioned_namespace:
- self.add(base + _versioned_namespace + name, function)
+ vbase = re.sub('^std::', 'std::%s::' % _versioned_namespace, base)
+ self.add(vbase + name, function)
# Add a name using _GLIBCXX_BEGIN_NAMESPACE_CONTAINER.
def add_container(self, base, name, function):