Subversion Repositories QNX 8.QNX8 IFS tool

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
26 pmbaty 1
/* ACC -- Automatic Compiler Configuration
2
 
3
   Copyright (C) 1996-2004 Markus Franz Xaver Johannes Oberhumer
4
   All Rights Reserved.
5
 
6
   This software is a copyrighted work licensed under the terms of
7
   the GNU General Public License. Please consult the file "ACC_LICENSE"
8
   for details.
9
 
10
   Markus F.X.J. Oberhumer
11
   <markus@oberhumer.com>
12
   http://www.oberhumer.com/
13
 */
14
 
15
 
16
/*************************************************************************
17
//
18
**************************************************************************/
19
 
20
#if !defined(ACCCHK_ASSERT)
21
#  define ACCCHK_ASSERT(expr)   ACC_COMPILE_TIME_ASSERT(expr)
22
#endif
23
 
24
/* compile-time sign */
25
#if !defined(ACCCHK_ASSERT_SIGN_T)
26
#  define ACCCHK_ASSERT_SIGN_T(type,relop) \
27
        ACCCHK_ASSERT( (type) (-1)       relop  (type) 0 ) \
28
        ACCCHK_ASSERT( (type) (~(type)0) relop  (type) 0 ) \
29
        ACCCHK_ASSERT( (type) (~(type)0) ==     (type) (-1) )
30
#endif
31
 
32
#if !defined(ACCCHK_IS_SIGNED_T)
33
#  define ACCCHK_ASSERT_IS_SIGNED_T(type)       ACCCHK_ASSERT_SIGN_T(type,<)
34
#endif
35
 
36
#if !defined(ACCCHK_IS_UNSIGNED_T)
37
#  if (ACC_BROKEN_INTEGRAL_PROMOTION)
38
#    define ACCCHK_ASSERT_IS_UNSIGNED_T(type) \
39
        ACCCHK_ASSERT( (type) (-1) > (type) 0 )
40
#  else
41
#    define ACCCHK_ASSERT_IS_UNSIGNED_T(type)   ACCCHK_ASSERT_SIGN_T(type,>)
42
#  endif
43
#endif
44
 
45
 
46
/*************************************************************************
47
// check preprocessor
48
**************************************************************************/
49
 
50
#if (ACC_0xffffffffL - ACC_UINT32L_C(4294967294) != 1)
51
#  error "preprocessor error 1"
52
#endif
53
#if (ACC_0xffffffffL - ACC_UINT32L_C(0xfffffffd) != 2)
54
#  error "preprocessor error 2"
55
#endif
56
 
57
 
58
#define ACCCHK_VAL  1
59
#define ACCCHK_TMP1 ACCCHK_VAL
60
#undef ACCCHK_VAL
61
#define ACCCHK_VAL  2
62
#define ACCCHK_TMP2 ACCCHK_VAL
63
#if (ACCCHK_TMP1 != 2)
64
#  error "preprocessor error 3a"
65
#endif
66
#if (ACCCHK_TMP2 != 2)
67
#  error "preprocessor error 3b"
68
#endif
69
#undef ACCCHK_VAL
70
#if (ACCCHK_TMP2)
71
#  error "preprocessor error 3c"
72
#endif
73
#if (ACCCHK_TMP2 + 0 != 0)
74
#  error "preprocessor error 3d"
75
#endif
76
#undef ACCCHK_TMP1
77
#undef ACCCHK_TMP2
78
 
79
 
80
/*************************************************************************
81
// check basic arithmetics
82
**************************************************************************/
83
 
84
    ACCCHK_ASSERT(1 == 1)
85
 
86
    ACCCHK_ASSERT(__ACC_INT_MAX(2) == 1)
87
    ACCCHK_ASSERT(__ACC_INT_MAX(8) == 127)
88
    ACCCHK_ASSERT(__ACC_INT_MAX(16) == 32767)
89
 
90
    ACCCHK_ASSERT(__ACC_UINT_MAX(2) == 3)
91
    ACCCHK_ASSERT(__ACC_UINT_MAX(16) == 0xffffU)
