On Fri, Feb 21, 2014 at 2:25 PM, Kenneth Graunke <kenn...@whitecape.org> wrote: > Generally, I only use PACKED when something -relies- on a particular > memory layout. Is it really worth second guessing the compiler here? > Presumably it had a reason for choosing a larger size other than sheer > stupidity...
We're not second guessing the compiler. The C99 spec says the type of an enum is implementation defined. Adding __attribute__((__packed__)) to an enum has the same behavior as gcc's -fshort-enum flag, but the flag would obviously cover all enums. The gcc non-bugs page [0] says that they don't want to make -fshort-enums the default because of [ABI] incompatibilities with other compilers. They suggest setting a field width of the enum in a struct, but in general that seems prone to errors (e.g., adding a 256th value to an enum, but having specified an 8-bit field width on the enum field) that using packed wouldn't have. Since we aren't likely to hit that, would you rather me just set a field width? [0] http://gcc.gnu.org/onlinedocs/gcc/Non-bugs.html#index-fshort-enums-3868 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev