From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53825 invoked by alias); 30 Oct 2017 18:15:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 53600 invoked by uid 89); 30 Oct 2017 18:15:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 30 Oct 2017 18:15:38 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2502C60153; Mon, 30 Oct 2017 18:15:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2502C60153 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jwakely@redhat.com Received: from localhost (unknown [10.33.36.5]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFB80600C2; Mon, 30 Oct 2017 18:15:36 +0000 (UTC) Date: Mon, 30 Oct 2017 18:21:00 -0000 From: Jonathan Wakely To: =?iso-8859-1?Q?Fran=E7ois?= Dumont Cc: "libstdc++@gcc.gnu.org" , gcc-patches Subject: Re: Fix pretty printers for versioned namespace Message-ID: <20171030181536.GW9153@redhat.com> References: <29900c34-03ae-453d-3e96-401620b4f5c8@gmail.com> <20171026203008.GL9153@redhat.com> <20171026203747.GM9153@redhat.com> <20171026204111.GN9153@redhat.com> <20171030175946.GV9153@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171030175946.GV9153@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.1 (2017-09-22) X-SW-Source: 2017-10/txt/msg02233.txt.bz2 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. >