shithub: choc

Download patch

ref: b37418d89a373dfc99437cbceff252e1aef12d82
parent: a713167fcf34253837deacda5de2b3de4b30ca1b
parent: 0334e6564e30ceccef7b1f1141674eed69359233
author: Mike Swanson <mikeonthecomputer@gmail.com>
date: Tue Dec 10 21:23:37 EST 2019

Merge pull request #1229 from chocolate-doom/msc-packed

fix packed attribute for structs when compiling with MSVC

--- 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