public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* What to do with the transparent_union attribute
@ 2005-01-24 14:23 Steven Bosscher
  2005-01-24 14:23 ` Andrew Pinski
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Bosscher @ 2005-01-24 14:23 UTC (permalink / raw)
  To: gcc

Hi,

While browsing tree.h I noticed DECL_TRANSPARENT_UNION, and I didn't
know what it was so I grepped for it a bit.

The only users are function.c and c-common.c, to handle an attribute
called `transparent_union'.  The purpose of the attribute is to
change the argument passing conventions for objects of the type of
the union.  Instead of the normal union argument passing conventions,
unions with the `transparent_union' attribute are passed as if the
object has the type of the first field of the union.

Apart from being a dangerous attribute, it also seems this attribute
has no test cases in the test suite.  The only test that uses the
attribute is gcc.c-torture/compile/960201-1.c, but that test doesn't
check if the attribute has the desired effect.

Furthermore, the attribute has not had any modifications to it since
1996 ("Fri Feb 16 20:13:23 1996  Paul Eggert  <eggert@twinsun.com>"),
the only other changes to the related flags and checks were to add
tree checking, table driven attribute handling, and pretty printing.

So I was thinking, should we keep this attribute, or can it perhaps
be deprecated for GCC 4.0 and removed in 4.1?  Or is this attribute
still useful?

Gr.
Steven

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What to do with the transparent_union attribute
  2005-01-24 14:23 What to do with the transparent_union attribute Steven Bosscher
@ 2005-01-24 14:23 ` Andrew Pinski
  2005-01-24 14:58   ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2005-01-24 14:23 UTC (permalink / raw)
  To: Steven Bosscher; +Cc: gcc


On Jan 24, 2005, at 9:08 AM, Steven Bosscher wrote:

> Hi,
>
> So I was thinking, should we keep this attribute, or can it perhaps
> be deprecated for GCC 4.0 and removed in 4.1?  Or is this attribute
> still useful?

This attribute is useful it is used all over glibc.

-- Pinski

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What to do with the transparent_union attribute
  2005-01-24 14:23 ` Andrew Pinski
@ 2005-01-24 14:58   ` Daniel Jacobowitz
  2005-01-24 15:43     ` Andrew Pinski
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2005-01-24 14:58 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Steven Bosscher, gcc

On Mon, Jan 24, 2005 at 09:09:16AM -0500, Andrew Pinski wrote:
> 
> On Jan 24, 2005, at 9:08 AM, Steven Bosscher wrote:
> 
> >Hi,
> >
> >So I was thinking, should we keep this attribute, or can it perhaps
> >be deprecated for GCC 4.0 and removed in 4.1?  Or is this attribute
> >still useful?
> 
> This attribute is useful it is used all over glibc.

Where "all over" is defined as "in four places, but they're all in
installed headers".

./posix/sys/wait.h:  } __WAIT_STATUS __attribute__ ((__transparent_union__));
./socket/sys/socket.h:        } __SOCKADDR_ARG __attribute__ ((__transparent_union__));
./socket/sys/socket.h:        } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
./stdlib/stdlib.h:  } __WAIT_STATUS __attribute__ ((__transparent_union__));

It appears that glibc uses this as a hack to allow redefinitions with
any union member to be accepted.  Does that still work?  I have no
idea.  Deprecating the extension eventually might be goodness, but it
will have to wait a long long time.

-- 
Daniel Jacobowitz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: What to do with the transparent_union attribute
  2005-01-24 14:58   ` Daniel Jacobowitz
@ 2005-01-24 15:43     ` Andrew Pinski
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Pinski @ 2005-01-24 15:43 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gcc, Steven Bosscher


On Jan 24, 2005, at 9:20 AM, Daniel Jacobowitz wrote:

> On Mon, Jan 24, 2005 at 09:09:16AM -0500, Andrew Pinski wrote:
>>
>> On Jan 24, 2005, at 9:08 AM, Steven Bosscher wrote:
>>
>>> Hi,
>>>
>>> So I was thinking, should we keep this attribute, or can it perhaps
>>> be deprecated for GCC 4.0 and removed in 4.1?  Or is this attribute
>>> still useful?
>>
>> This attribute is useful it is used all over glibc.
>
> Where "all over" is defined as "in four places, but they're all in
> installed headers".
>
> It appears that glibc uses this as a hack to allow redefinitions with
> any union member to be accepted.  Does that still work?  I have no
> idea.  Deprecating the extension eventually might be goodness, but it
> will have to wait a long long time.

Well considering wait is just a lot in different places and there
have been no reports of it not working I assume it still works.

-- Pinski

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-01-24 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-24 14:23 What to do with the transparent_union attribute Steven Bosscher
2005-01-24 14:23 ` Andrew Pinski
2005-01-24 14:58   ` Daniel Jacobowitz
2005-01-24 15:43     ` Andrew Pinski

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