shithub: choc

Download patch

ref: 0334e6564e30ceccef7b1f1141674eed69359233
parent: fe9a6a864d1a3f34ae7dbecf803fb6803c7d8ae7
author: Fabian Greffrath <fabian@greffrath.com>
date: Tue Dec 10 07:50:51 EST 2019

fix packed attribute for structs when compiling with MSVC

Thanks @drfrag666 for confirming this fix.

--- a/src/doomtype.h
+++ b/src/doomtype.h
@@ -70,7 +70,11 @@
 #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