Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cxx-abi-dev] Mangling of anonymous unions?


  • To: "kerch@xxxxxxxxxx" <kerch@xxxxxxxxxx>, Jason Merrill <jason@xxxxxxxxxx>
  • Subject: Re: [cxx-abi-dev] Mangling of anonymous unions?
  • From: Mark Mitchell <mark@xxxxxxxxxxxxxxxx>
  • Date: Wed, 18 Dec 2002 16:38:24 -0800



--On Wednesday, December 18, 2002 04:24:45 PM -0800 Kerch Holt <kerch@xxxxxxxxxx> wrote:

Jason Merrill wrote:
On Wed, 18 Dec 2002 15:32:04 -0800, Kerch Holt <kerch@xxxxxxxxxx> wrote:


Wouldn't you need some type of factoring of all the members of the union
(instead of first/last) to avoid collisions (of similar unions in the
same inline)?


I'm not sure what you mean.  You would mangle it like any other local
variable; if there are more than one with the same name, you need to use
a discriminator to distinguish between them.  The only question is which
name to use.

Never mind. I was concerned that two different anonymous union types
would have the same mangling, but, as you point out if the variable is
always factored in the mangling will differ.
Perhaps depending on the ordering (first, last) is problematical... are
these the same type:
union { int a; char b; }
union ( char b; int a; }

They're not the same type, but they can't both be declared in the same
scope, so we're OK.

I can never remember if a union has to have any named members.  Is:

union { int : 7; };

legal?  I think so -- but there's no way to talk about such a thing,
so I suppose its mangled name doesn't matter, but it would be nice
if we had one.

This case:

 union { union { int i; }; };

is legal, so the name-based approach needs a recursive formulation.

I think that the first name found in a pre-order, depth-first,
declaration-order walk is a reasonable choice.

--
Mark Mitchell                mark@xxxxxxxxxxxxxxxx
CodeSourcery, LLC            http://www.codesourcery.com