summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2010-12-29 14:23:59 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2010-12-29 16:13:55 +0100
commit45f954aadb8e0eb49a33dffa56b220c65947e94a (patch)
tree6db59d772882eab72fcd41b64cabf6b9e12f2085
parentc3822ca59bb81e0367431a173f069ef0b2cd52db (diff)
downloadspice-protocol-45f954aadb8e0eb49a33dffa56b220c65947e94a.tar.gz
spice-protocol-45f954aadb8e0eb49a33dffa56b220c65947e94a.tar.xz
spice-protocol-45f954aadb8e0eb49a33dffa56b220c65947e94a.zip
mingw32: specify packing alignment to 1 byte, to override -mms-bitfield
Ex: G_STRUCT_OFFSET(SpiceLinkReply, num_channel_caps) is 172 bytes when compiled with -mms-bitfield, and 170 bytes without. GLib/Gtk are compiled with -mms-bitfield, and it is necessary to compile with the same option for compatibility. The pack pragma for MINGW32 corrects the structure alignement. We could use the pack pragma for GNUC unconditionally, that could help to ensure struct binary compatibility between different compiled flavours.
-rw-r--r--spice/end-packed.h4
-rw-r--r--spice/start-packed.h4
2 files changed, 5 insertions, 3 deletions
diff --git a/spice/end-packed.h b/spice/end-packed.h
index e191737..1acea18 100644
--- a/spice/end-packed.h
+++ b/spice/end-packed.h
@@ -33,8 +33,6 @@
#undef SPICE_ATTR_PACKED
-#ifndef __GNUC__
-
+#if defined(__MINGW32__) || !defined(__GNUC__)
#pragma pack(pop)
-
#endif
diff --git a/spice/start-packed.h b/spice/start-packed.h
index 78ec7c7..ab3fa98 100644
--- a/spice/start-packed.h
+++ b/spice/start-packed.h
@@ -49,6 +49,10 @@
#define SPICE_ATTR_PACKED __attribute__ ((__packed__))
+#ifdef __MINGW32__
+#pragma pack(push,1)
+#endif
+
#else
#pragma pack(push)