Fix pretty printers for versioned namespace
François Dumont
frs.dumont@gmail.com
Wed Nov 1 18:04:00 GMT 2017
On 30/10/2017 19:15, Jonathan Wakely wrote:
>
>>> @@ -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.
It worked, attached patch applied.
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: printers.patch
Type: text/x-patch
Size: 4663 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20171101/dd8e8c95/attachment.bin>
More information about the Gcc-patches
mailing list