92
    ACCCHK_ASSERT(__ACC_UINT_MAX(32) == 0xffffffffUL)
93
#if !defined(ACC_BROKEN_INTEGRAL_PROMOTION)
94
    ACCCHK_ASSERT(__ACC_UINT_MAX(__ACC_INT_BIT) == ~(0u))
95
    ACCCHK_ASSERT(__ACC_UINT_MAX(__ACC_LONG_BIT) == ~(0ul))
96
#endif
97
 
98
 
99
/*************************************************************************
100
// check basic types
101
**************************************************************************/
102
 
103
    ACCCHK_ASSERT_IS_SIGNED_T(signed char)
104
    ACCCHK_ASSERT_IS_UNSIGNED_T(unsigned char)
105
    ACCCHK_ASSERT(sizeof(signed char) == sizeof(char))
106
    ACCCHK_ASSERT(sizeof(unsigned char) == sizeof(char))
107
    ACCCHK_ASSERT(sizeof(char) == 1)
108
#if (ACC_CC_CILLY)
109
    /* CIL is broken */
110
#else
111
    ACCCHK_ASSERT(sizeof(char) == sizeof((char)0))
112
#endif
113
#if defined(__cplusplus)
114
    ACCCHK_ASSERT(sizeof('\0') == sizeof(char))
115
#else
116
#  if (ACC_CC_DMC)
117
    /* Digital Mars C is broken */
118
#  else
119
    ACCCHK_ASSERT(sizeof('\0') == sizeof(int))
120
#  endif
121
#endif
122
#if defined(acc_alignof)
123
    ACCCHK_ASSERT(acc_alignof(char) == 1)
124
    ACCCHK_ASSERT(acc_alignof(signed char) == 1)
125
    ACCCHK_ASSERT(acc_alignof(unsigned char) == 1)
126
#endif
127
 
128
    ACCCHK_ASSERT_IS_SIGNED_T(short)
129
    ACCCHK_ASSERT_IS_UNSIGNED_T(unsigned short)
130
    ACCCHK_ASSERT(sizeof(short) == sizeof(unsigned short))
131
    ACCCHK_ASSERT(sizeof(short) >= 2)
132
    ACCCHK_ASSERT(sizeof(short) >= sizeof(char))
133
#if (ACC_CC_CILLY)
134
    /* CIL is broken */
135
#else
136
    ACCCHK_ASSERT(sizeof(short) == sizeof((short)0))
137
#endif
138
#if (SIZEOF_SHORT > 0)
139
    ACCCHK_ASSERT(sizeof(short) == SIZEOF_SHORT)
140
#endif
141
 
142
    ACCCHK_ASSERT_IS_SIGNED_T(int)
143
    ACCCHK_ASSERT_IS_UNSIGNED_T(unsigned int)
144
    ACCCHK_ASSERT(sizeof(int) == sizeof(unsigned int))
145
    ACCCHK_ASSERT(sizeof(int) >= 2)
146
    ACCCHK_ASSERT(sizeof(int) >= sizeof(short))
147
    ACCCHK_ASSERT(sizeof(int) == sizeof(0))
148
    ACCCHK_ASSERT(sizeof(int) == sizeof((int)0))
149
#if (SIZEOF_INT > 0)
150
    ACCCHK_ASSERT(sizeof(int) == SIZEOF_INT)
151
#endif
152
 
153
    ACCCHK_ASSERT_IS_SIGNED_T(long)
154
    ACCCHK_ASSERT_IS_UNSIGNED_T(unsigned long)
155
    ACCCHK_ASSERT(sizeof(long) == sizeof(unsigned long))
156
    ACCCHK_ASSERT(sizeof(long) >= 4)
157
    ACCCHK_ASSERT(sizeof(long) >= sizeof(int))
158
    ACCCHK_ASSERT(sizeof(long) == sizeof(0L))
159
    ACCCHK_ASSERT(sizeof(long) == sizeof((long)0))
160
#if (SIZEOF_LONG > 0)
161
    ACCCHK_ASSERT(sizeof(long) == SIZEOF_LONG)
