This is the mail archive of the libstdc++@gcc.gnu.org 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: Fix pretty printers for versioned namespace


On 30/10/17 17:59 +0000, Jonathan Wakely wrote:
On 30/10/17 18:13 +0100, François Dumont wrote:
On 26/10/2017 22:41, Jonathan Wakely wrote:
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.

Not always, see updated patch.

Ah yes. Well it's nice to fix those cases then :-)

@@ -1227,7 +1227,12 @@ 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)
+            if vbase != base:
+                self.add(vbase + name, function)
+            vbase = re.sub('^__gnu_cxx::', '__gnu_cxx::%s' % _versioned_namespace, base)
+            if vbase != base:
+                self.add(vbase + name, function)

Only one re.sub is needed:

vbase = re.sub('^(std|__gnu_cxx)::', r'\1::%s' % _versioned_namespace, base)

Or using \g<0> to refer to the whole match:

vbase = re.sub('^(std|__gnu_cxx)::', r'\g<0>%s' % _versioned_namespace, base)

OK for trunk with that change, assuming it works. Thanks.



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