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

José Fonseca jfonseca at vmware.com
Tue Oct 12 01:06:29 PDT 2010

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.


[1] http://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html#Unnamed-Fields

More information about the mesa-dev mailing list