summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2012-02-19 23:11:53 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2012-02-23 19:03:25 +0100
commit5e55cc27b20bf8c00f0a85b94b615b13e528932c (patch)
treea879cbb275623f58a02745a39f758b17d5edfe67 /common
parent89422a3a417fc134b64de59b4a3434a4453c6cdb (diff)
mingw: use gcc attributes for struct packing
It automatically chooses between using the gcc construct or the visual-c++ construct at compile-time.
Diffstat (limited to 'common')
-rw-r--r--common/vdcommon.h12
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;