public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@arm.com>
To: Jeff Law <law@redhat.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
Date: Wed, 12 Aug 2015 18:57:00 -0000	[thread overview]
Message-ID: <87oaicbaht.fsf@e105548-lin.cambridge.arm.com> (raw)
In-Reply-To: <55CA4B93.3060003@redhat.com> (Jeff Law's message of "Tue, 11 Aug	2015 13:22:59 -0600")

Jeff Law <law@redhat.com> writes:
> On 08/10/2015 06:05 AM, tbsaunde+gcc@tbsaunde.org wrote:
>> From: Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
>>
>> 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  <tbsaunde@tbsaunde.org>
>>
>> 	* 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

  reply	other threads:[~2015-08-12 18:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 12:05 [PATCH 1/2] add GCC_FINAL to ansidecl.h tbsaunde+gcc
2015-08-10 12:06 ` [PATCH 2/2] replace several uses of the anon namespace with GCC_FINAL tbsaunde+gcc
2015-08-10 13:56   ` Markus Trippelsdorf
2015-08-10 14:45     ` Trevor Saunders
2015-08-11 19:23   ` Jeff Law
2015-08-12 18:57     ` Richard Sandiford [this message]
2015-08-12 19:03       ` Jeff Law
2015-08-12 20:36         ` Trevor Saunders
2015-08-13 17:33           ` Mikhail Maltsev
2015-08-14 22:56             ` Trevor Saunders
2015-08-13 20:23           ` Richard Sandiford
2015-08-12 23:58         ` Markus Trippelsdorf
2015-08-13  1:05           ` David Malcolm
2015-08-11 19:22 ` [PATCH 1/2] add GCC_FINAL to ansidecl.h Jeff Law
2015-08-12 19:31 [PATCH 2/2] replace several uses of the anon namespace with GCC_FINAL David Edelsohn
2015-08-12 20:30 ` Trevor Saunders
2015-08-13 11:28   ` David Edelsohn
2015-08-13 14:51   ` David Edelsohn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87oaicbaht.fsf@e105548-lin.cambridge.arm.com \
    --to=richard.sandiford@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=tbsaunde+gcc@tbsaunde.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).