162
#endif
163
 
164
    ACCCHK_ASSERT_IS_UNSIGNED_T(size_t)
165
    ACCCHK_ASSERT(sizeof(size_t) >= sizeof(int))
166
    ACCCHK_ASSERT(sizeof(size_t) == sizeof(sizeof(0))) /* sizeof() returns size_t */
167
#if (SIZEOF_SIZE_T > 0)
168
    ACCCHK_ASSERT(sizeof(size_t) == SIZEOF_SIZE_T)
169
#endif
170
 
171
    ACCCHK_ASSERT_IS_SIGNED_T(ptrdiff_t)
172
    ACCCHK_ASSERT(sizeof(ptrdiff_t) >= sizeof(int))
173
    ACCCHK_ASSERT(sizeof(ptrdiff_t) >= sizeof(size_t))
174
#if !defined(ACC_BROKEN_SIZEOF)
175
    ACCCHK_ASSERT(sizeof(ptrdiff_t) == sizeof((char*)0 - (char*)0))
176
# if (ACC_HAVE_MM_HUGE_PTR)
177
    ACCCHK_ASSERT(4 == sizeof((char __huge*)0 - (char __huge*)0))
178
# endif
179
#endif
180
#if (SIZEOF_PTRDIFF_T > 0)
181
    ACCCHK_ASSERT(sizeof(ptrdiff_t) == SIZEOF_PTRDIFF_T)
182
#endif
183
 
184
    ACCCHK_ASSERT(sizeof(void*) >= sizeof(char*))
185
#if (SIZEOF_VOID_P > 0)
186
    ACCCHK_ASSERT(sizeof(void*) == SIZEOF_VOID_P)
187
#endif
188
#if (SIZEOF_CHAR_P > 0)
189
    ACCCHK_ASSERT(sizeof(char*) == SIZEOF_CHAR_P)
190
#endif
191
#if (ACC_HAVE_MM_HUGE_PTR)
192
    ACCCHK_ASSERT(4 == sizeof(void __huge*))
193
    ACCCHK_ASSERT(4 == sizeof(char __huge*))
194
#endif
195
 
196
 
197
/*************************************************************************
198
// check arithmetics
199
**************************************************************************/
200
 
201
    ACCCHK_ASSERT((((1u  << 15) + 1) >> 15) == 1)
202
    ACCCHK_ASSERT((((1ul << 31) + 1) >> 31) == 1)
203
 
204
#if (ACC_CC_TURBOC && (__TURBOC__ < 0x0150))
205
    /* TC 1.0 bug, probably due to ACC_BROKEN_INTEGRAL_PROMOTION ?? */
206
#else
207
    ACCCHK_ASSERT((1   << (8*SIZEOF_INT-1)) < 0)
208
#endif
209
    ACCCHK_ASSERT((1u  << (8*SIZEOF_INT-1)) > 0)
210
 
211
    ACCCHK_ASSERT((1l  << (8*SIZEOF_LONG-1)) < 0)
212
    ACCCHK_ASSERT((1ul << (8*SIZEOF_LONG-1)) > 0)
213
 
214
#if defined(acc_int32e_t)
215
    ACCCHK_ASSERT(sizeof(acc_int32e_t) == 4)
216
    ACCCHK_ASSERT(sizeof(acc_int32e_t) == SIZEOF_ACC_INT32E_T)
217
    ACCCHK_ASSERT(sizeof(acc_uint32e_t) == 4)
218
    ACCCHK_ASSERT(sizeof(acc_int32e_t) == sizeof(acc_uint32e_t))
219
 
220
    ACCCHK_ASSERT_IS_SIGNED_T(acc_int32e_t)
221
    ACCCHK_ASSERT(((( (acc_int32e_t)1 << 30) + 1) >> 30) == 1)
222
    ACCCHK_ASSERT(((( ACC_INT32E_C(1) << 30) + 1) >> 30) == 1)
223
 
224
    ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uint32e_t)
225
    ACCCHK_ASSERT(((( (acc_uint32e_t)1 << 31) + 1) >> 31) == 1)
