From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84318 invoked by alias); 13 Aug 2015 20:05:13 -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 84304 invoked by uid 89); 13 Aug 2015 20:05:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f182.google.com Received: from mail-wi0-f182.google.com (HELO mail-wi0-f182.google.com) (209.85.212.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 13 Aug 2015 20:05:12 +0000 Received: by wicja10 with SMTP id ja10so162703748wic.1 for ; Thu, 13 Aug 2015 13:05:09 -0700 (PDT) X-Received: by 10.180.99.39 with SMTP id en7mr9550764wib.49.1439496309077; Thu, 13 Aug 2015 13:05:09 -0700 (PDT) Received: from localhost ([95.147.106.37]) by smtp.googlemail.com with ESMTPSA id lk16sm4894958wic.6.2015.08.13.13.05.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2015 13:05:08 -0700 (PDT) From: Richard Sandiford To: Trevor Saunders Mail-Followup-To: Trevor Saunders ,Jeff Law , tbsaunde+gcc@tbsaunde.org, gcc-patches@gcc.gnu.org, richard.sandiford@arm.com, rdsandiford@googlemail.com Cc: Jeff Law , tbsaunde+gcc@tbsaunde.org, gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: Re: [PATCH 2/2] replace several uses of the anon namespace with GCC_FINAL References: <1439208314-7390-1-git-send-email-tbsaunde+gcc@tbsaunde.org> <1439208314-7390-2-git-send-email-tbsaunde+gcc@tbsaunde.org> <55CA4B93.3060003@redhat.com> <87oaicbaht.fsf@e105548-lin.cambridge.arm.com> <55CB9888.4000200@redhat.com> <20150812203608.GB4898@tsaunders-iceball.corp.tor1.mozilla.com> Date: Thu, 13 Aug 2015 20:23:00 -0000 In-Reply-To: <20150812203608.GB4898@tsaunders-iceball.corp.tor1.mozilla.com> (Trevor Saunders's message of "Wed, 12 Aug 2015 16:36:08 -0400") Message-ID: <87fv3nc5u9.fsf@googlemail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2015-08/txt/msg00736.txt.bz2 Trevor Saunders writes: > On Wed, Aug 12, 2015 at 01:03:36PM -0600, Jeff Law wrote: >> On 08/12/2015 12:57 PM, Richard Sandiford wrote: >> >Jeff Law writes: >> >>On 08/10/2015 06:05 AM, tbsaunde+gcc@tbsaunde.org wrote: >> >>>From: Trevor Saunders >> >>> >> >>>Hi, >> >>> >> >>>In many places gcc puts classes in the anon namespace so the >> >>> compiler can tell >> >>>they do not get inheritted from to enable better devirtualization. However >> >>>debugging code in the anon namespace can be a pain, and the same >> >>> thing can be >> >>>accomplished more directly by marking the classes as final. When >> >>>bootstrapping >> >>>stage 3 should always be built in C++14 mode now, and of course >> >>> will always be >> >>>newer than gcc 4.7, so these classes will always be marked as final there. >> >>>AIUI cross compilers are supposed to be built with recent gcc, >> >>> which I would >> >>>tend to think implies newer than 4.7, so they should also be built >> >>> with these >> >>>classes marked as final. I believe that means in all important cases >> >>>this works just as well as the anon namespace. >> >>> >> >>>bootstrapped + regtested on x86_64-linux-gnu, ok? >> >>> >> >>>Trev >> >>> >> >>> >> >>>gcc/ChangeLog: >> >>> >> >>>2015-08-10 Trevor Saunders >> >>> >> >>> * compare-elim.c, dce.c, dse.c, gimple-ssa-isolate-paths.c, >> >>> gimple-ssa-strength-reduction.c, graphite.c, init-regs.c, >> >>> ipa-pure-const.c, ipa-visibility.c, ipa.c, mode-switching.c, >> >>> omp-low.c, reorg.c, sanopt.c, trans-mem.c, tree-eh.c, >> >>> tree-if-conv.c, tree-ssa-copyrename.c, tree-ssa-dce.c, >> >>> tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, >> >>> tree-ssa-sink.c, tree-ssanames.c, tree-stdarg.c, tree-tailcall.c, >> >>> tree-vect-generic.c, tree.c, ubsan.c, var-tracking.c, >> >>> vtable-verify.c, web.c: Use GCC_FINAL instead of the anonymous >> >>>namespace. >> >>OK. >> > >> >I was hoping someone else was going to speak up since I seem >> >to have been posting a few negative messages recently, but I think >> >this is really a step in the wrong direction. I think the code >> >was using anonymous namespaces in exactly the way they were > > are they actually all that common? I think gcc is the only C++ with > which I'm familiar that uses them much. Yeah, fair question. I suppose working on a codebase with anonymous namespaces day-in day-out doesn't make them more common than working on the codebase for one day :-) Even if it felt that way at the time... But an internal codebase at a previous job used them. LLVM also used them quite a bit when I was looking after the SystemZ port (I assume still does). Thanks, Richard