foxygit / doom Log in
commit 0334e6564e30ceccef7b1f1141674eed69359233
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Tue Dec 10 12:50:51 2019 +0100
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Tue Dec 10 12:50:51 2019 +0100

    fix packed attribute for structs when compiling with MSVC

    Thanks @drfrag666 for confirming this fix.
---
 src/doomtype.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/doomtype.h b/src/doomtype.h
index 8841a0cf..9947a070 100644
--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -69,8 +69,12 @@
 #define PRINTF_ARG_ATTR(x) __attribute__((format_arg(x)))
 #define NORETURN __attribute__((noreturn))

+#else
+#if defined(_MSC_VER)
+#define PACKEDATTR __pragma(pack(pop))
 #else
 #define PACKEDATTR
+#endif
 #define PRINTF_ATTR(fmt, first)
 #define PRINTF_ARG_ATTR(x)
 #define NORETURN
@@ -78,6 +82,8 @@

 #ifdef __WATCOMC__
 #define PACKEDPREFIX _Packed
+#elif defined(_MSC_VER)
+#define PACKEDPREFIX __pragma(pack(push,1))
 #else
 #define PACKEDPREFIX
 #endif