<div dir="ltr">On 21 September 2013 09:03, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">On 09/21/2013 07:59 AM, Brian Paul wrote:<br>
> On Fri, Sep 20, 2013 at 7:52 PM, Eric Anholt <<a href="mailto:eric@anholt.net">eric@anholt.net</a>> wrote:<br>
>> Since it's only used for debug information, we can misalign the struct and<br>
>> save the disk space.  Another 19k on a 64-bit build.<br>
>> ---<br>
>>  src/mapi/glapi/gen/gl_enums.py | 6 ++++--<br>
>>  1 file changed, 4 insertions(+), 2 deletions(-)<br>
>><br>
>> diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py<br>
>> index e1ab600..6f54b06 100644<br>
>> --- a/src/mapi/glapi/gen/gl_enums.py<br>
>> +++ b/src/mapi/glapi/gen/gl_enums.py<br>
>> @@ -47,8 +47,8 @@ class PrintGlEnums(gl_XML.gl_print_base):<br>
>>          print '#include "main/imports.h"'<br>
>>          print '#include "main/mtypes.h"'<br>
>>          print ''<br>
>> -        print 'typedef struct {'<br>
>> -        print '   size_t offset;'<br>
>> +        print 'typedef struct __attribute__((__packed__)) {'<br>
><br>
> I don't know if that'll work with MSVC. To be safe, we should probably<br>
> wrap that in a #ifdef gcc test.<br>
><br>
> -Brian<br>
<br>
</div>Good catch - that doesn't work on MSVC.<br>
<br>
Apparently on MSVC you do:<br>
#pragma pack(push,1)<br>
...<br>
#pragma pack(pop)<br>
<br>
Clang apparently supports either method.<br>
<br>
Is it supposed to be __attribute__((__packed__)) or<br>
__attribute__((packed))?  I see both floating around the internet.<br></blockquote><div><br></div><div>GCC docs (<a href="http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html#Type-Attributes">http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html#Type-Attributes</a>) 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".<br>
</div></div></div></div>