104 # pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data |
104 # pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', possible loss of data |
105 # pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied |
105 # pragma warning(disable: 4761) // integral size mismatch in argument : conversion supplied |
106 # if _MSC_VER < 1300 // MSVC 6 borkdness |
106 # if _MSC_VER < 1300 // MSVC 6 borkdness |
107 # pragma warning(disable: 4018) // 'expression' : signed/unsigned mismatch |
107 # pragma warning(disable: 4018) // 'expression' : signed/unsigned mismatch |
108 # pragma warning(disable: 4305) // 'identifier' : truncation from 'type1' to 'type2' |
108 # pragma warning(disable: 4305) // 'identifier' : truncation from 'type1' to 'type2' |
|
109 # pragma warning(disable: 4786) // 'identifier' : identifier was truncated to '255' characters in the browser information |
109 # endif /* _MSC_VER < 1300 */ |
110 # endif /* _MSC_VER < 1300 */ |
110 # if _MSC_VER >= 1400 // MSVC 2005 safety checks |
111 # if _MSC_VER >= 1400 // MSVC 2005 safety checks |
111 # pragma warning(disable: 4996) // 'strdup' was declared deprecated |
112 # pragma warning(disable: 4996) // 'strdup' was declared deprecated |
112 # define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions |
113 # define _CRT_SECURE_NO_DEPRECATE // all deprecated 'unsafe string functions |
113 # pragma comment(linker, "/NODEFAULTLIB:LIBC.LIB") |
114 # pragma comment(linker, "/NODEFAULTLIB:LIBC.LIB") |
153 # define ZLIB_WINAPI |
154 # define ZLIB_WINAPI |
154 # endif |
155 # endif |
155 # endif |
156 # endif |
156 |
157 |
157 # define strcasecmp stricmp |
158 # define strcasecmp stricmp |
|
159 // suppress: warning C4005: 'offsetof' : macro redefinition (VC8) |
|
160 # include <stddef.h> |
158 #endif /* defined(_MSC_VER) */ |
161 #endif /* defined(_MSC_VER) */ |
159 |
162 |
160 |
163 |
161 // Windows has always LITTLE_ENDIAN |
164 // Windows has always LITTLE_ENDIAN |
162 #if defined(WIN32) || defined(__OS2__) || defined(WIN64) |
165 #if defined(WIN32) || defined(__OS2__) || defined(WIN64) |
163 # define TTD_LITTLE_ENDIAN |
166 # define TTD_LITTLE_ENDIAN |
164 #else |
167 #else |
165 // Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile |
168 // Else include endian[target/host].h, which has the endian-type, autodetected by the Makefile |
166 # if defined(STRGEN) |
169 # if defined(STRGEN) || defined(UNITTEST) |
167 # include "endian_host.h" |
170 # include "endian_host.h" |
168 # else |
171 # else |
169 # include "endian_target.h" |
172 # include "endian_target.h" |
170 # endif |
173 # endif |
171 #endif /* WIN32 || __OS2__ || WIN64 */ |
174 #endif /* WIN32 || __OS2__ || WIN64 */ |
191 #if defined(__QNXNTO__) |
194 #if defined(__QNXNTO__) |
192 typedef unsigned int uint; |
195 typedef unsigned int uint; |
193 #endif |
196 #endif |
194 |
197 |
195 #ifndef __BEOS__ |
198 #ifndef __BEOS__ |
196 typedef signed char int8; |
199 |
197 typedef signed short int16; |
200 // some platforms use 4 bytes bool in C++ |
198 typedef signed int int32; |
201 // C bool has to be the same |
199 # ifndef __cplusplus |
202 # ifndef __cplusplus |
200 typedef unsigned char bool; |
203 # ifdef FOUR_BYTE_BOOL |
201 # endif |
204 typedef unsigned long bool; |
202 typedef signed __int64 int64; |
205 # else /* FOUR_BYTE_BOOL */ |
203 typedef unsigned __int64 uint64; |
206 typedef unsigned char bool; |
|
207 # endif /* FOUR_BYTE_BOOL */ |
|
208 # endif /* __cplusplus */ |
|
209 |
|
210 typedef signed char int8; |
|
211 typedef signed short int16; |
|
212 typedef signed int int32; |
|
213 typedef signed __int64 int64; |
|
214 typedef unsigned __int64 uint64; |
204 #endif /* __BEOS__ */ |
215 #endif /* __BEOS__ */ |
205 |
216 |
206 #if defined(ARM) || defined(__arm__) || defined(__alpha__) |
217 #if defined(ARM) || defined(__arm__) || defined(__alpha__) |
207 # define OTTD_ALIGNMENT |
218 # define OTTD_ALIGNMENT |
208 #endif |
219 #endif |
251 |
262 |
252 // Compile time assertions |
263 // Compile time assertions |
253 #ifdef __OS2__ |
264 #ifdef __OS2__ |
254 # define assert_compile(expr) |
265 # define assert_compile(expr) |
255 #else |
266 #else |
256 # define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)]) |
267 # ifdef __cplusplus |
257 #endif |
268 # define assert_compile(expr) extern "C" void __ct_assert__(int a[1 - 2 * !(expr)]) |
|
269 # else /* __cplusplus */ |
|
270 # define assert_compile(expr) void __ct_assert__(int a[1 - 2 * !(expr)]) |
|
271 # endif /* !__cplusplus */ |
|
272 #endif /* __OS2__ */ |
258 |
273 |
259 assert_compile(sizeof(uint32) == 4); |
274 assert_compile(sizeof(uint32) == 4); |
260 assert_compile(sizeof(uint16) == 2); |
275 assert_compile(sizeof(uint16) == 2); |
261 assert_compile(sizeof(uint8) == 1); |
276 assert_compile(sizeof(uint8) == 1); |
262 |
277 |
279 #ifdef __AMIGA__ |
294 #ifdef __AMIGA__ |
280 // it seems AmigaOS already have a Point declared |
295 // it seems AmigaOS already have a Point declared |
281 # define Point OTTD_AMIGA_POINT |
296 # define Point OTTD_AMIGA_POINT |
282 #endif |
297 #endif |
283 |
298 |
|
299 #define EXTERN_C_BEGIN extern "C" { |
|
300 #define EXTERN_C_END } |
|
301 |
|
302 |
|
303 // workaround for VC6 bug: Error C2258 and error C2252 occur if you try |
|
304 // to perform in-place initialization of static const integral member |
|
305 // data in Visual C++ (see http://support.microsoft.com/kb/241569/) |
|
306 #if defined(_MSC_VER) && (_MSC_VER < 1300) |
|
307 # define ST_CONST(type, name_val) enum {name_val}; |
|
308 #else |
|
309 # define ST_CONST(type, name_val) static const type name_val; |
|
310 #endif |
|
311 |
|
312 |
284 #endif /* STDAFX_H */ |
313 #endif /* STDAFX_H */ |