226
    ACCCHK_ASSERT(((( ACC_UINT32E_C(1) << 31) + 1) >> 31) == 1)
227
 
228
    ACCCHK_ASSERT( (acc_int32e_t) (1 + ~(acc_int32e_t)0) == 0)
229
#if defined(ACCCHK_CONFIG_PEDANTIC)
230
    /* compiler may warn about overflow */
231
    ACCCHK_ASSERT( (acc_uint32e_t)(1 + ~(acc_uint32e_t)0) == 0)
232
#endif /* ACCCHK_CONFIG_PEDANTIC */
233
 
234
#if (SIZEOF_ACC_INT32E_T < SIZEOF_INT)
235
    ACCCHK_ASSERT(sizeof(ACC_INT32E_C(0)) == sizeof(int))
236
    ACCCHK_ASSERT(sizeof(ACC_UINT32E_C(0)) == sizeof(int))
237
#else
238
    ACCCHK_ASSERT(sizeof(ACC_INT32E_C(0)) == SIZEOF_ACC_INT32E_T)
239
    ACCCHK_ASSERT(sizeof(ACC_UINT32E_C(0)) == SIZEOF_ACC_INT32E_T)
240
#endif
241
    ACCCHK_ASSERT((ACC_INT32E_C(1)  << (8*SIZEOF_ACC_INT32E_T-1)) < 0)
242
    ACCCHK_ASSERT((ACC_UINT32E_C(1) << (8*SIZEOF_ACC_INT32E_T-1)) > 0)
243
    ACCCHK_ASSERT((ACC_INT32E_C(1)  << (int)(8*sizeof(ACC_INT32E_C(1))-1)) < 0)
244
    ACCCHK_ASSERT((ACC_UINT32E_C(1) << (int)(8*sizeof(ACC_UINT32E_C(1))-1)) > 0)
245
    ACCCHK_ASSERT(ACC_INT32E_C(2147483647)      > 0)
246
    ACCCHK_ASSERT(ACC_INT32E_C(-2147483647) -1  < 0)
247
    ACCCHK_ASSERT(ACC_UINT32E_C(4294967295)     > 0)
248
    ACCCHK_ASSERT(ACC_UINT32E_C(4294967295) == ACC_0xffffffffL)
249
#endif
250
 
251
 
252
    ACCCHK_ASSERT(sizeof(acc_int32l_t) >= sizeof(int))
253
#if defined(acc_int32e_t)
254
    ACCCHK_ASSERT(sizeof(acc_int32l_t) >= sizeof(acc_int32e_t))
255
#endif
256
 
257
    ACCCHK_ASSERT(sizeof(acc_int32l_t) >= 4)
258
    ACCCHK_ASSERT(sizeof(acc_int32l_t) == SIZEOF_ACC_INT32L_T)
259
    ACCCHK_ASSERT(sizeof(acc_uint32l_t) >= 4)
260
    ACCCHK_ASSERT(sizeof(acc_int32l_t) == sizeof(acc_uint32l_t))
261
 
262
    ACCCHK_ASSERT_IS_SIGNED_T(acc_int32l_t)
263
    ACCCHK_ASSERT(((( (acc_int32l_t)1 << 30) + 1) >> 30) == 1)
264
    ACCCHK_ASSERT(((( ACC_INT32L_C(1) << 30) + 1) >> 30) == 1)
265
 
266
    ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uint32l_t)
267
    ACCCHK_ASSERT(((( (acc_uint32l_t)1 << 31) + 1) >> 31) == 1)
268
    ACCCHK_ASSERT(((( ACC_UINT32L_C(1) << 31) + 1) >> 31) == 1)
269
 
270
#if (SIZEOF_ACC_INT32L_T < SIZEOF_INT)
271
    ACCCHK_ASSERT(sizeof(ACC_INT32L_C(0)) == sizeof(int))
272
    ACCCHK_ASSERT(sizeof(ACC_UINT32L_C(0)) == sizeof(int))
273
#else
274
    ACCCHK_ASSERT(sizeof(ACC_INT32L_C(0)) == SIZEOF_ACC_INT32L_T)
