nuclear@0: nuclear@0: nuclear@0: // =============================================================================== nuclear@0: // May be included multiple times - sets structure packing to 1 nuclear@0: // for all supported compilers. #include reverts the changes. nuclear@0: // nuclear@0: // Currently this works on the following compilers: nuclear@0: // MSVC 7,8,9 nuclear@0: // GCC nuclear@0: // BORLAND (complains about 'pack state changed but not reverted', but works) nuclear@0: // Clang nuclear@0: // nuclear@0: // nuclear@0: // USAGE: nuclear@0: // nuclear@0: // struct StructToBePacked { nuclear@0: // } PACK_STRUCT; nuclear@0: // nuclear@0: // =============================================================================== nuclear@0: nuclear@0: #ifdef AI_PUSHPACK_IS_DEFINED nuclear@0: # error poppack1.h must be included after pushpack1.h nuclear@0: #endif nuclear@0: nuclear@0: #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__) nuclear@0: # pragma pack(push,1) nuclear@0: # define PACK_STRUCT nuclear@0: #elif defined( __GNUC__ ) || defined(__clang__) nuclear@0: # if !defined(HOST_MINGW) nuclear@0: # define PACK_STRUCT __attribute__((__packed__)) nuclear@0: # else nuclear@0: # define PACK_STRUCT __attribute__((gcc_struct, __packed__)) nuclear@0: # endif nuclear@0: #else nuclear@0: # error Compiler not supported nuclear@0: #endif nuclear@0: nuclear@0: #if defined(_MSC_VER) nuclear@0: // C4103: Packing was changed after the inclusion of the header, probably missing #pragma pop nuclear@0: # pragma warning (disable : 4103) nuclear@0: #endif nuclear@0: nuclear@0: #define AI_PUSHPACK_IS_DEFINED