miniassimp
diff include/miniassimp/Compiler/pushpack1.h @ 0:879c81d94345
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 28 Jan 2019 18:19:26 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/include/miniassimp/Compiler/pushpack1.h Mon Jan 28 18:19:26 2019 +0200 1.3 @@ -0,0 +1,43 @@ 1.4 + 1.5 + 1.6 +// =============================================================================== 1.7 +// May be included multiple times - sets structure packing to 1 1.8 +// for all supported compilers. #include <poppack1.h> reverts the changes. 1.9 +// 1.10 +// Currently this works on the following compilers: 1.11 +// MSVC 7,8,9 1.12 +// GCC 1.13 +// BORLAND (complains about 'pack state changed but not reverted', but works) 1.14 +// Clang 1.15 +// 1.16 +// 1.17 +// USAGE: 1.18 +// 1.19 +// struct StructToBePacked { 1.20 +// } PACK_STRUCT; 1.21 +// 1.22 +// =============================================================================== 1.23 + 1.24 +#ifdef AI_PUSHPACK_IS_DEFINED 1.25 +# error poppack1.h must be included after pushpack1.h 1.26 +#endif 1.27 + 1.28 +#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) 1.29 +# pragma pack(push,1) 1.30 +# define PACK_STRUCT 1.31 +#elif defined( __GNUC__ ) || defined(__clang__) 1.32 +# if !defined(HOST_MINGW) 1.33 +# define PACK_STRUCT __attribute__((__packed__)) 1.34 +# else 1.35 +# define PACK_STRUCT __attribute__((gcc_struct, __packed__)) 1.36 +# endif 1.37 +#else 1.38 +# error Compiler not supported 1.39 +#endif 1.40 + 1.41 +#if defined(_MSC_VER) 1.42 +// C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop 1.43 +# pragma warning (disable : 4103) 1.44 +#endif 1.45 + 1.46 +#define AI_PUSHPACK_IS_DEFINED