[Mesa-dev] [PATCH 3/7] mesa: Shrink the size of the enum string lookup struct.
Paul Berry
stereotype441 at gmail.com
Sat Sep 21 11:14:39 PDT 2013
On 21 September 2013 09:03, Kenneth Graunke <kenneth at whitecape.org> wrote:
> On 09/21/2013 07:59 AM, Brian Paul wrote:
> > On Fri, Sep 20, 2013 at 7:52 PM, Eric Anholt <eric at 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".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130921/eef15ad7/attachment.html>
More information about the mesa-dev
mailing list