[Spice-devel] [PATCH 04/20] mingw: use gcc attributes for struct packing
Christophe Fergeau
cfergeau at redhat.com
Thu Mar 1 02:17:38 PST 2012
It automatically chooses between using the gcc construct or the
visual-c++ construct at compile-time.
---
common/vdcommon.h | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/common/vdcommon.h b/common/vdcommon.h
index edcfa1e..c5268f4 100644
--- a/common/vdcommon.h
+++ b/common/vdcommon.h
@@ -45,12 +45,20 @@ enum {
VD_AGENT_SESSION_LOGON,
};
-typedef __declspec (align(1)) struct VDPipeMessage {
+#if defined __GNUC__
+#define ALIGN_GCC __attribute__ ((packed))
+#define ALIGN_VC
+#else
+#define ALIGN_GCC
+#define ALIGN_VC __declspec (align(1))
+#endif
+
+typedef struct ALIGN_VC VDPipeMessage {
uint32_t type;
uint32_t opaque;
uint32_t size;
uint8_t data[0];
-} VDPipeMessage;
+} ALIGN_GCC VDPipeMessage;
typedef struct VDPipeBuffer {
OVERLAPPED overlap;
--
1.7.7.6
More information about the Spice-devel
mailing list