What to do with the transparent_union attribute

Daniel Jacobowitz drow@false.org
Mon Jan 24 14:58:00 GMT 2005


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



More information about the Gcc mailing list