]> git.lizzy.rs Git - irrlicht.git/blob - include/irrpack.h
Delete lots of unused features (#48)
[irrlicht.git] / include / irrpack.h
1 // Copyright (C) 2007-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 // include this file right before the data structures to be 1-aligned\r
6 // and add to each structure the PACK_STRUCT define just like this:\r
7 // struct mystruct\r
8 // {\r
9 //      ...\r
10 // } PACK_STRUCT;\r
11 // Always include the irrunpack.h file right after the last type declared\r
12 // like this, and do not put any other types with different alignment\r
13 // in between!\r
14 \r
15 // byte-align structures\r
16 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)\r
17 #       pragma warning(disable: 4103)\r
18 #       pragma pack( push, packing )\r
19 #       pragma pack( 1 )\r
20 #       define PACK_STRUCT\r
21 #elif defined( __DMC__ )\r
22 #       pragma pack( push, 1 )\r
23 #       define PACK_STRUCT\r
24 #elif defined( __GNUC__ )\r
25         // Using pragma pack might work with earlier gcc versions already, but\r
26         // it started to be necessary with gcc 4.7 on mingw unless compiled with -mno-ms-bitfields.\r
27         // And I found some hints on the web that older gcc versions on the other hand had sometimes\r
28         // trouble with pragma pack while they worked with __attribute__((packed)).\r
29 #       if (__GNUC__ > 4 ) || ((__GNUC__ == 4 ) && (__GNUC_MINOR__ >= 7))\r
30 #               pragma pack( push, packing )\r
31 #               pragma pack( 1 )\r
32 #               define PACK_STRUCT\r
33 #       else\r
34 #               define PACK_STRUCT      __attribute__((packed))\r
35         #endif\r
36 #else\r
37 #       error compiler not supported\r
38 #endif\r
39 \r