[Mesa-dev] Anonymous unions (Was: [Bug 30789] mesa git fails to build)

José Fonseca jfonseca at vmware.com
Tue Oct 12 09:57:36 PDT 2010


On Tue, 2010-10-12 at 07:58 -0700, Brian Paul wrote:
> On 10/12/2010 02:06 AM, José Fonseca wrote:
> > What you guys feel about anonymous unions?
> >
> > I happened to committed some code with anonymous unions, but it caused
> > gcc to choke when -std=c99 option is specified, which is only specified
> > with automake but scons.
> >
> > After some search, it looks like anonymous unions are not part of C99,
> > but are part of C++ and will reportedly be part of C1X [1]. I think all
> > major compilers support it.
> >
> > I heard they are also often used together with bit fields to describe
> > hardware registers.
> >
> > But for this to work to gcc we need to remove -std=c99, or replace with
> > -std=gnu99, or pass -fms-extensions together with -std=c99.
> >
> > I don't care much either way. I'd just like to hear what's the general
> > opinion on this to avoid ping-ponging on this matter.
> >
> > Jose
> >
> > [1] http://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html#Unnamed-Fields
> 
> When I have a choice, I prefer to go with what is more portable.  I 
> think this is especially important for core Mesa/gallium to maximize 
> portability to new compilers/platforms.  You never know what's going 
> to come along.

On Tue, 2010-10-12 at 09:47 -0700, tom fogal wrote:
> I'd vote against it.  I remember hitting an issue porting some of my
> own code that used anonymous unions.  Further, a downstream app I work
> on needs to support AIX's native build environment; I haven't checked,
> but that toolchain always gives me grief && so I doubt it supports
> anonymous unions.

OK. It's gone now.

Brian, Tom, thanks for the feedback.

Jose



More information about the mesa-dev mailing list