pushpack1.h 807 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // may be included multiple times - sets structure packing to 1
  2. // for all supported compilers. A poppack1.h include must follow
  3. // each inclusion of this header.
  4. /*
  5. PACK_STRUCT must follow each structure declaration:
  6. struct X
  7. {
  8. } PACK_STRUCT;
  9. */
  10. //
  11. #ifdef AI_PUSHPACK_IS_DEFINED
  12. # error poppack1.h must be included after pushpack1.h
  13. #endif
  14. #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
  15. # pragma pack(push,1)
  16. # define PACK_STRUCT
  17. #elif defined( __GNUC__ )
  18. # define PACK_STRUCT __attribute__((packed))
  19. #else
  20. # error Compiler not supported
  21. #endif
  22. #if defined(_MSC_VER)
  23. // packing was changed after the inclusion of the header, propably missing #pragma pop
  24. # pragma warning (disable : 4103)
  25. #endif
  26. #define AI_PUSHPACK_IS_DEFINED