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

Brian Paul brianp at vmware.com
Tue Oct 12 07:58:08 PDT 2010

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.


More information about the mesa-dev mailing list