275
    ACCCHK_ASSERT(sizeof(ACC_UINT32L_C(0)) == SIZEOF_ACC_INT32L_T)
276
#endif
277
    ACCCHK_ASSERT((ACC_INT32L_C(1)  << (8*SIZEOF_ACC_INT32L_T-1)) < 0)
278
    ACCCHK_ASSERT((ACC_UINT32L_C(1) << (8*SIZEOF_ACC_INT32L_T-1)) > 0)
279
    ACCCHK_ASSERT((ACC_INT32L_C(1)  << (int)(8*sizeof(ACC_INT32L_C(1))-1)) < 0)
280
    ACCCHK_ASSERT((ACC_UINT32L_C(1) << (int)(8*sizeof(ACC_UINT32L_C(1))-1)) > 0)
281
    ACCCHK_ASSERT(ACC_INT32L_C(2147483647)      > 0)
282
    ACCCHK_ASSERT(ACC_INT32L_C(-2147483647) -1  < 0)
283
    ACCCHK_ASSERT(ACC_UINT32L_C(4294967295)     > 0)
284
    ACCCHK_ASSERT(ACC_UINT32L_C(4294967295) == ACC_0xffffffffL)
285
 
286
 
287
    ACCCHK_ASSERT(sizeof(acc_int32f_t) >= sizeof(int))
288
#if defined(acc_int32e_t)
289
    ACCCHK_ASSERT(sizeof(acc_int32f_t) >= sizeof(acc_int32e_t))
290
#endif
291
    ACCCHK_ASSERT(sizeof(acc_int32f_t) >= sizeof(acc_int32l_t))
292
 
293
    ACCCHK_ASSERT(sizeof(acc_int32f_t) >= 4)
294
    ACCCHK_ASSERT(sizeof(acc_int32f_t) >= sizeof(acc_int32l_t))
295
    ACCCHK_ASSERT(sizeof(acc_int32f_t) == SIZEOF_ACC_INT32F_T)
296
    ACCCHK_ASSERT(sizeof(acc_uint32f_t) >= 4)
297
    ACCCHK_ASSERT(sizeof(acc_uint32f_t) >= sizeof(acc_uint32l_t))
298
    ACCCHK_ASSERT(sizeof(acc_int32f_t) == sizeof(acc_uint32f_t))
299
 
300
    ACCCHK_ASSERT_IS_SIGNED_T(acc_int32f_t)
301
    ACCCHK_ASSERT(((( (acc_int32f_t)1 << 30) + 1) >> 30) == 1)
302
    ACCCHK_ASSERT(((( ACC_INT32F_C(1) << 30) + 1) >> 30) == 1)
303
 
304
    ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uint32f_t)
305
    ACCCHK_ASSERT(((( (acc_uint32f_t)1 << 31) + 1) >> 31) == 1)
306
    ACCCHK_ASSERT(((( ACC_UINT32F_C(1) << 31) + 1) >> 31) == 1)
307
 
308
#if (SIZEOF_ACC_INT32F_T < SIZEOF_INT)
309
    ACCCHK_ASSERT(sizeof(ACC_INT32F_C(0)) == sizeof(int))
310
    ACCCHK_ASSERT(sizeof(ACC_UINT32F_C(0)) == sizeof(int))
311
#else
312
    ACCCHK_ASSERT(sizeof(ACC_INT32F_C(0)) == SIZEOF_ACC_INT32F_T)
313
    ACCCHK_ASSERT(sizeof(ACC_UINT32F_C(0)) == SIZEOF_ACC_INT32F_T)
314
#endif
315
    ACCCHK_ASSERT((ACC_INT32F_C(1)  << (8*SIZEOF_ACC_INT32F_T-1)) < 0)
316
    ACCCHK_ASSERT((ACC_UINT32F_C(1) << (8*SIZEOF_ACC_INT32F_T-1)) > 0)
317
    ACCCHK_ASSERT((ACC_INT32F_C(1)  << (int)(8*sizeof(ACC_INT32F_C(1))-1)) < 0)
