From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32427 invoked by alias); 12 Aug 2015 18:57:41 -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 32418 invoked by uid 89); 12 Aug 2015 18:57:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.0 required=5.0 tests=AWL,BAYES_50,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (207.82.80.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Aug 2015 18:57:40 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-14-N_iISOEJTLWEQpTMhbF-Hg-1; Wed, 12 Aug 2015 19:57:34 +0100 Received: from localhost ([10.1.2.79]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 12 Aug 2015 19:57:34 +0100 From: Richard Sandiford To: Jeff Law Mail-Followup-To: Jeff Law ,tbsaunde+gcc@tbsaunde.org, gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Cc: tbsaunde+gcc@tbsaunde.org, gcc-patches@gcc.gnu.org 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> Date: Wed, 12 Aug 2015 18:57:00 -0000 In-Reply-To: <55CA4B93.3060003@redhat.com> (Jeff Law's message of "Tue, 11 Aug 2015 13:22:59 -0600") Message-ID: <87oaicbaht.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 X-MC-Unique: N_iISOEJTLWEQpTMhbF-Hg-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2015-08/txt/msg00652.txt.bz2 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 ca= n tell >> they do not get inheritted from to enable better devirtualization. Howe= ver >> debugging code in the anon namespace can be a pain, and the same thing c= an 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 alw= ays be >> newer than gcc 4.7, so these classes will always be marked as final ther= e. >> AIUI cross compilers are supposed to be built with recent gcc, which I w= ould >> 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 intended to be used. We don't want to forbid the use of "static" and instead force every file-local function and variable into the global namespace. Why should classes be any different? Anonymous clases are a commonly-used feature, so if there's a specific problem with debugging them, I think it would be better to fix gdb (or whatever) rather than work around the problem like this. Thanks, Richard