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: Jason Merrill <jason@xxxxxxxxxx>
  • Subject: Re: [cxx-abi-dev] Mangling of anonymous unions?
  • From: Kerch Holt <kerch@xxxxxxxxxx>
  • Date: Wed, 18 Dec 2002 15:32:04 -0800

Jason Merrill wrote:
On Wed, 18 Dec 2002 15:54:30 -0500, Jason Merrill <jason@xxxxxxxxxx> wrote:


I just noticed that the ABI doesn't define a mangling for anonymous
unions.  This is only really relevant for static local anonymous unions in
inline functions; all others are private to a translation unit.

The choices would seem to be:

1) Use the name of the first member.
2) Use the name of the largest member.
3) Treat them like string literals, perhaps using 'u' instead of 's'.

g++ currently does #2.  But it also fails to allocate space for such a
union (q.v. g++.brendan/union1.C), so there's no binary compatibility issue
in choosing a different answer.

My order of preference is 3, 1, 2.  And yes, I'm volunteering to fix g++.


After working on this for a bit, I like #3 much less; it doesn't work very
well for namespace-scope unions, which we might as well mangle the same
way.

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)?

BTW HP C++ is slightly broken WRT this feature -- so changing to meet
some other spec wouldn't cause too much pain.

--
Kerch Holt
HP Cupertino Language & Tools Lab