Lines 1-457
Link Here
|
1 |
# Origin: http://www.azillionmonkeys.com/qed/pstdint.h |
|
|
2 |
# Subject: Update pstdint.h to version 0.1.15.4 |
3 |
|
4 |
--- include/assimp/Compiler/pstdint.h.orig 2015-11-03 18:47:37 UTC |
5 |
+++ include/assimp/Compiler/pstdint.h |
6 |
@@ -3,7 +3,7 @@ |
7 |
* BSD License: |
8 |
**************************************************************************** |
9 |
* |
10 |
- * Copyright (c) 2005-2007 Paul Hsieh |
11 |
+ * Copyright (c) 2005-2016 Paul Hsieh |
12 |
* All rights reserved. |
13 |
* |
14 |
* Redistribution and use in source and binary forms, with or without |
15 |
@@ -31,7 +31,7 @@ |
16 |
* |
17 |
**************************************************************************** |
18 |
* |
19 |
- * Version 0.1.10 |
20 |
+ * Version 0.1.15.4 |
21 |
* |
22 |
* The ANSI C standard committee, for the C99 standard, specified the |
23 |
* inclusion of a new standard include file called stdint.h. This is |
24 |
@@ -42,19 +42,17 @@ |
25 |
* integer libraries and so on. But for most developers its likely |
26 |
* useful just for programming sanity. |
27 |
* |
28 |
- * The problem is that most compiler vendors have decided not to |
29 |
- * implement the C99 standard, and the next C++ language standard |
30 |
- * (which has a lot more mindshare these days) will be a long time in |
31 |
- * coming and its unknown whether or not it will include stdint.h or |
32 |
- * how much adoption it will have. Either way, it will be a long time |
33 |
- * before all compilers come with a stdint.h and it also does nothing |
34 |
- * for the extremely large number of compilers available today which |
35 |
- * do not include this file, or anything comparable to it. |
36 |
+ * The problem is that some compiler vendors chose to ignore the C99 |
37 |
+ * standard and some older compilers have no opportunity to be updated. |
38 |
+ * Because of this situation, simply including stdint.h in your code |
39 |
+ * makes it unportable. |
40 |
* |
41 |
* So that's what this file is all about. Its an attempt to build a |
42 |
* single universal include file that works on as many platforms as |
43 |
- * possible to deliver what stdint.h is supposed to. A few things |
44 |
- * that should be noted about this file: |
45 |
+ * possible to deliver what stdint.h is supposed to. Even compilers |
46 |
+ * that already come with stdint.h can use this file instead without |
47 |
+ * any loss of functionality. A few things that should be noted about |
48 |
+ * this file: |
49 |
* |
50 |
* 1) It is not guaranteed to be portable and/or present an identical |
51 |
* interface on all platforms. The extreme variability of the |
52 |
@@ -73,7 +71,7 @@ |
53 |
* include stdint.h. The hope is that one or the other can be |
54 |
* used with no real difference. |
55 |
* |
56 |
- * 5) In the current verison, if your platform can't represent |
57 |
+ * 5) In the current version, if your platform can't represent |
58 |
* int32_t, int16_t and int8_t, it just dumps out with a compiler |
59 |
* error. |
60 |
* |
61 |
@@ -154,7 +152,12 @@ |
62 |
* PRINTF_INT64_DEC_WIDTH |
63 |
* PRINTF_INT32_DEC_WIDTH |
64 |
* PRINTF_INT16_DEC_WIDTH |
65 |
- * PRINTF_INT8_DEC_WIDTH |
66 |
+ * PRINTF_UINT8_DEC_WIDTH |
67 |
+ * PRINTF_UINTMAX_DEC_WIDTH |
68 |
+ * PRINTF_UINT64_DEC_WIDTH |
69 |
+ * PRINTF_UINT32_DEC_WIDTH |
70 |
+ * PRINTF_UINT16_DEC_WIDTH |
71 |
+ * PRINTF_UINT8_DEC_WIDTH |
72 |
* |
73 |
* Which specifies the maximum number of characters required to |
74 |
* print the number of that type in either hexadecimal or decimal. |
75 |
@@ -178,6 +181,10 @@ |
76 |
* Chris Howie |
77 |
* John Steele Scott |
78 |
* Dave Thorup |
79 |
+ * John Dill |
80 |
+ * Florian Wobbe |
81 |
+ * Christopher Sean Morrison |
82 |
+ * Mikkel Fahnoe Jorgensen |
83 |
* |
84 |
*/ |
85 |
|
86 |
@@ -190,14 +197,27 @@ |
87 |
* do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. |
88 |
*/ |
89 |
|
90 |
-#if ((defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)))) && !defined (_PSTDINT_H_INCLUDED) && !defined(_STDINT) |
91 |
+#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED) |
92 |
#include <stdint.h> |
93 |
#define _PSTDINT_H_INCLUDED |
94 |
-# ifndef PRINTF_INT64_MODIFIER |
95 |
-# define PRINTF_INT64_MODIFIER "ll" |
96 |
-# endif |
97 |
-# ifndef PRINTF_INT32_MODIFIER |
98 |
-# define PRINTF_INT32_MODIFIER "l" |
99 |
+# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__)) |
100 |
+# ifndef PRINTF_INT64_MODIFIER |
101 |
+# define PRINTF_INT64_MODIFIER "l" |
102 |
+# endif |
103 |
+# ifndef PRINTF_INT32_MODIFIER |
104 |
+# define PRINTF_INT32_MODIFIER "" |
105 |
+# endif |
106 |
+# else |
107 |
+# ifndef PRINTF_INT64_MODIFIER |
108 |
+# define PRINTF_INT64_MODIFIER "ll" |
109 |
+# endif |
110 |
+# ifndef PRINTF_INT32_MODIFIER |
111 |
+# if (UINT_MAX == UINT32_MAX) |
112 |
+# define PRINTF_INT32_MODIFIER "" |
113 |
+# else |
114 |
+# define PRINTF_INT32_MODIFIER "l" |
115 |
+# endif |
116 |
+# endif |
117 |
# endif |
118 |
# ifndef PRINTF_INT16_MODIFIER |
119 |
# define PRINTF_INT16_MODIFIER "h" |
120 |
@@ -208,32 +228,62 @@ |
121 |
# ifndef PRINTF_INT64_HEX_WIDTH |
122 |
# define PRINTF_INT64_HEX_WIDTH "16" |
123 |
# endif |
124 |
+# ifndef PRINTF_UINT64_HEX_WIDTH |
125 |
+# define PRINTF_UINT64_HEX_WIDTH "16" |
126 |
+# endif |
127 |
# ifndef PRINTF_INT32_HEX_WIDTH |
128 |
# define PRINTF_INT32_HEX_WIDTH "8" |
129 |
# endif |
130 |
+# ifndef PRINTF_UINT32_HEX_WIDTH |
131 |
+# define PRINTF_UINT32_HEX_WIDTH "8" |
132 |
+# endif |
133 |
# ifndef PRINTF_INT16_HEX_WIDTH |
134 |
# define PRINTF_INT16_HEX_WIDTH "4" |
135 |
# endif |
136 |
+# ifndef PRINTF_UINT16_HEX_WIDTH |
137 |
+# define PRINTF_UINT16_HEX_WIDTH "4" |
138 |
+# endif |
139 |
# ifndef PRINTF_INT8_HEX_WIDTH |
140 |
# define PRINTF_INT8_HEX_WIDTH "2" |
141 |
# endif |
142 |
+# ifndef PRINTF_UINT8_HEX_WIDTH |
143 |
+# define PRINTF_UINT8_HEX_WIDTH "2" |
144 |
+# endif |
145 |
# ifndef PRINTF_INT64_DEC_WIDTH |
146 |
-# define PRINTF_INT64_DEC_WIDTH "20" |
147 |
+# define PRINTF_INT64_DEC_WIDTH "19" |
148 |
+# endif |
149 |
+# ifndef PRINTF_UINT64_DEC_WIDTH |
150 |
+# define PRINTF_UINT64_DEC_WIDTH "20" |
151 |
# endif |
152 |
# ifndef PRINTF_INT32_DEC_WIDTH |
153 |
# define PRINTF_INT32_DEC_WIDTH "10" |
154 |
# endif |
155 |
+# ifndef PRINTF_UINT32_DEC_WIDTH |
156 |
+# define PRINTF_UINT32_DEC_WIDTH "10" |
157 |
+# endif |
158 |
# ifndef PRINTF_INT16_DEC_WIDTH |
159 |
# define PRINTF_INT16_DEC_WIDTH "5" |
160 |
# endif |
161 |
+# ifndef PRINTF_UINT16_DEC_WIDTH |
162 |
+# define PRINTF_UINT16_DEC_WIDTH "5" |
163 |
+# endif |
164 |
# ifndef PRINTF_INT8_DEC_WIDTH |
165 |
# define PRINTF_INT8_DEC_WIDTH "3" |
166 |
# endif |
167 |
+# ifndef PRINTF_UINT8_DEC_WIDTH |
168 |
+# define PRINTF_UINT8_DEC_WIDTH "3" |
169 |
+# endif |
170 |
# ifndef PRINTF_INTMAX_HEX_WIDTH |
171 |
-# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH |
172 |
+# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH |
173 |
+# endif |
174 |
+# ifndef PRINTF_UINTMAX_HEX_WIDTH |
175 |
+# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH |
176 |
# endif |
177 |
# ifndef PRINTF_INTMAX_DEC_WIDTH |
178 |
-# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH |
179 |
+# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH |
180 |
+# endif |
181 |
+# ifndef PRINTF_UINTMAX_DEC_WIDTH |
182 |
+# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH |
183 |
# endif |
184 |
|
185 |
/* |
186 |
@@ -287,6 +337,20 @@ |
187 |
# endif |
188 |
#endif |
189 |
|
190 |
+/* |
191 |
+ * I have no idea what is the truly correct thing to do on older Solaris. |
192 |
+ * From some online discussions, this seems to be what is being |
193 |
+ * recommended. For people who actually are developing on older Solaris, |
194 |
+ * what I would like to know is, does this define all of the relevant |
195 |
+ * macros of a complete stdint.h? Remember, in pstdint.h 64 bit is |
196 |
+ * considered optional. |
197 |
+ */ |
198 |
+ |
199 |
+#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED) |
200 |
+#include <sys/inttypes.h> |
201 |
+#define _PSTDINT_H_INCLUDED |
202 |
+#endif |
203 |
+ |
204 |
#ifndef _PSTDINT_H_INCLUDED |
205 |
#define _PSTDINT_H_INCLUDED |
206 |
|
207 |
@@ -303,7 +367,7 @@ |
208 |
#ifndef UINT8_MAX |
209 |
# define UINT8_MAX 0xff |
210 |
#endif |
211 |
-#ifndef uint8_t |
212 |
+#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks) |
213 |
# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) |
214 |
typedef unsigned char uint8_t; |
215 |
# define UINT8_C(v) ((uint8_t) v) |
216 |
@@ -318,7 +382,7 @@ |
217 |
#ifndef INT8_MIN |
218 |
# define INT8_MIN INT8_C(0x80) |
219 |
#endif |
220 |
-#ifndef int8_t |
221 |
+#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks) |
222 |
# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) |
223 |
typedef signed char int8_t; |
224 |
# define INT8_C(v) ((int8_t) v) |
225 |
@@ -330,7 +394,7 @@ |
226 |
#ifndef UINT16_MAX |
227 |
# define UINT16_MAX 0xffff |
228 |
#endif |
229 |
-#ifndef uint16_t |
230 |
+#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks) |
231 |
#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) |
232 |
typedef unsigned int uint16_t; |
233 |
# ifndef PRINTF_INT16_MODIFIER |
234 |
@@ -354,7 +418,7 @@ |
235 |
#ifndef INT16_MIN |
236 |
# define INT16_MIN INT16_C(0x8000) |
237 |
#endif |
238 |
-#ifndef int16_t |
239 |
+#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks) |
240 |
#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) |
241 |
typedef signed int int16_t; |
242 |
# define INT16_C(v) ((int16_t) (v)) |
243 |
@@ -375,7 +439,7 @@ |
244 |
#ifndef UINT32_MAX |
245 |
# define UINT32_MAX (0xffffffffUL) |
246 |
#endif |
247 |
-#ifndef uint32_t |
248 |
+#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks) |
249 |
#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) |
250 |
typedef unsigned long uint32_t; |
251 |
# define UINT32_C(v) v ## UL |
252 |
@@ -405,7 +469,7 @@ |
253 |
#ifndef INT32_MIN |
254 |
# define INT32_MIN INT32_C(0x80000000) |
255 |
#endif |
256 |
-#ifndef int32_t |
257 |
+#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks) |
258 |
#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) |
259 |
typedef signed long int32_t; |
260 |
# define INT32_C(v) v ## L |
261 |
@@ -438,7 +502,7 @@ |
262 |
|
263 |
#undef stdint_int64_defined |
264 |
#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) |
265 |
-# if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S) |
266 |
+# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S) |
267 |
# define stdint_int64_defined |
268 |
typedef long long int64_t; |
269 |
typedef unsigned long long uint64_t; |
270 |
@@ -451,7 +515,7 @@ |
271 |
#endif |
272 |
|
273 |
#if !defined (stdint_int64_defined) |
274 |
-# if defined(__GNUC__) |
275 |
+# if defined(__GNUC__) && !defined(vxWorks) |
276 |
# define stdint_int64_defined |
277 |
__extension__ typedef long long int64_t; |
278 |
__extension__ typedef unsigned long long uint64_t; |
279 |
@@ -514,9 +578,8 @@ |
280 |
#ifndef PRINTF_INT8_HEX_WIDTH |
281 |
# define PRINTF_INT8_HEX_WIDTH "2" |
282 |
#endif |
283 |
- |
284 |
#ifndef PRINTF_INT64_DEC_WIDTH |
285 |
-# define PRINTF_INT64_DEC_WIDTH "20" |
286 |
+# define PRINTF_INT64_DEC_WIDTH "19" |
287 |
#endif |
288 |
#ifndef PRINTF_INT32_DEC_WIDTH |
289 |
# define PRINTF_INT32_DEC_WIDTH "10" |
290 |
@@ -527,6 +590,18 @@ |
291 |
#ifndef PRINTF_INT8_DEC_WIDTH |
292 |
# define PRINTF_INT8_DEC_WIDTH "3" |
293 |
#endif |
294 |
+#ifndef PRINTF_UINT64_DEC_WIDTH |
295 |
+# define PRINTF_UINT64_DEC_WIDTH "20" |
296 |
+#endif |
297 |
+#ifndef PRINTF_UINT32_DEC_WIDTH |
298 |
+# define PRINTF_UINT32_DEC_WIDTH "10" |
299 |
+#endif |
300 |
+#ifndef PRINTF_UINT16_DEC_WIDTH |
301 |
+# define PRINTF_UINT16_DEC_WIDTH "5" |
302 |
+#endif |
303 |
+#ifndef PRINTF_UINT8_DEC_WIDTH |
304 |
+# define PRINTF_UINT8_DEC_WIDTH "3" |
305 |
+#endif |
306 |
|
307 |
/* |
308 |
* Ok, lets not worry about 128 bit integers for now. Moore's law says |
309 |
@@ -646,7 +721,7 @@ typedef uint_least32_t uint_fast32_t; |
310 |
* type limits. |
311 |
*/ |
312 |
|
313 |
-#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) |
314 |
+#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks) |
315 |
# include <wchar.h> |
316 |
# ifndef WCHAR_MIN |
317 |
# define WCHAR_MIN 0 |
318 |
@@ -661,12 +736,12 @@ typedef uint_least32_t uint_fast32_t; |
319 |
* (u)intptr_t types and limits. |
320 |
*/ |
321 |
|
322 |
-#if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED) |
323 |
+#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T) |
324 |
# define STDINT_H_UINTPTR_T_DEFINED |
325 |
#endif |
326 |
|
327 |
#ifndef STDINT_H_UINTPTR_T_DEFINED |
328 |
-# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) |
329 |
+# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__) |
330 |
# define stdint_intptr_bits 64 |
331 |
# elif defined (__WATCOMC__) || defined (__TURBOC__) |
332 |
# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) |
333 |
@@ -674,10 +749,12 @@ typedef uint_least32_t uint_fast32_t; |
334 |
# else |
335 |
# define stdint_intptr_bits 32 |
336 |
# endif |
337 |
-# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) |
338 |
+# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__) |
339 |
# define stdint_intptr_bits 32 |
340 |
# elif defined (__INTEL_COMPILER) |
341 |
-/* TODO -- what will Intel do about x86-64? */ |
342 |
+/* TODO -- what did Intel do about x86-64? */ |
343 |
+# else |
344 |
+/* #error "This platform might not be supported yet" */ |
345 |
# endif |
346 |
|
347 |
# ifdef stdint_intptr_bits |
348 |
@@ -727,3 +804,109 @@ typedef uint_least32_t uint_fast32_t; |
349 |
|
350 |
#endif |
351 |
|
352 |
+#if defined (__TEST_PSTDINT_FOR_CORRECTNESS) |
353 |
+ |
354 |
+/* |
355 |
+ * Please compile with the maximum warning settings to make sure macros are |
356 |
+ * not defined more than once. |
357 |
+ */ |
358 |
+ |
359 |
+#include <stdlib.h> |
360 |
+#include <stdio.h> |
361 |
+#include <string.h> |
362 |
+ |
363 |
+#define glue3_aux(x,y,z) x ## y ## z |
364 |
+#define glue3(x,y,z) glue3_aux(x,y,z) |
365 |
+ |
366 |
+#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0); |
367 |
+#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0); |
368 |
+ |
369 |
+#define DECL(us,bits) glue3(DECL,us,) (bits) |
370 |
+ |
371 |
+#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf ("Something wrong with UINT%d_MAX\n", bits) |
372 |
+ |
373 |
+#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; } |
374 |
+ |
375 |
+int main () { |
376 |
+ int err_n = 0; |
377 |
+ int err_first = 0; |
378 |
+ DECL(I,8) |
379 |
+ DECL(U,8) |
380 |
+ DECL(I,16) |
381 |
+ DECL(U,16) |
382 |
+ DECL(I,32) |
383 |
+ DECL(U,32) |
384 |
+#ifdef INT64_MAX |
385 |
+ DECL(I,64) |
386 |
+ DECL(U,64) |
387 |
+#endif |
388 |
+ intmax_t imax = INTMAX_C(0); |
389 |
+ uintmax_t umax = UINTMAX_C(0); |
390 |
+ char str0[256], str1[256]; |
391 |
+ |
392 |
+ sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647)); |
393 |
+ if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); |
394 |
+ if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH)); |
395 |
+ sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295)); |
396 |
+ if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); |
397 |
+ if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH)); |
398 |
+#ifdef INT64_MAX |
399 |
+ sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807)); |
400 |
+ if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); |
401 |
+ if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1))); |
402 |
+ sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591)); |
403 |
+ if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); |
404 |
+ if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1))); |
405 |
+#endif |
406 |
+ |
407 |
+ sprintf (str0, "%d %x\n", 0, ~0); |
408 |
+ |
409 |
+ sprintf (str1, "%d %x\n", i8, ~0); |
410 |
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1)); |
411 |
+ sprintf (str1, "%u %x\n", u8, ~0); |
412 |
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1)); |
413 |
+ sprintf (str1, "%d %x\n", i16, ~0); |
414 |
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1)); |
415 |
+ sprintf (str1, "%u %x\n", u16, ~0); |
416 |
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1)); |
417 |
+ sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0); |
418 |
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1)); |
419 |
+ sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0); |
420 |
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1)); |
421 |
+#ifdef INT64_MAX |
422 |
+ sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0); |
423 |
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1)); |
424 |
+#endif |
425 |
+ sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0); |
426 |
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1)); |
427 |
+ sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0); |
428 |
+ if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1)); |
429 |
+ |
430 |
+ TESTUMAX(8); |
431 |
+ TESTUMAX(16); |
432 |
+ TESTUMAX(32); |
433 |
+#ifdef INT64_MAX |
434 |
+ TESTUMAX(64); |
435 |
+#endif |
436 |
+ |
437 |
+#define STR(v) #v |
438 |
+#define Q(v) printf ("sizeof " STR(v) " = %u\n", (unsigned) sizeof (v)); |
439 |
+ if (err_n) { |
440 |
+ printf ("pstdint.h is not correct. Please use sizes below to correct it:\n"); |
441 |
+ } |
442 |
+ |
443 |
+ Q(int) |
444 |
+ Q(unsigned) |
445 |
+ Q(long int) |
446 |
+ Q(short int) |
447 |
+ Q(int8_t) |
448 |
+ Q(int16_t) |
449 |
+ Q(int32_t) |
450 |
+#ifdef INT64_MAX |
451 |
+ Q(int64_t) |
452 |
+#endif |
453 |
+ |
454 |
+ return EXIT_SUCCESS; |
455 |
+} |
456 |
+ |
457 |
+#endif |