This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++] PATCH to give the anonymous namespace a null DECL_NAME
On Mon, 8 Dec 2003 17:54:24 -0800, Geoff Keating <geoffk@geoffk.org> wrote:
>> From: Gabriel Dos Reis <gdr@integrable-solutions.net>
>> Date: 09 Dec 2003 02:31:59 +0100
>
>> Geoff Keating <geoffk@geoffk.org> writes:
>>
>> | Jason Merrill <jason@redhat.com> writes:
>> |
>> | > Dan Berlin recently submitted a patch to dwarf2out.c for namespace support,
>> | > which would avoid giving the anonymous namespace a name attribute by
>> | > exporting anonymous_namespace_name to language-independent code. I thought
>> | > it would be cleaner to just give the anonymous namespace a null DECL_NAME;
>> | > this patch implements that. The name for use in mangling is assigned to
>> | > DECL_ASSEMBLER_NAME instead.
>> | >
>> | > Tested x86_64-pc-linux-gnu, held off pending Mark's approval for the
>> | > accompanying dwarf2out.c patch.
>> |
>> | Could you give the NULL in this case a different name (that is, use
>> | ANONYMOUS_NAMESPACE rather than NULL_TREE)?
>>
>> Why? What does it buy?
>
> It means you can grep for ANONYMOUS_NAMESPACE to find all the places
> where a piece of code is working with anonymous namespaces.
The only places I changed were in pretty-printing code.
>[...]
> However, with IMA you can have both of these declarations at once, so
> long as they're in different translation units. It will be useful to
> be able to tell which anonymous namespace is being referred to.
They'll be different decls. And they'll have different ASSEMBLER_NAMEs.
Jason