miniassimp

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