Imported Upstream version 2.8.9
[platform/upstream/cmake.git] / Utilities / KWIML / ABI.h.in
1 /*============================================================================
2   Kitware Information Macro Library
3   Copyright 2010-2011 Kitware, Inc.
4   All rights reserved.
5
6   Redistribution and use in source and binary forms, with or without
7   modification, are permitted provided that the following conditions
8   are met:
9
10   * Redistributions of source code must retain the above copyright
11     notice, this list of conditions and the following disclaimer.
12
13   * Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions and the following disclaimer in the
15     documentation and/or other materials provided with the distribution.
16
17   * Neither the name of Kitware, Inc. nor the names of its contributors
18     may be used to endorse or promote products derived from this
19     software without specific prior written permission.
20
21   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 ============================================================================*/
33 #ifndef @KWIML@_ABI_H
34 #define @KWIML@_ABI_H
35 /*
36 This header defines macros with information about the C ABI.
37 Only information that can be determined using the preprocessor at
38 compilation time is available.  No try-compile results may be added
39 here.  Instead we memorize results on platforms of interest.
40
41 An includer may optionally define the following macros to suppress errors:
42
43   @KWIML@_ABI_NO_VERIFY          = skip verification declarations
44   @KWIML@_ABI_NO_ERROR_CHAR_SIGN = signedness of 'char' may be unknown
45   @KWIML@_ABI_NO_ERROR_LONG_LONG = existence of 'long long' may be unknown
46   @KWIML@_ABI_NO_ERROR_ENDIAN    = byte order of CPU may be unknown
47
48 An includer may test the following macros after inclusion:
49
50   @KWIML@_ABI_SIZEOF_DATA_PTR   = sizeof(void*)
51   @KWIML@_ABI_SIZEOF_CODE_PTR   = sizeof(void(*)(void))
52   @KWIML@_ABI_SIZEOF_FLOAT      = sizeof(float)
53   @KWIML@_ABI_SIZEOF_DOUBLE     = sizeof(double)
54   @KWIML@_ABI_SIZEOF_CHAR       = sizeof(char)
55   @KWIML@_ABI_SIZEOF_SHORT      = sizeof(short)
56   @KWIML@_ABI_SIZEOF_INT        = sizeof(int)
57   @KWIML@_ABI_SIZEOF_LONG       = sizeof(long)
58
59   @KWIML@_ABI_SIZEOF_LONG_LONG  = sizeof(long long) or 0 if not a type
60     Undefined if existence is unknown and error suppression macro
61     @KWIML@_ABI_NO_ERROR_LONG_LONG was defined.
62
63   @KWIML@_ABI_SIZEOF___INT64    = 8 if '__int64' exists or 0 if not
64     Undefined if existence is unknown.
65
66   @KWIML@_ABI___INT64_IS_LONG   = 1 if '__int64' is 'long' (same type)
67     Undefined otherwise.
68   @KWIML@_ABI___INT64_IS_LONG_LONG = 1 if '__int64' is 'long long' (same type)
69     Undefined otherwise.
70   @KWIML@_ABI___INT64_IS_UNIQUE = 1 if '__int64' is a distinct type
71     Undefined otherwise.
72
73   @KWIML@_ABI_CHAR_IS_UNSIGNED  = 1 if 'char' is unsigned, else undefined
74   @KWIML@_ABI_CHAR_IS_SIGNED    = 1 if 'char' is signed, else undefined
75     One of these is defined unless signedness of 'char' is unknown and
76     error suppression macro @KWIML@_ABI_NO_ERROR_CHAR_SIGN was defined.
77
78   @KWIML@_ABI_ENDIAN_ID_BIG    = id for big-endian (always defined)
79   @KWIML@_ABI_ENDIAN_ID_LITTLE = id for little-endian (always defined)
80   @KWIML@_ABI_ENDIAN_ID        = id of byte order of target CPU
81     Defined to @KWIML@_ABI_ENDIAN_ID_BIG or @KWIML@_ABI_ENDIAN_ID_LITTLE
82     unless byte order is unknown and error suppression macro
83     @KWIML@_ABI_NO_ERROR_ENDIAN was defined.
84
85 We verify most results using dummy "extern" declarations that are
86 invalid if the macros are wrong.  Verification is disabled if
87 suppression macro @KWIML@_ABI_NO_VERIFY was defined.
88 */
89
90 /*--------------------------------------------------------------------------*/
91 #if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR)
92 # if defined(__SIZEOF_POINTER__)
93 #  define @KWIML@_ABI_SIZEOF_DATA_PTR __SIZEOF_POINTER__
94 # elif defined(_SIZE_PTR)
95 #  define @KWIML@_ABI_SIZEOF_DATA_PTR (_SIZE_PTR >> 3)
96 # elif defined(_LP64) || defined(__LP64__)
97 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
98 # elif defined(_ILP32)
99 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 4
100 # elif defined(__64BIT__) /* IBM XL */
101 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
102 # elif defined(_M_X64)
103 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
104 # elif defined(__ia64)
105 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
106 # elif defined(__sparcv9)
107 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
108 # elif defined(__x86_64) || defined(__x86_64__)
109 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
110 # elif defined(__amd64) || defined(__amd64__)
111 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 8
112 # elif defined(__i386) || defined(__i386__)
113 #  define @KWIML@_ABI_SIZEOF_DATA_PTR 4
114 # endif
115 #endif
116 #if !defined(@KWIML@_ABI_SIZEOF_DATA_PTR)
117 # define @KWIML@_ABI_SIZEOF_DATA_PTR 4
118 #endif
119 #if !defined(@KWIML@_ABI_SIZEOF_CODE_PTR)
120 # define @KWIML@_ABI_SIZEOF_CODE_PTR @KWIML@_ABI_SIZEOF_DATA_PTR
121 #endif
122
123 /*--------------------------------------------------------------------------*/
124 #if !defined(@KWIML@_ABI_SIZEOF_CHAR)
125 # define @KWIML@_ABI_SIZEOF_CHAR 1
126 #endif
127
128 #if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED)
129 # if defined(__CHAR_UNSIGNED__) /* GNU, some IBM XL, others?  */
130 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
131 # elif defined(_CHAR_UNSIGNED) /* Intel, IBM XL, MSVC, Borland, others?  */
132 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
133 # elif defined(_CHAR_SIGNED) /* IBM XL, others? */
134 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
135 # elif defined(__CHAR_SIGNED__) /* IBM XL, Watcom, others? */
136 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
137 # elif defined(__SIGNED_CHARS__) /* EDG, Intel, SGI MIPSpro */
138 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
139 # elif defined(_CHAR_IS_SIGNED) /* Some SunPro, others? */
140 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
141 # elif defined(_CHAR_IS_UNSIGNED) /* SunPro, others? */
142 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
143 # elif defined(__GNUC__) /* GNU default */
144 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
145 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro default */
146 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
147 # elif defined(__HP_cc) || defined(__HP_aCC) /* HP default (unless +uc) */
148 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
149 # elif defined(_SGI_COMPILER_VERSION) /* SGI MIPSpro default */
150 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
151 # elif defined(__PGIC__) /* PGI default */
152 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
153 # elif defined(_MSC_VER) /* MSVC default */
154 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
155 # elif defined(__WATCOMC__) /* Watcom default */
156 #  define @KWIML@_ABI_CHAR_IS_UNSIGNED 1
157 # elif defined(__BORLANDC__) /* Borland default */
158 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1
159 # elif defined(__hpux) /* Old HP: no __HP_cc/__HP_aCC/__GNUC__ above */
160 #  define @KWIML@_ABI_CHAR_IS_SIGNED 1 /* (unless +uc) */
161 # endif
162 #endif
163 #if !defined(@KWIML@_ABI_CHAR_IS_UNSIGNED) && !defined(@KWIML@_ABI_CHAR_IS_SIGNED) \
164  && !defined(@KWIML@_ABI_NO_ERROR_CHAR_SIGN)
165 # error "Signedness of 'char' unknown."
166 #endif
167
168 /*--------------------------------------------------------------------------*/
169 #if !defined(@KWIML@_ABI_SIZEOF_SHORT)
170 # if defined(__SIZEOF_SHORT__)
171 #  define @KWIML@_ABI_SIZEOF_SHORT __SIZEOF_SHORT__
172 # endif
173 #endif
174 #if !defined(@KWIML@_ABI_SIZEOF_SHORT)
175 # define @KWIML@_ABI_SIZEOF_SHORT 2
176 #endif
177
178 /*--------------------------------------------------------------------------*/
179 #if !defined(@KWIML@_ABI_SIZEOF_INT)
180 # if defined(__SIZEOF_INT__)
181 #  define @KWIML@_ABI_SIZEOF_INT __SIZEOF_INT__
182 # elif defined(_SIZE_INT)
183 #  define @KWIML@_ABI_SIZEOF_INT (_SIZE_INT >> 3)
184 # endif
185 #endif
186 #if !defined(@KWIML@_ABI_SIZEOF_INT)
187 # define @KWIML@_ABI_SIZEOF_INT 4
188 #endif
189
190 /*--------------------------------------------------------------------------*/
191 #if !defined(@KWIML@_ABI_SIZEOF_LONG)
192 # if defined(__SIZEOF_LONG__)
193 #  define @KWIML@_ABI_SIZEOF_LONG __SIZEOF_LONG__
194 # elif defined(_SIZE_LONG)
195 #  define @KWIML@_ABI_SIZEOF_LONG (_SIZE_LONG >> 3)
196 # elif defined(__LONG_MAX__)
197 #  if __LONG_MAX__ == 0x7fffffff
198 #   define @KWIML@_ABI_SIZEOF_LONG 4
199 #  elif __LONG_MAX__>>32 == 0x7fffffff
200 #   define @KWIML@_ABI_SIZEOF_LONG 8
201 #  endif
202 # elif defined(_MSC_VER) /* MSVC and Intel on Windows */
203 #  define @KWIML@_ABI_SIZEOF_LONG 4
204 # endif
205 #endif
206 #if !defined(@KWIML@_ABI_SIZEOF_LONG)
207 # define @KWIML@_ABI_SIZEOF_LONG @KWIML@_ABI_SIZEOF_DATA_PTR
208 #endif
209
210 /*--------------------------------------------------------------------------*/
211 #if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG)
212 # if defined(__SIZEOF_LONG_LONG__)
213 #  define @KWIML@_ABI_SIZEOF_LONG_LONG __SIZEOF_LONG_LONG__
214 # elif defined(__LONG_LONG_MAX__)
215 #  if __LONG_LONG_MAX__ == 0x7fffffff
216 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 4
217 #  elif __LONG_LONG_MAX__>>32 == 0x7fffffff
218 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 8
219 #  endif
220 # endif
221 #endif
222 #if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG)
223 # if defined(_LONGLONG) /* SGI, some GNU, perhaps others.  */ \
224   && !defined(_MSC_VER)
225 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
226 # elif defined(_LONG_LONG) /* IBM XL, perhaps others.  */
227 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
228 # elif defined(__NO_LONG_LONG) /* EDG */
229 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 0
230 # elif defined(__cplusplus) && __cplusplus > 199711L /* C++0x */
231 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
232 # elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
233 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
234 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) /* SunPro */
235 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
236 # elif defined(__HP_cc) || defined(__HP_aCC) /* HP */
237 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
238 # elif defined(__PGIC__) /* PGI */
239 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
240 # elif defined(__WATCOMC__) /* Watcom */
241 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
242 # elif defined(__INTEL_COMPILER) /* Intel */
243 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
244 # elif defined(__BORLANDC__) /* Borland */
245 #  if __BORLANDC__ >= 0x0560
246 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 8
247 #  else
248 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 0
249 #  endif
250 # elif defined(_MSC_VER) /* Microsoft */
251 #  if _MSC_VER >= 1310
252 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 8
253 #  else
254 #   define @KWIML@_ABI_SIZEOF_LONG_LONG 0
255 #  endif
256 # elif defined(__hpux) && !defined(__GNUC__) /* Old HP: no __HP_cc/__HP_aCC above */
257 #  define @KWIML@_ABI_SIZEOF_LONG_LONG 8
258 # endif
259 #endif
260 #if !defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && !defined(@KWIML@_ABI_NO_ERROR_LONG_LONG)
261 # error "Existence of 'long long' unknown."
262 #endif
263
264 /*--------------------------------------------------------------------------*/
265 #if !defined(@KWIML@_ABI_SIZEOF___INT64)
266 # if defined(__INTEL_COMPILER)
267 #  define @KWIML@_ABI_SIZEOF___INT64 8
268 # elif defined(_MSC_VER)
269 #  define @KWIML@_ABI_SIZEOF___INT64 8
270 # elif defined(__BORLANDC__)
271 #  define @KWIML@_ABI_SIZEOF___INT64 8
272 # else
273 #  define @KWIML@_ABI_SIZEOF___INT64 0
274 # endif
275 #endif
276
277 #if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0
278 # if @KWIML@_ABI_SIZEOF_LONG == 8
279 #  define @KWIML@_ABI___INT64_IS_LONG 1
280 # elif defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG == 8
281 #  define @KWIML@_ABI___INT64_IS_LONG_LONG 1
282 # else
283 #  define @KWIML@_ABI___INT64_IS_UNIQUE 1
284 # endif
285 #endif
286
287 /*--------------------------------------------------------------------------*/
288 #if !defined(@KWIML@_ABI_SIZEOF_FLOAT)
289 # if defined(__SIZEOF_FLOAT__)
290 #  define @KWIML@_ABI_SIZEOF_FLOAT __SIZEOF_FLOAT__
291 # endif
292 #endif
293 #if !defined(@KWIML@_ABI_SIZEOF_FLOAT)
294 # define @KWIML@_ABI_SIZEOF_FLOAT 4
295 #endif
296
297 /*--------------------------------------------------------------------------*/
298 #if !defined(@KWIML@_ABI_SIZEOF_DOUBLE)
299 # if defined(__SIZEOF_DOUBLE__)
300 #  define @KWIML@_ABI_SIZEOF_DOUBLE __SIZEOF_DOUBLE__
301 # endif
302 #endif
303 #if !defined(@KWIML@_ABI_SIZEOF_DOUBLE)
304 # define @KWIML@_ABI_SIZEOF_DOUBLE 8
305 #endif
306
307 /*--------------------------------------------------------------------------*/
308 /* Identify possible endian cases.  The macro @KWIML@_ABI_ENDIAN_ID will be
309    defined to one of these, or undefined if unknown.  */
310 #if !defined(@KWIML@_ABI_ENDIAN_ID_BIG)
311 # define @KWIML@_ABI_ENDIAN_ID_BIG    4321
312 #endif
313 #if !defined(@KWIML@_ABI_ENDIAN_ID_LITTLE)
314 # define @KWIML@_ABI_ENDIAN_ID_LITTLE 1234
315 #endif
316 #if @KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE
317 # error "@KWIML@_ABI_ENDIAN_ID_BIG == @KWIML@_ABI_ENDIAN_ID_LITTLE"
318 #endif
319
320 #if defined(@KWIML@_ABI_ENDIAN_ID) /* Skip #elif cases if already defined.  */
321
322 /* Use dedicated symbols if the compiler defines them.  Do this first
323    because some architectures allow runtime byte order selection by
324    the operating system (values for such architectures below are
325    guesses for compilers that do not define a dedicated symbol).
326    Ensure that only one is defined in case the platform or a header
327    defines both as possible values for some third symbol.  */
328 #elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
329 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
330 #elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
331 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
332 #elif defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
333 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
334 #elif defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
335 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
336
337 /* Alpha */
338 #elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
339 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
340
341 /* Arm */
342 #elif defined(__arm__)
343 # if !defined(__ARMEB__)
344 #  define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
345 # else
346 #  define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
347 # endif
348
349 /* Intel x86 */
350 #elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
351 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
352 #elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__)
353 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
354 #elif defined(__MWERKS__) && defined(__INTEL__)
355 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
356
357 /* Intel x86-64 */
358 #elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
359 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
360 #elif defined(__amd64) || defined(__amd64__)
361 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
362
363 /* Intel Architecture-64 (Itanium) */
364 #elif defined(__ia64) || defined(__ia64__)
365 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
366 #elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64)
367 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
368
369 /* PowerPC */
370 #elif defined(__powerpc) || defined(__powerpc__)
371 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
372 #elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__)
373 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
374
375 /* SPARC */
376 #elif defined(__sparc) || defined(__sparc__)
377 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
378
379 /* HP/PA RISC */
380 #elif defined(__hppa) || defined(__hppa__)
381 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
382
383 /* Motorola 68k */
384 #elif defined(__m68k__) || defined(M68000)
385 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
386
387 /* MIPSel (MIPS little endian) */
388 #elif defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL)
389 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_LITTLE
390
391 /* MIPSeb (MIPS big endian) */
392 #elif defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB)
393 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
394
395 /* MIPS (fallback, big endian) */
396 #elif defined(__mips) || defined(__mips__) || defined(__MIPS__)
397 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
398
399 /* RS/6000 */
400 #elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER)
401 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
402 #elif defined(_ARCH_PWR) || defined(_ARCH_PWR2)
403 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
404
405 /* System/370 */
406 #elif defined(__370__) || defined(__THW_370__)
407 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
408
409 /* System/390 */
410 #elif defined(__s390__) || defined(__s390x__)
411 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
412
413 /* z/Architecture */
414 #elif defined(__SYSC_ZARCH__)
415 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
416
417 /* Unknown CPU */
418 #elif !defined(@KWIML@_ABI_NO_ERROR_ENDIAN)
419 # error "Byte order of target CPU unknown."
420 #endif
421
422 /*--------------------------------------------------------------------------*/
423 #if !defined(@KWIML@_ABI_NO_VERIFY)
424 #define @KWIML@_ABI__VERIFY(n, x, y) extern int (*n)[x]; extern int (*n)[y]
425 #define @KWIML@_ABI__VERIFY2(n, x, y) extern int (*n)(x*); extern int (*n)(y*)
426 #if defined(__cplusplus)
427 # define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*); extern char* n(y*)
428 #else
429 # define @KWIML@_ABI__VERIFY3(n, x, y) extern int* n(x*) /* TODO: possible? */
430 #endif
431 #define @KWIML@_ABI__VERIFY_BOOL(m, b) @KWIML@_ABI__VERIFY(m##__VERIFY__, 2, (b)?2:3)
432 #define @KWIML@_ABI__VERIFY_SIZE(m, t) @KWIML@_ABI__VERIFY(m##__VERIFY__, m, sizeof(t))
433 #define @KWIML@_ABI__VERIFY_SAME(m, x, y) @KWIML@_ABI__VERIFY2(m##__VERIFY__, x, y)
434 #define @KWIML@_ABI__VERIFY_DIFF(m, x, y) @KWIML@_ABI__VERIFY3(m##__VERIFY__, x, y)
435
436 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DATA_PTR, int*);
437 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CODE_PTR, int(*)(int));
438 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_CHAR, char);
439 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_SHORT, short);
440 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_INT, int);
441 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG, long);
442 #if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0
443 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_LONG_LONG, long long);
444 #endif
445 #if defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0
446 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF___INT64, __int64);
447 #endif
448 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_FLOAT, float);
449 @KWIML@_ABI__VERIFY_SIZE(@KWIML@_ABI_SIZEOF_DOUBLE, double);
450
451 #if defined(@KWIML@_ABI___INT64_IS_LONG)
452 @KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG, __int64, long);
453 #elif defined(@KWIML@_ABI___INT64_IS_LONG_LONG)
454 @KWIML@_ABI__VERIFY_SAME(@KWIML@_ABI___INT64_IS_LONG_LONG, __int64, long long);
455 #elif defined(@KWIML@_ABI_SIZEOF___INT64) && @KWIML@_ABI_SIZEOF___INT64 > 0
456 @KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG, __int64, long);
457 # if defined(@KWIML@_ABI_SIZEOF_LONG_LONG) && @KWIML@_ABI_SIZEOF_LONG_LONG > 0
458 @KWIML@_ABI__VERIFY_DIFF(@KWIML@_ABI___INT64_NOT_LONG_LONG, __int64, long long);
459 # endif
460 #endif
461
462 #if defined(@KWIML@_ABI_CHAR_IS_UNSIGNED)
463 @KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_UNSIGNED, (char)0x80 > 0);
464 #elif defined(@KWIML@_ABI_CHAR_IS_SIGNED)
465 @KWIML@_ABI__VERIFY_BOOL(@KWIML@_ABI_CHAR_IS_SIGNED,   (char)0x80 < 0);
466 #endif
467
468 #undef @KWIML@_ABI__VERIFY_DIFF
469 #undef @KWIML@_ABI__VERIFY_SAME
470 #undef @KWIML@_ABI__VERIFY_SIZE
471 #undef @KWIML@_ABI__VERIFY_BOOL
472 #undef @KWIML@_ABI__VERIFY3
473 #undef @KWIML@_ABI__VERIFY2
474 #undef @KWIML@_ABI__VERIFY
475
476 #endif
477
478 #endif