MSVC Builds: Support PACKED

Define PACKED for Visual Studio builds, so that we can try to reduce
our library size for Visual Studio builds.  Add a ENDPACKED macro
that is currently defined only for Visual Studio builds as packing is
done via __pragma(pack(push,n), that should be popped when done.

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
macos/v1.5.9
Chun-wei Fan 10 years ago committed by Emmanuele Bassi
parent 6b68ddeaa0
commit 3a38371367
  1. 5
      src/dispatch_common.h
  2. 2
      src/gen_dispatch.py

@ -68,8 +68,13 @@
#if defined(__GNUC__)
#define PACKED __attribute__((__packed__))
#define ENDPACKED
#elif defined (_MSC_VER)
#define PACKED __pragma(pack(push,1))
#define ENDPACKED __pragma(pack(pop))
#else
#define PACKED
#define ENDPACKED
#endif
/* On win32, we're going to need to keep a per-thread dispatch table,

@ -628,6 +628,7 @@ class Generator(object):
# Writes the enum declaration for the list of providers
# supported by gl_provider_resolver()
self.outln('')
self.outln('enum {0}_provider {{'.format(self.target))
sorted_providers = sorted(self.provider_enum.keys())
@ -640,6 +641,7 @@ class Generator(object):
enum = self.provider_enum[human_name]
self.outln(' {0},'.format(enum))
self.outln('} PACKED;')
self.outln('ENDPACKED')
self.outln('')
def write_provider_enum_strings(self):

Loading…
Cancel
Save