On 21 September 2013 09:03, Kenneth Graunke <kenn...@whitecape.org> wrote:
> On 09/21/2013 07:59 AM, Brian Paul wrote: > > On Fri, Sep 20, 2013 at 7:52 PM, Eric Anholt <e...@anholt.net> wrote: > >> Since it's only used for debug information, we can misalign the struct > and > >> save the disk space. Another 19k on a 64-bit build. > >> --- > >> src/mapi/glapi/gen/gl_enums.py | 6 ++++-- > >> 1 file changed, 4 insertions(+), 2 deletions(-) > >> > >> diff --git a/src/mapi/glapi/gen/gl_enums.py > b/src/mapi/glapi/gen/gl_enums.py > >> index e1ab600..6f54b06 100644 > >> --- a/src/mapi/glapi/gen/gl_enums.py > >> +++ b/src/mapi/glapi/gen/gl_enums.py > >> @@ -47,8 +47,8 @@ class PrintGlEnums(gl_XML.gl_print_base): > >> print '#include "main/imports.h"' > >> print '#include "main/mtypes.h"' > >> print '' > >> - print 'typedef struct {' > >> - print ' size_t offset;' > >> + print 'typedef struct __attribute__((__packed__)) {' > > > > I don't know if that'll work with MSVC. To be safe, we should probably > > wrap that in a #ifdef gcc test. > > > > -Brian > > Good catch - that doesn't work on MSVC. > > Apparently on MSVC you do: > #pragma pack(push,1) > ... > #pragma pack(pop) > > Clang apparently supports either method. > > Is it supposed to be __attribute__((__packed__)) or > __attribute__((packed))? I see both floating around the internet. > GCC docs ( http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html#Type-Attributes) indicate that either "__packed__" or "packed" is allowed. I don't think it matters in our case--the rationale for using "__packed__" is if you're worried about conflicts with a preprocessor macro called "packed".
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev