1 /* Copyright (C) 2001-2002, 2004-2018 Free Software Foundation, Inc.
2    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
3    This file is part of gnulib.
4 
5    This program is free software: you can redistribute it and/or
6    modify it under the terms of either:
7 
8      * the GNU Lesser General Public License as published by the Free
9        Software Foundation; either version 3 of the License, or (at your
10        option) any later version.
11 
12    or
13 
14      * the GNU General Public License as published by the Free
15        Software Foundation; either version 2 of the License, or (at your
16        option) any later version.
17 
18    or both in parallel, as here.
19    This program is distributed in the hope that it will be useful,
20    but WITHOUT ANY WARRANTY; without even the implied warranty of
21    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22    GNU General Public License for more details.
23 
24    You should have received a copy of the GNU General Public License
25    along with this program; if not, see <https://www.gnu.org/licenses/>.  */
26 
27 /*
28  * ISO C 99 <stdint.h> for platforms that lack it.
29  * <http://www.opengroup.org/susv3xbd/stdint.h.html>
30  */
31 
32 #ifndef _@GUARD_PREFIX@_STDINT_H
33 
34 #if __GNUC__ >= 3
35 @PRAGMA_SYSTEM_HEADER@
36 #endif
37 @PRAGMA_COLUMNS@
38 
39 /* When including a system file that in turn includes <inttypes.h>,
40    use the system <inttypes.h>, not our substitute.  This avoids
41    problems with (for example) VMS, whose <sys/bitypes.h> includes
42    <inttypes.h>.  */
43 #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
44 
45 /* On Android (Bionic libc), <sys/types.h> includes this file before
46    having defined 'time_t'.  Therefore in this case avoid including
47    other system header files; just include the system's <stdint.h>.
48    Ideally we should test __BIONIC__ here, but it is only defined after
49    <sys/cdefs.h> has been included; hence test __ANDROID__ instead.  */
50 #if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H
51 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
52 #else
53 
54 /* Get those types that are already defined in other system include
55    files, so that we can "#define int8_t signed char" below without
56    worrying about a later system include file containing a "typedef
57    signed char int8_t;" that will get messed up by our macro.  Our
58    macros should all be consistent with the system versions, except
59    for the "fast" types and macros, which we recommend against using
60    in public interfaces due to compiler differences.  */
61 
62 #if @HAVE_STDINT_H@
63 # if defined __sgi && ! defined __c99
64    /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users
65       with "This header file is to be used only for c99 mode compilations"
66       diagnostics.  */
67 #  define __STDINT_H__
68 # endif
69 
70   /* Some pre-C++11 <stdint.h> implementations need this.  */
71 # ifdef __cplusplus
72 #  ifndef __STDC_CONSTANT_MACROS
73 #   define __STDC_CONSTANT_MACROS 1
74 #  endif
75 #  ifndef __STDC_LIMIT_MACROS
76 #   define __STDC_LIMIT_MACROS 1
77 #  endif
78 # endif
79 
80   /* Other systems may have an incomplete or buggy <stdint.h>.
81      Include it before <inttypes.h>, since any "#include <stdint.h>"
82      in <inttypes.h> would reinclude us, skipping our contents because
83      _@GUARD_PREFIX@_STDINT_H is defined.
84      The include_next requires a split double-inclusion guard.  */
85 # @INCLUDE_NEXT@ @NEXT_STDINT_H@
86 #endif
87 
88 #if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H
89 #define _@GUARD_PREFIX@_STDINT_H
90 
91 /* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
92    LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH.  */
93 #include <limits.h>
94 
95 /* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides
96    wint_t.  */
97 #if @GNULIB_OVERRIDES_WINT_T@
98 # undef WINT_MIN
99 # undef WINT_MAX
100 # define WINT_MIN 0x0U
101 # define WINT_MAX 0xffffffffU
102 #endif
103 
104 #if ! @HAVE_C99_STDINT_H@
105 
106 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
107    IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
108    AIX 5.2 <sys/types.h> isn't needed and causes troubles.
109    Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
110    relies on the system <stdint.h> definitions, so include
111    <sys/types.h> after @NEXT_STDINT_H@.  */
112 # if @HAVE_SYS_TYPES_H@ && ! defined _AIX
113 #  include <sys/types.h>
114 # endif
115 
116 # if @HAVE_INTTYPES_H@
117   /* In OpenBSD 3.8, <inttypes.h> includes <machine/types.h>, which defines
118      int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__.
119      <inttypes.h> also defines intptr_t and uintptr_t.  */
120 #  include <inttypes.h>
121 # elif @HAVE_SYS_INTTYPES_H@
122   /* Solaris 7 <sys/inttypes.h> has the types except the *_fast*_t types, and
123      the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX.  */
124 #  include <sys/inttypes.h>
125 # endif
126 
127 # if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__
128   /* Linux libc4 >= 4.6.7 and libc5 have a <sys/bitypes.h> that defines
129      int{8,16,32,64}_t and __BIT_TYPES_DEFINED__.  In libc5 >= 5.2.2 it is
130      included by <sys/types.h>.  */
131 #  include <sys/bitypes.h>
132 # endif
133 
134 # undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
135 
136 /* Minimum and maximum values for an integer type under the usual assumption.
137    Return an unspecified value if BITS == 0, adding a check to pacify
138    picky compilers.  */
139 
140 /* These are separate macros, because if you try to merge these macros into
141    a single one, HP-UX cc rejects the resulting expression in constant
142    expressions.  */
143 # define _STDINT_UNSIGNED_MIN(bits, zero) \
144     (zero)
145 # define _STDINT_SIGNED_MIN(bits, zero) \
146     (~ _STDINT_MAX (1, bits, zero))
147 
148 # define _STDINT_MAX(signed, bits, zero) \
149     (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1)
150 
151 #if !GNULIB_defined_stdint_types
152 
153 /* 7.18.1.1. Exact-width integer types */
154 
155 /* Here we assume a standard architecture where the hardware integer
156    types have 8, 16, 32, optionally 64 bits.  */
157 
158 # undef int8_t
159 # undef uint8_t
160 typedef signed char gl_int8_t;
161 typedef unsigned char gl_uint8_t;
162 # define int8_t gl_int8_t
163 # define uint8_t gl_uint8_t
164 
165 # undef int16_t
166 # undef uint16_t
167 typedef short int gl_int16_t;
168 typedef unsigned short int gl_uint16_t;
169 # define int16_t gl_int16_t
170 # define uint16_t gl_uint16_t
171 
172 # undef int32_t
173 # undef uint32_t
174 typedef int gl_int32_t;
175 typedef unsigned int gl_uint32_t;
176 # define int32_t gl_int32_t
177 # define uint32_t gl_uint32_t
178 
179 /* If the system defines INT64_MAX, assume int64_t works.  That way,
180    if the underlying platform defines int64_t to be a 64-bit long long
181    int, the code below won't mistakenly define it to be a 64-bit long
182    int, which would mess up C++ name mangling.  We must use #ifdef
183    rather than #if, to avoid an error with HP-UX 10.20 cc.  */
184 
185 # ifdef INT64_MAX
186 #  define GL_INT64_T
187 # else
188 /* Do not undefine int64_t if gnulib is not being used with 64-bit
189    types, since otherwise it breaks platforms like Tandem/NSK.  */
190 #  if LONG_MAX >> 31 >> 31 == 1
191 #   undef int64_t
192 typedef long int gl_int64_t;
193 #   define int64_t gl_int64_t
194 #   define GL_INT64_T
195 #  elif defined _MSC_VER
196 #   undef int64_t
197 typedef __int64 gl_int64_t;
198 #   define int64_t gl_int64_t
199 #   define GL_INT64_T
200 #  elif @HAVE_LONG_LONG_INT@
201 #   undef int64_t
202 typedef long long int gl_int64_t;
203 #   define int64_t gl_int64_t
204 #   define GL_INT64_T
205 #  endif
206 # endif
207 
208 # ifdef UINT64_MAX
209 #  define GL_UINT64_T
210 # else
211 #  if ULONG_MAX >> 31 >> 31 >> 1 == 1
212 #   undef uint64_t
213 typedef unsigned long int gl_uint64_t;
214 #   define uint64_t gl_uint64_t
215 #   define GL_UINT64_T
216 #  elif defined _MSC_VER
217 #   undef uint64_t
218 typedef unsigned __int64 gl_uint64_t;
219 #   define uint64_t gl_uint64_t
220 #   define GL_UINT64_T
221 #  elif @HAVE_UNSIGNED_LONG_LONG_INT@
222 #   undef uint64_t
223 typedef unsigned long long int gl_uint64_t;
224 #   define uint64_t gl_uint64_t
225 #   define GL_UINT64_T
226 #  endif
227 # endif
228 
229 /* Avoid collision with Solaris 2.5.1 <pthread.h> etc.  */
230 # define _UINT8_T
231 # define _UINT32_T
232 # define _UINT64_T
233 
234 
235 /* 7.18.1.2. Minimum-width integer types */
236 
237 /* Here we assume a standard architecture where the hardware integer
238    types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
239    are the same as the corresponding N_t types.  */
240 
241 # undef int_least8_t
242 # undef uint_least8_t
243 # undef int_least16_t
244 # undef uint_least16_t
245 # undef int_least32_t
246 # undef uint_least32_t
247 # undef int_least64_t
248 # undef uint_least64_t
249 # define int_least8_t int8_t
250 # define uint_least8_t uint8_t
251 # define int_least16_t int16_t
252 # define uint_least16_t uint16_t
253 # define int_least32_t int32_t
254 # define uint_least32_t uint32_t
255 # ifdef GL_INT64_T
256 #  define int_least64_t int64_t
257 # endif
258 # ifdef GL_UINT64_T
259 #  define uint_least64_t uint64_t
260 # endif
261 
262 /* 7.18.1.3. Fastest minimum-width integer types */
263 
264 /* Note: Other <stdint.h> substitutes may define these types differently.
265    It is not recommended to use these types in public header files. */
266 
267 /* Here we assume a standard architecture where the hardware integer
268    types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
269    are taken from the same list of types.  The following code normally
270    uses types consistent with glibc, as that lessens the chance of
271    incompatibility with older GNU hosts.  */
272 
273 # undef int_fast8_t
274 # undef uint_fast8_t
275 # undef int_fast16_t
276 # undef uint_fast16_t
277 # undef int_fast32_t
278 # undef uint_fast32_t
279 # undef int_fast64_t
280 # undef uint_fast64_t
281 typedef signed char gl_int_fast8_t;
282 typedef unsigned char gl_uint_fast8_t;
283 
284 # ifdef __sun
285 /* Define types compatible with SunOS 5.10, so that code compiled under
286    earlier SunOS versions works with code compiled under SunOS 5.10.  */
287 typedef int gl_int_fast32_t;
288 typedef unsigned int gl_uint_fast32_t;
289 # else
290 typedef long int gl_int_fast32_t;
291 typedef unsigned long int gl_uint_fast32_t;
292 # endif
293 typedef gl_int_fast32_t gl_int_fast16_t;
294 typedef gl_uint_fast32_t gl_uint_fast16_t;
295 
296 # define int_fast8_t gl_int_fast8_t
297 # define uint_fast8_t gl_uint_fast8_t
298 # define int_fast16_t gl_int_fast16_t
299 # define uint_fast16_t gl_uint_fast16_t
300 # define int_fast32_t gl_int_fast32_t
301 # define uint_fast32_t gl_uint_fast32_t
302 # ifdef GL_INT64_T
303 #  define int_fast64_t int64_t
304 # endif
305 # ifdef GL_UINT64_T
306 #  define uint_fast64_t uint64_t
307 # endif
308 
309 /* 7.18.1.4. Integer types capable of holding object pointers */
310 
311 /* kLIBC's stdint.h defines _INTPTR_T_DECLARED and needs its own
312    definitions of intptr_t and uintptr_t (which use int and unsigned)
313    to avoid clashes with declarations of system functions like sbrk.  */
314 # ifndef _INTPTR_T_DECLARED
315 # undef intptr_t
316 # undef uintptr_t
317 typedef long int gl_intptr_t;
318 typedef unsigned long int gl_uintptr_t;
319 # define intptr_t gl_intptr_t
320 # define uintptr_t gl_uintptr_t
321 # endif
322 
323 /* 7.18.1.5. Greatest-width integer types */
324 
325 /* Note: These types are compiler dependent. It may be unwise to use them in
326    public header files. */
327 
328 /* If the system defines INTMAX_MAX, assume that intmax_t works, and
329    similarly for UINTMAX_MAX and uintmax_t.  This avoids problems with
330    assuming one type where another is used by the system.  */
331 
332 # ifndef INTMAX_MAX
333 #  undef INTMAX_C
334 #  undef intmax_t
335 #  if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
336 typedef long long int gl_intmax_t;
337 #   define intmax_t gl_intmax_t
338 #  elif defined GL_INT64_T
339 #   define intmax_t int64_t
340 #  else
341 typedef long int gl_intmax_t;
342 #   define intmax_t gl_intmax_t
343 #  endif
344 # endif
345 
346 # ifndef UINTMAX_MAX
347 #  undef UINTMAX_C
348 #  undef uintmax_t
349 #  if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
350 typedef unsigned long long int gl_uintmax_t;
351 #   define uintmax_t gl_uintmax_t
352 #  elif defined GL_UINT64_T
353 #   define uintmax_t uint64_t
354 #  else
355 typedef unsigned long int gl_uintmax_t;
356 #   define uintmax_t gl_uintmax_t
357 #  endif
358 # endif
359 
360 /* Verify that intmax_t and uintmax_t have the same size.  Too much code
361    breaks if this is not the case.  If this check fails, the reason is likely
362    to be found in the autoconf macros.  */
363 typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
364                                 ? 1 : -1];
365 
366 # define GNULIB_defined_stdint_types 1
367 # endif /* !GNULIB_defined_stdint_types */
368 
369 /* 7.18.2. Limits of specified-width integer types */
370 
371 /* 7.18.2.1. Limits of exact-width integer types */
372 
373 /* Here we assume a standard architecture where the hardware integer
374    types have 8, 16, 32, optionally 64 bits.  */
375 
376 # undef INT8_MIN
377 # undef INT8_MAX
378 # undef UINT8_MAX
379 # define INT8_MIN  (~ INT8_MAX)
380 # define INT8_MAX  127
381 # define UINT8_MAX  255
382 
383 # undef INT16_MIN
384 # undef INT16_MAX
385 # undef UINT16_MAX
386 # define INT16_MIN  (~ INT16_MAX)
387 # define INT16_MAX  32767
388 # define UINT16_MAX  65535
389 
390 # undef INT32_MIN
391 # undef INT32_MAX
392 # undef UINT32_MAX
393 # define INT32_MIN  (~ INT32_MAX)
394 # define INT32_MAX  2147483647
395 # define UINT32_MAX  4294967295U
396 
397 # if defined GL_INT64_T && ! defined INT64_MAX
398 /* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0
399    evaluates the latter incorrectly in preprocessor expressions.  */
400 #  define INT64_MIN  (- INTMAX_C (1) << 63)
401 #  define INT64_MAX  INTMAX_C (9223372036854775807)
402 # endif
403 
404 # if defined GL_UINT64_T && ! defined UINT64_MAX
405 #  define UINT64_MAX  UINTMAX_C (18446744073709551615)
406 # endif
407 
408 /* 7.18.2.2. Limits of minimum-width integer types */
409 
410 /* Here we assume a standard architecture where the hardware integer
411    types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types
412    are the same as the corresponding N_t types.  */
413 
414 # undef INT_LEAST8_MIN
415 # undef INT_LEAST8_MAX
416 # undef UINT_LEAST8_MAX
417 # define INT_LEAST8_MIN  INT8_MIN
418 # define INT_LEAST8_MAX  INT8_MAX
419 # define UINT_LEAST8_MAX  UINT8_MAX
420 
421 # undef INT_LEAST16_MIN
422 # undef INT_LEAST16_MAX
423 # undef UINT_LEAST16_MAX
424 # define INT_LEAST16_MIN  INT16_MIN
425 # define INT_LEAST16_MAX  INT16_MAX
426 # define UINT_LEAST16_MAX  UINT16_MAX
427 
428 # undef INT_LEAST32_MIN
429 # undef INT_LEAST32_MAX
430 # undef UINT_LEAST32_MAX
431 # define INT_LEAST32_MIN  INT32_MIN
432 # define INT_LEAST32_MAX  INT32_MAX
433 # define UINT_LEAST32_MAX  UINT32_MAX
434 
435 # undef INT_LEAST64_MIN
436 # undef INT_LEAST64_MAX
437 # ifdef GL_INT64_T
438 #  define INT_LEAST64_MIN  INT64_MIN
439 #  define INT_LEAST64_MAX  INT64_MAX
440 # endif
441 
442 # undef UINT_LEAST64_MAX
443 # ifdef GL_UINT64_T
444 #  define UINT_LEAST64_MAX  UINT64_MAX
445 # endif
446 
447 /* 7.18.2.3. Limits of fastest minimum-width integer types */
448 
449 /* Here we assume a standard architecture where the hardware integer
450    types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
451    are taken from the same list of types.  */
452 
453 # undef INT_FAST8_MIN
454 # undef INT_FAST8_MAX
455 # undef UINT_FAST8_MAX
456 # define INT_FAST8_MIN  SCHAR_MIN
457 # define INT_FAST8_MAX  SCHAR_MAX
458 # define UINT_FAST8_MAX  UCHAR_MAX
459 
460 # undef INT_FAST16_MIN
461 # undef INT_FAST16_MAX
462 # undef UINT_FAST16_MAX
463 # define INT_FAST16_MIN  INT_FAST32_MIN
464 # define INT_FAST16_MAX  INT_FAST32_MAX
465 # define UINT_FAST16_MAX  UINT_FAST32_MAX
466 
467 # undef INT_FAST32_MIN
468 # undef INT_FAST32_MAX
469 # undef UINT_FAST32_MAX
470 # ifdef __sun
471 #  define INT_FAST32_MIN  INT_MIN
472 #  define INT_FAST32_MAX  INT_MAX
473 #  define UINT_FAST32_MAX  UINT_MAX
474 # else
475 #  define INT_FAST32_MIN  LONG_MIN
476 #  define INT_FAST32_MAX  LONG_MAX
477 #  define UINT_FAST32_MAX  ULONG_MAX
478 # endif
479 
480 # undef INT_FAST64_MIN
481 # undef INT_FAST64_MAX
482 # ifdef GL_INT64_T
483 #  define INT_FAST64_MIN  INT64_MIN
484 #  define INT_FAST64_MAX  INT64_MAX
485 # endif
486 
487 # undef UINT_FAST64_MAX
488 # ifdef GL_UINT64_T
489 #  define UINT_FAST64_MAX  UINT64_MAX
490 # endif
491 
492 /* 7.18.2.4. Limits of integer types capable of holding object pointers */
493 
494 # undef INTPTR_MIN
495 # undef INTPTR_MAX
496 # undef UINTPTR_MAX
497 # define INTPTR_MIN  LONG_MIN
498 # define INTPTR_MAX  LONG_MAX
499 # define UINTPTR_MAX  ULONG_MAX
500 
501 /* 7.18.2.5. Limits of greatest-width integer types */
502 
503 # ifndef INTMAX_MAX
504 #  undef INTMAX_MIN
505 #  ifdef INT64_MAX
506 #   define INTMAX_MIN  INT64_MIN
507 #   define INTMAX_MAX  INT64_MAX
508 #  else
509 #   define INTMAX_MIN  INT32_MIN
510 #   define INTMAX_MAX  INT32_MAX
511 #  endif
512 # endif
513 
514 # ifndef UINTMAX_MAX
515 #  ifdef UINT64_MAX
516 #   define UINTMAX_MAX  UINT64_MAX
517 #  else
518 #   define UINTMAX_MAX  UINT32_MAX
519 #  endif
520 # endif
521 
522 /* 7.18.3. Limits of other integer types */
523 
524 /* ptrdiff_t limits */
525 # undef PTRDIFF_MIN
526 # undef PTRDIFF_MAX
527 # if @APPLE_UNIVERSAL_BUILD@
528 #  ifdef _LP64
529 #   define PTRDIFF_MIN  _STDINT_SIGNED_MIN (64, 0l)
530 #   define PTRDIFF_MAX  _STDINT_MAX (1, 64, 0l)
531 #  else
532 #   define PTRDIFF_MIN  _STDINT_SIGNED_MIN (32, 0)
533 #   define PTRDIFF_MAX  _STDINT_MAX (1, 32, 0)
534 #  endif
535 # else
536 #  define PTRDIFF_MIN  \
537     _STDINT_SIGNED_MIN (@BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
538 #  define PTRDIFF_MAX  \
539     _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@)
540 # endif
541 
542 /* sig_atomic_t limits */
543 # undef SIG_ATOMIC_MIN
544 # undef SIG_ATOMIC_MAX
545 # if @HAVE_SIGNED_SIG_ATOMIC_T@
546 #  define SIG_ATOMIC_MIN  \
547     _STDINT_SIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@)
548 # else
549 #  define SIG_ATOMIC_MIN  \
550     _STDINT_UNSIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@)
551 # endif
552 # define SIG_ATOMIC_MAX  \
553    _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \
554                 0@SIG_ATOMIC_T_SUFFIX@)
555 
556 
557 /* size_t limit */
558 # undef SIZE_MAX
559 # if @APPLE_UNIVERSAL_BUILD@
560 #  ifdef _LP64
561 #   define SIZE_MAX  _STDINT_MAX (0, 64, 0ul)
562 #  else
563 #   define SIZE_MAX  _STDINT_MAX (0, 32, 0ul)
564 #  endif
565 # else
566 #  define SIZE_MAX  _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@)
567 # endif
568 
569 /* wchar_t limits */
570 /* Get WCHAR_MIN, WCHAR_MAX.
571    This include is not on the top, above, because on OSF/1 4.0 we have a
572    sequence of nested includes
573    <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes
574    <stdint.h> and assumes its types are already defined.  */
575 # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX)
576   /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
577      included before <wchar.h>.  */
578 #  include <stddef.h>
579 #  include <stdio.h>
580 #  include <time.h>
581 #  define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
582 #  include <wchar.h>
583 #  undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H
584 # endif
585 # undef WCHAR_MIN
586 # undef WCHAR_MAX
587 # if @HAVE_SIGNED_WCHAR_T@
588 #  define WCHAR_MIN  \
589     _STDINT_SIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
590 # else
591 #  define WCHAR_MIN  \
592     _STDINT_UNSIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
593 # endif
594 # define WCHAR_MAX  \
595    _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@)
596 
597 /* wint_t limits */
598 # undef WINT_MIN
599 # undef WINT_MAX
600 # if @HAVE_SIGNED_WINT_T@
601 #  define WINT_MIN  \
602     _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
603 # else
604 #  define WINT_MIN  \
605     _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
606 # endif
607 # define WINT_MAX  \
608    _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
609 
610 /* 7.18.4. Macros for integer constants */
611 
612 /* 7.18.4.1. Macros for minimum-width integer constants */
613 /* According to ISO C 99 Technical Corrigendum 1 */
614 
615 /* Here we assume a standard architecture where the hardware integer
616    types have 8, 16, 32, optionally 64 bits, and int is 32 bits.  */
617 
618 # undef INT8_C
619 # undef UINT8_C
620 # define INT8_C(x) x
621 # define UINT8_C(x) x
622 
623 # undef INT16_C
624 # undef UINT16_C
625 # define INT16_C(x) x
626 # define UINT16_C(x) x
627 
628 # undef INT32_C
629 # undef UINT32_C
630 # define INT32_C(x) x
631 # define UINT32_C(x) x ## U
632 
633 # undef INT64_C
634 # undef UINT64_C
635 # if LONG_MAX >> 31 >> 31 == 1
636 #  define INT64_C(x) x##L
637 # elif defined _MSC_VER
638 #  define INT64_C(x) x##i64
639 # elif @HAVE_LONG_LONG_INT@
640 #  define INT64_C(x) x##LL
641 # endif
642 # if ULONG_MAX >> 31 >> 31 >> 1 == 1
643 #  define UINT64_C(x) x##UL
644 # elif defined _MSC_VER
645 #  define UINT64_C(x) x##ui64
646 # elif @HAVE_UNSIGNED_LONG_LONG_INT@
647 #  define UINT64_C(x) x##ULL
648 # endif
649 
650 /* 7.18.4.2. Macros for greatest-width integer constants */
651 
652 # ifndef INTMAX_C
653 #  if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
654 #   define INTMAX_C(x)   x##LL
655 #  elif defined GL_INT64_T
656 #   define INTMAX_C(x)   INT64_C(x)
657 #  else
658 #   define INTMAX_C(x)   x##L
659 #  endif
660 # endif
661 
662 # ifndef UINTMAX_C
663 #  if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
664 #   define UINTMAX_C(x)  x##ULL
665 #  elif defined GL_UINT64_T
666 #   define UINTMAX_C(x)  UINT64_C(x)
667 #  else
668 #   define UINTMAX_C(x)  x##UL
669 #  endif
670 # endif
671 
672 #endif /* !@HAVE_C99_STDINT_H@ */
673 
674 /* Macros specified by ISO/IEC TS 18661-1:2014.  */
675 
676 #if (!defined UINTMAX_WIDTH \
677      && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__))
678 # ifdef INT8_MAX
679 #  define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX)
680 # endif
681 # ifdef UINT8_MAX
682 #  define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX)
683 # endif
684 # ifdef INT16_MAX
685 #  define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX)
686 # endif
687 # ifdef UINT16_MAX
688 #  define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX)
689 # endif
690 # ifdef INT32_MAX
691 #  define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX)
692 # endif
693 # ifdef UINT32_MAX
694 #  define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX)
695 # endif
696 # ifdef INT64_MAX
697 #  define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX)
698 # endif
699 # ifdef UINT64_MAX
700 #  define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX)
701 # endif
702 # define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX)
703 # define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX)
704 # define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX)
705 # define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX)
706 # define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX)
707 # define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX)
708 # define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX)
709 # define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX)
710 # define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX)
711 # define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX)
712 # define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX)
713 # define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX)
714 # define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX)
715 # define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX)
716 # define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX)
717 # define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX)
718 # define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX)
719 # define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX)
720 # define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX)
721 # define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX)
722 # define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX)
723 # define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX)
724 # define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX)
725 # ifdef WINT_MAX
726 #  define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX)
727 # endif
728 # ifdef SIG_ATOMIC_MAX
729 #  define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX)
730 # endif
731 #endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */
732 
733 #endif /* _@GUARD_PREFIX@_STDINT_H */
734 #endif /* !(defined __ANDROID__ && ...) */
735 #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
736