miniassimp

view 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 source
3 // ===============================================================================
4 // May be included multiple times - sets structure packing to 1
5 // for all supported compilers. #include <poppack1.h> reverts the changes.
6 //
7 // Currently this works on the following compilers:
8 // MSVC 7,8,9
9 // GCC
10 // BORLAND (complains about 'pack state changed but not reverted', but works)
11 // Clang
12 //
13 //
14 // USAGE:
15 //
16 // struct StructToBePacked {
17 // } PACK_STRUCT;
18 //
19 // ===============================================================================
21 #ifdef AI_PUSHPACK_IS_DEFINED
22 # error poppack1.h must be included after pushpack1.h
23 #endif
25 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
26 # pragma pack(push,1)
27 # define PACK_STRUCT
28 #elif defined( __GNUC__ ) || defined(__clang__)
29 # if !defined(HOST_MINGW)
30 # define PACK_STRUCT __attribute__((__packed__))
31 # else
32 # define PACK_STRUCT __attribute__((gcc_struct, __packed__))
33 # endif
34 #else
35 # error Compiler not supported
36 #endif
38 #if defined(_MSC_VER)
39 // C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop
40 # pragma warning (disable : 4103)
41 #endif
43 #define AI_PUSHPACK_IS_DEFINED