318
    ACCCHK_ASSERT((ACC_UINT32F_C(1) << (int)(8*sizeof(ACC_UINT32F_C(1))-1)) > 0)
319
    ACCCHK_ASSERT(ACC_INT32F_C(2147483647)      > 0)
320
    ACCCHK_ASSERT(ACC_INT32F_C(-2147483647) -1  < 0)
321
    ACCCHK_ASSERT(ACC_UINT32F_C(4294967295)     > 0)
322
    ACCCHK_ASSERT(ACC_UINT32F_C(4294967295) == ACC_0xffffffffL)
323
 
324
 
325
#if defined(acc_int64l_t)
326
    ACCCHK_ASSERT(sizeof(acc_int64l_t) >= 8)
327
    ACCCHK_ASSERT(sizeof(acc_int64l_t) == SIZEOF_ACC_INT64L_T)
328
    ACCCHK_ASSERT(sizeof(acc_uint64l_t) >= 8)
329
    ACCCHK_ASSERT(sizeof(acc_int64l_t) == sizeof(acc_uint64l_t))
330
 
331
    ACCCHK_ASSERT_IS_SIGNED_T(acc_int64l_t)
332
    ACCCHK_ASSERT(((( (acc_int64l_t)1 << 62) + 1) >> 62) == 1)
333
    ACCCHK_ASSERT(((( ACC_INT64L_C(1) << 62) + 1) >> 62) == 1)
334
 
335
#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0530))
336
    /* Borland C is broken */
337
#else
338
    ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uint64l_t)
339
    ACCCHK_ASSERT(ACC_UINT64L_C(18446744073709551615)     > 0)
340
#endif
341
    ACCCHK_ASSERT(((( (acc_uint64l_t)1 << 63) + 1) >> 63) == 1)
342
    ACCCHK_ASSERT(((( ACC_UINT64L_C(1) << 63) + 1) >> 63) == 1)
343
 
344
#if defined(ACCCHK_CONFIG_PEDANTIC)
345
#if (ACC_CC_BORLANDC && (__BORLANDC__ < 0x0560))
346
    /* Borland C is broken */
347
#elif (SIZEOF_ACC_INT64L_T < SIZEOF_INT)
348
    ACCCHK_ASSERT(sizeof(ACC_INT64L_C(0)) == sizeof(int))
349
    ACCCHK_ASSERT(sizeof(ACC_UINT64L_C(0)) == sizeof(int))
350
#else
351
    ACCCHK_ASSERT(sizeof(ACC_INT64L_C(0)) == SIZEOF_ACC_INT64L_T)
352
    ACCCHK_ASSERT(sizeof(ACC_UINT64L_C(0)) == SIZEOF_ACC_INT64L_T)
353
#endif
354
#endif /* ACCCHK_CONFIG_PEDANTIC */
355
    ACCCHK_ASSERT((ACC_INT64L_C(1)  << (8*SIZEOF_ACC_INT64L_T-1)) < 0)
356
    ACCCHK_ASSERT((ACC_UINT64L_C(1) << (8*SIZEOF_ACC_INT64L_T-1)) > 0)
357
#if (ACC_CC_GNUC && (ACC_CC_GNUC < 0x020600ul))
358
    /* avoid pedantic warning */
359
    ACCCHK_ASSERT(ACC_INT64L_C(9223372036854775807)       > ACC_INT64L_C(0))
360
#else
361
    ACCCHK_ASSERT(ACC_INT64L_C(9223372036854775807)       > 0)
362
#endif
363
    ACCCHK_ASSERT(ACC_INT64L_C(-9223372036854775807) - 1  < 0)
364
 
365
    ACCCHK_ASSERT( ACC_INT64L_C(9223372036854775807) % 2147483629l  == 721)
366
    ACCCHK_ASSERT( ACC_INT64L_C(9223372036854775807) % 2147483647l  == 1)
367
    ACCCHK_ASSERT(ACC_UINT64L_C(9223372036854775807) % 2147483629ul == 721)
368
    ACCCHK_ASSERT(ACC_UINT64L_C(9223372036854775807) % 2147483647ul == 1)
369
#endif /* acc_int64l_t */
370
 
371
 
372
    ACCCHK_ASSERT_IS_SIGNED_T(acc_intptr_t)
373
    ACCCHK_ASSERT_IS_UNSIGNED_T(acc_uintptr_t)
374
    ACCCHK_ASSERT(sizeof(acc_intptr_t) >= sizeof(void *))
375
    ACCCHK_ASSERT(sizeof(acc_intptr_t) == SIZEOF_ACC_INTPTR_T)
376
    ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(acc_uintptr_t))
377
 
378
 
379
/*************************************************************************
380
// check memory model ACC_MM
381
**************************************************************************/
382
 
383
#if (ACC_MM_FLAT)
384
#if 0
385
    /* this is not a valid assumption -- disabled */
386
    ACCCHK_ASSERT(sizeof(void*) == sizeof(void (*)(void)))
387
#endif
388
#endif
389
 
390
#if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_MEDIUM)
391
    ACCCHK_ASSERT(sizeof(void*) == 2)
392
    ACCCHK_ASSERT(sizeof(ptrdiff_t) == 2)
393
#elif (ACC_MM_COMPACT || ACC_MM_LARGE || ACC_MM_HUGE)
394
    ACCCHK_ASSERT(sizeof(void*) == 4)
395
#endif
396
#if (ACC_MM_TINY || ACC_MM_SMALL || ACC_MM_COMPACT)
397
    ACCCHK_ASSERT(sizeof(void (*)(void)) == 2)
398
#elif (ACC_MM_MEDIUM || ACC_MM_LARGE || ACC_MM_HUGE)
399
    ACCCHK_ASSERT(sizeof(void (*)(void)) == 4)
400
#endif
401
 
402
 
403
/*************************************************************************
404
// check ACC_ARCH and ACC_OS
405
**************************************************************************/
406
 
407
#if (ACC_ARCH_IA16)
408
    ACCCHK_ASSERT(sizeof(size_t) == 2)
409
    ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(void *))
410
#elif (ACC_ARCH_IA32 || ACC_ARCH_M68K)
411
    ACCCHK_ASSERT(sizeof(size_t) == 4)
412
    ACCCHK_ASSERT(sizeof(ptrdiff_t) == 4)
413
    ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(void *))
414
#elif (ACC_ARCH_AMD64 || ACC_ARCH_IA64)
415
    ACCCHK_ASSERT(sizeof(size_t) == 8)
416
    ACCCHK_ASSERT(sizeof(ptrdiff_t) == 8)
417
    ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(void *))
418
#endif
419
 
420
#if (ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_WIN32)
421
    ACCCHK_ASSERT(sizeof(size_t) == 4)
422
    ACCCHK_ASSERT(sizeof(ptrdiff_t) == 4)
423
    ACCCHK_ASSERT(sizeof(void (*)(void)) == 4)
424
#elif (ACC_OS_WIN64)
425
    ACCCHK_ASSERT(sizeof(size_t) == 8)
426
    ACCCHK_ASSERT(sizeof(ptrdiff_t) == 8)
427
    ACCCHK_ASSERT(sizeof(void (*)(void)) == 8)
428
#endif
429
 
430
 
431
/*************************************************************************
432
// check promotion rules
433
**************************************************************************/
434
 
435
#if (ACC_CC_NDPC)
436
    /* NDP C is broken */
437
#else
438
    /* check that the compiler correctly casts signed to unsigned */
439
    ACCCHK_ASSERT( (int) ((unsigned char) ((signed char) -1)) == 255)
440
#endif
441
 
442
#if (ACC_CC_KEILC)
443
    /* Keil C is broken */
444
#elif (ACC_CC_NDPC)
445
    /* NDP C is broken */
446
#elif !defined(ACC_BROKEN_INTEGRAL_PROMOTION) && (SIZEOF_INT > 1)
447
    /* check that the compiler correctly promotes integrals */
448
    ACCCHK_ASSERT( (((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0)
449
#endif
450
 
451
 
452
 
453
/*
454
vi:ts=4:et
455
*/