1/* Copyright (C) 2006-2022 Free Software Foundation, Inc.
2   Written by Paul Eggert, Bruno Haible, Derek Price.
3   This file is part of gnulib.
4
5   This file is free software: you can redistribute it and/or modify
6   it under the terms of the GNU Lesser General Public License as
7   published by the Free Software Foundation; either version 2.1 of the
8   License, or (at your option) any later version.
9
10   This file is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU Lesser General Public License for more details.
14
15   You should have received a copy of the GNU Lesser General Public License
16   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17
18/*
19 * ISO C 99 <inttypes.h> for platforms that lack it.
20 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html>
21 */
22
23#if __GNUC__ >= 3
24@PRAGMA_SYSTEM_HEADER@
25#endif
26@PRAGMA_COLUMNS@
27
28/* Include the original <inttypes.h> if it exists, and if this file
29   has not been included yet or if this file includes gnulib stdint.h
30   which in turn includes this file.
31   The include_next requires a split double-inclusion guard.  */
32#if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
33# if @HAVE_INTTYPES_H@
34
35   /* Some pre-C++11 <stdint.h> implementations need this.  */
36#  if defined __cplusplus && ! defined __STDC_FORMAT_MACROS
37#   define __STDC_FORMAT_MACROS 1
38#  endif
39
40#  @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
41
42#  define _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H
43# endif
44#endif
45
46#if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
47#define INTTYPES_H
48
49/* Include <stdint.h> or the gnulib replacement.
50   But avoid namespace pollution on glibc systems.  */
51#ifndef __GLIBC__
52# include <stdint.h>
53#endif
54/* Get CHAR_BIT, INT_MAX, LONG_MAX, etc.  */
55#include <limits.h>
56/* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */
57#if defined _WIN32 && ! defined __CYGWIN__
58# include <stdio.h>
59#endif
60
61#if !(INT_MAX == 0x7fffffff && INT_MIN + INT_MAX == -1)
62# error "This file assumes that 'int' is 32-bit two's complement. Please report your platform and compiler to <bug-gnulib@gnu.org>."
63#endif
64
65/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
66
67/* The definition of _GL_ARG_NONNULL is copied here.  */
68
69/* The definition of _GL_WARN_ON_USE is copied here.  */
70
71/* 7.8.1 Macros for format specifiers */
72
73#if defined _TNS_R_TARGET
74   /* Tandem NonStop R series and compatible platforms released before
75      July 2005 support %Ld but not %lld.  */
76# define _LONG_LONG_FORMAT_PREFIX "L"
77#else
78# define _LONG_LONG_FORMAT_PREFIX "ll"
79#endif
80
81#if !defined PRId8
82# ifdef INT8_MAX
83#  define PRId8 "d"
84# endif
85#endif
86#if !defined PRIi8
87# ifdef INT8_MAX
88#  define PRIi8 "i"
89# endif
90#endif
91#if !defined PRIo8
92# ifdef UINT8_MAX
93#  define PRIo8 "o"
94# endif
95#endif
96#if !defined PRIu8
97# ifdef UINT8_MAX
98#  define PRIu8 "u"
99# endif
100#endif
101#if !defined PRIx8
102# ifdef UINT8_MAX
103#  define PRIx8 "x"
104# endif
105#endif
106#if !defined PRIX8
107# ifdef UINT8_MAX
108#  define PRIX8 "X"
109# endif
110#endif
111#if !defined PRId16
112# ifdef INT16_MAX
113#  define PRId16 "d"
114# endif
115#endif
116#if !defined PRIi16
117# ifdef INT16_MAX
118#  define PRIi16 "i"
119# endif
120#endif
121#if !defined PRIo16
122# ifdef UINT16_MAX
123#  define PRIo16 "o"
124# endif
125#endif
126#if !defined PRIu16
127# ifdef UINT16_MAX
128#  define PRIu16 "u"
129# endif
130#endif
131#if !defined PRIx16
132# ifdef UINT16_MAX
133#  define PRIx16 "x"
134# endif
135#endif
136#if !defined PRIX16
137# ifdef UINT16_MAX
138#  define PRIX16 "X"
139# endif
140#endif
141#if !defined PRId32
142# ifdef INT32_MAX
143#  define PRId32 "d"
144# endif
145#endif
146#if !defined PRIi32
147# ifdef INT32_MAX
148#  define PRIi32 "i"
149# endif
150#endif
151#if !defined PRIo32
152# ifdef UINT32_MAX
153#  define PRIo32 "o"
154# endif
155#endif
156#if !defined PRIu32
157# ifdef UINT32_MAX
158#  define PRIu32 "u"
159# endif
160#endif
161#if !defined PRIx32
162# ifdef UINT32_MAX
163#  define PRIx32 "x"
164# endif
165#endif
166#if !defined PRIX32
167# ifdef UINT32_MAX
168#  define PRIX32 "X"
169# endif
170#endif
171#ifdef INT64_MAX
172# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
173#  define _PRI64_PREFIX "l"
174# elif defined _MSC_VER || defined __MINGW32__
175#  define _PRI64_PREFIX "I64"
176# elif LONG_MAX >> 30 == 1
177#  define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
178# endif
179# if !defined PRId64
180#  define PRId64 _PRI64_PREFIX "d"
181# endif
182# if !defined PRIi64
183#  define PRIi64 _PRI64_PREFIX "i"
184# endif
185#endif
186#ifdef UINT64_MAX
187# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
188#  define _PRIu64_PREFIX "l"
189# elif defined _MSC_VER || defined __MINGW32__
190#  define _PRIu64_PREFIX "I64"
191# elif ULONG_MAX >> 31 == 1
192#  define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
193# endif
194# if !defined PRIo64
195#  define PRIo64 _PRIu64_PREFIX "o"
196# endif
197# if !defined PRIu64
198#  define PRIu64 _PRIu64_PREFIX "u"
199# endif
200# if !defined PRIx64
201#  define PRIx64 _PRIu64_PREFIX "x"
202# endif
203# if !defined PRIX64
204#  define PRIX64 _PRIu64_PREFIX "X"
205# endif
206#endif
207
208#if !defined PRIdLEAST8
209# define PRIdLEAST8 "d"
210#endif
211#if !defined PRIiLEAST8
212# define PRIiLEAST8 "i"
213#endif
214#if !defined PRIoLEAST8
215# define PRIoLEAST8 "o"
216#endif
217#if !defined PRIuLEAST8
218# define PRIuLEAST8 "u"
219#endif
220#if !defined PRIxLEAST8
221# define PRIxLEAST8 "x"
222#endif
223#if !defined PRIXLEAST8
224# define PRIXLEAST8 "X"
225#endif
226#if !defined PRIdLEAST16
227# define PRIdLEAST16 "d"
228#endif
229#if !defined PRIiLEAST16
230# define PRIiLEAST16 "i"
231#endif
232#if !defined PRIoLEAST16
233# define PRIoLEAST16 "o"
234#endif
235#if !defined PRIuLEAST16
236# define PRIuLEAST16 "u"
237#endif
238#if !defined PRIxLEAST16
239# define PRIxLEAST16 "x"
240#endif
241#if !defined PRIXLEAST16
242# define PRIXLEAST16 "X"
243#endif
244#if !defined PRIdLEAST32
245# define PRIdLEAST32 "d"
246#endif
247#if !defined PRIiLEAST32
248# define PRIiLEAST32 "i"
249#endif
250#if !defined PRIoLEAST32
251# define PRIoLEAST32 "o"
252#endif
253#if !defined PRIuLEAST32
254# define PRIuLEAST32 "u"
255#endif
256#if !defined PRIxLEAST32
257# define PRIxLEAST32 "x"
258#endif
259#if !defined PRIXLEAST32
260# define PRIXLEAST32 "X"
261#endif
262#ifdef INT64_MAX
263# if !defined PRIdLEAST64
264#  define PRIdLEAST64 PRId64
265# endif
266# if !defined PRIiLEAST64
267#  define PRIiLEAST64 PRIi64
268# endif
269#endif
270#ifdef UINT64_MAX
271# if !defined PRIoLEAST64
272#  define PRIoLEAST64 PRIo64
273# endif
274# if !defined PRIuLEAST64
275#  define PRIuLEAST64 PRIu64
276# endif
277# if !defined PRIxLEAST64
278#  define PRIxLEAST64 PRIx64
279# endif
280# if !defined PRIXLEAST64
281#  define PRIXLEAST64 PRIX64
282# endif
283#endif
284
285#if !defined PRIdFAST8
286# if INT_FAST8_MAX > INT32_MAX
287#  define PRIdFAST8 PRId64
288# else
289#  define PRIdFAST8 "d"
290# endif
291#endif
292#if !defined PRIiFAST8
293# if INT_FAST8_MAX > INT32_MAX
294#  define PRIiFAST8 PRIi64
295# else
296#  define PRIiFAST8 "i"
297# endif
298#endif
299#if !defined PRIoFAST8
300# if UINT_FAST8_MAX > UINT32_MAX
301#  define PRIoFAST8 PRIo64
302# else
303#  define PRIoFAST8 "o"
304# endif
305#endif
306#if !defined PRIuFAST8
307# if UINT_FAST8_MAX > UINT32_MAX
308#  define PRIuFAST8 PRIu64
309# else
310#  define PRIuFAST8 "u"
311# endif
312#endif
313#if !defined PRIxFAST8
314# if UINT_FAST8_MAX > UINT32_MAX
315#  define PRIxFAST8 PRIx64
316# else
317#  define PRIxFAST8 "x"
318# endif
319#endif
320#if !defined PRIXFAST8
321# if UINT_FAST8_MAX > UINT32_MAX
322#  define PRIXFAST8 PRIX64
323# else
324#  define PRIXFAST8 "X"
325# endif
326#endif
327#if !defined PRIdFAST16
328# if INT_FAST16_MAX > INT32_MAX
329#  define PRIdFAST16 PRId64
330# else
331#  define PRIdFAST16 "d"
332# endif
333#endif
334#if !defined PRIiFAST16
335# if INT_FAST16_MAX > INT32_MAX
336#  define PRIiFAST16 PRIi64
337# else
338#  define PRIiFAST16 "i"
339# endif
340#endif
341#if !defined PRIoFAST16
342# if UINT_FAST16_MAX > UINT32_MAX
343#  define PRIoFAST16 PRIo64
344# else
345#  define PRIoFAST16 "o"
346# endif
347#endif
348#if !defined PRIuFAST16
349# if UINT_FAST16_MAX > UINT32_MAX
350#  define PRIuFAST16 PRIu64
351# else
352#  define PRIuFAST16 "u"
353# endif
354#endif
355#if !defined PRIxFAST16
356# if UINT_FAST16_MAX > UINT32_MAX
357#  define PRIxFAST16 PRIx64
358# else
359#  define PRIxFAST16 "x"
360# endif
361#endif
362#if !defined PRIXFAST16
363# if UINT_FAST16_MAX > UINT32_MAX
364#  define PRIXFAST16 PRIX64
365# else
366#  define PRIXFAST16 "X"
367# endif
368#endif
369#if !defined PRIdFAST32
370# if INT_FAST32_MAX > INT32_MAX
371#  define PRIdFAST32 PRId64
372# else
373#  define PRIdFAST32 "d"
374# endif
375#endif
376#if !defined PRIiFAST32
377# if INT_FAST32_MAX > INT32_MAX
378#  define PRIiFAST32 PRIi64
379# else
380#  define PRIiFAST32 "i"
381# endif
382#endif
383#if !defined PRIoFAST32
384# if UINT_FAST32_MAX > UINT32_MAX
385#  define PRIoFAST32 PRIo64
386# else
387#  define PRIoFAST32 "o"
388# endif
389#endif
390#if !defined PRIuFAST32
391# if UINT_FAST32_MAX > UINT32_MAX
392#  define PRIuFAST32 PRIu64
393# else
394#  define PRIuFAST32 "u"
395# endif
396#endif
397#if !defined PRIxFAST32
398# if UINT_FAST32_MAX > UINT32_MAX
399#  define PRIxFAST32 PRIx64
400# else
401#  define PRIxFAST32 "x"
402# endif
403#endif
404#if !defined PRIXFAST32
405# if UINT_FAST32_MAX > UINT32_MAX
406#  define PRIXFAST32 PRIX64
407# else
408#  define PRIXFAST32 "X"
409# endif
410#endif
411#ifdef INT64_MAX
412# if !defined PRIdFAST64
413#  define PRIdFAST64 PRId64
414# endif
415# if !defined PRIiFAST64
416#  define PRIiFAST64 PRIi64
417# endif
418#endif
419#ifdef UINT64_MAX
420# if !defined PRIoFAST64
421#  define PRIoFAST64 PRIo64
422# endif
423# if !defined PRIuFAST64
424#  define PRIuFAST64 PRIu64
425# endif
426# if !defined PRIxFAST64
427#  define PRIxFAST64 PRIx64
428# endif
429# if !defined PRIXFAST64
430#  define PRIXFAST64 PRIX64
431# endif
432#endif
433
434#if !defined PRIdMAX
435# if @INT32_MAX_LT_INTMAX_MAX@
436#  define PRIdMAX PRId64
437# else
438#  define PRIdMAX "ld"
439# endif
440#endif
441#if !defined PRIiMAX
442# if @INT32_MAX_LT_INTMAX_MAX@
443#  define PRIiMAX PRIi64
444# else
445#  define PRIiMAX "li"
446# endif
447#endif
448#if !defined PRIoMAX
449# if @UINT32_MAX_LT_UINTMAX_MAX@
450#  define PRIoMAX PRIo64
451# else
452#  define PRIoMAX "lo"
453# endif
454#endif
455#if !defined PRIuMAX
456# if @UINT32_MAX_LT_UINTMAX_MAX@
457#  define PRIuMAX PRIu64
458# else
459#  define PRIuMAX "lu"
460# endif
461#endif
462#if !defined PRIxMAX
463# if @UINT32_MAX_LT_UINTMAX_MAX@
464#  define PRIxMAX PRIx64
465# else
466#  define PRIxMAX "lx"
467# endif
468#endif
469#if !defined PRIXMAX
470# if @UINT32_MAX_LT_UINTMAX_MAX@
471#  define PRIXMAX PRIX64
472# else
473#  define PRIXMAX "lX"
474# endif
475#endif
476
477#if !defined PRIdPTR
478# ifdef INTPTR_MAX
479#  define PRIdPTR @PRIPTR_PREFIX@ "d"
480# endif
481#endif
482#if !defined PRIiPTR
483# ifdef INTPTR_MAX
484#  define PRIiPTR @PRIPTR_PREFIX@ "i"
485# endif
486#endif
487#if !defined PRIoPTR
488# ifdef UINTPTR_MAX
489#  define PRIoPTR @PRIPTR_PREFIX@ "o"
490# endif
491#endif
492#if !defined PRIuPTR
493# ifdef UINTPTR_MAX
494#  define PRIuPTR @PRIPTR_PREFIX@ "u"
495# endif
496#endif
497#if !defined PRIxPTR
498# ifdef UINTPTR_MAX
499#  define PRIxPTR @PRIPTR_PREFIX@ "x"
500# endif
501#endif
502#if !defined PRIXPTR
503# ifdef UINTPTR_MAX
504#  define PRIXPTR @PRIPTR_PREFIX@ "X"
505# endif
506#endif
507
508#if !defined SCNd8
509# ifdef INT8_MAX
510#  define SCNd8 "hhd"
511# endif
512#endif
513#if !defined SCNi8
514# ifdef INT8_MAX
515#  define SCNi8 "hhi"
516# endif
517#endif
518#if !defined SCNo8
519# ifdef UINT8_MAX
520#  define SCNo8 "hho"
521# endif
522#endif
523#if !defined SCNu8
524# ifdef UINT8_MAX
525#  define SCNu8 "hhu"
526# endif
527#endif
528#if !defined SCNx8
529# ifdef UINT8_MAX
530#  define SCNx8 "hhx"
531# endif
532#endif
533#if !defined SCNd16
534# ifdef INT16_MAX
535#  define SCNd16 "hd"
536# endif
537#endif
538#if !defined SCNi16
539# ifdef INT16_MAX
540#  define SCNi16 "hi"
541# endif
542#endif
543#if !defined SCNo16
544# ifdef UINT16_MAX
545#  define SCNo16 "ho"
546# endif
547#endif
548#if !defined SCNu16
549# ifdef UINT16_MAX
550#  define SCNu16 "hu"
551# endif
552#endif
553#if !defined SCNx16
554# ifdef UINT16_MAX
555#  define SCNx16 "hx"
556# endif
557#endif
558#if !defined SCNd32
559# ifdef INT32_MAX
560#  define SCNd32 "d"
561# endif
562#endif
563#if !defined SCNi32
564# ifdef INT32_MAX
565#  define SCNi32 "i"
566# endif
567#endif
568#if !defined SCNo32
569# ifdef UINT32_MAX
570#  define SCNo32 "o"
571# endif
572#endif
573#if !defined SCNu32
574# ifdef UINT32_MAX
575#  define SCNu32 "u"
576# endif
577#endif
578#if !defined SCNx32
579# ifdef UINT32_MAX
580#  define SCNx32 "x"
581# endif
582#endif
583#ifdef INT64_MAX
584# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
585#  define _SCN64_PREFIX "l"
586# elif defined _MSC_VER || defined __MINGW32__
587#  define _SCN64_PREFIX "I64"
588# elif LONG_MAX >> 30 == 1
589#  define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
590# endif
591# if !defined SCNd64
592#  define SCNd64 _SCN64_PREFIX "d"
593# endif
594# if !defined SCNi64
595#  define SCNi64 _SCN64_PREFIX "i"
596# endif
597#endif
598#ifdef UINT64_MAX
599# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
600#  define _SCNu64_PREFIX "l"
601# elif defined _MSC_VER || defined __MINGW32__
602#  define _SCNu64_PREFIX "I64"
603# elif ULONG_MAX >> 31 == 1
604#  define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
605# endif
606# if !defined SCNo64
607#  define SCNo64 _SCNu64_PREFIX "o"
608# endif
609# if !defined SCNu64
610#  define SCNu64 _SCNu64_PREFIX "u"
611# endif
612# if !defined SCNx64
613#  define SCNx64 _SCNu64_PREFIX "x"
614# endif
615#endif
616
617#if !defined SCNdLEAST8
618# define SCNdLEAST8 "hhd"
619#endif
620#if !defined SCNiLEAST8
621# define SCNiLEAST8 "hhi"
622#endif
623#if !defined SCNoLEAST8
624# define SCNoLEAST8 "hho"
625#endif
626#if !defined SCNuLEAST8
627# define SCNuLEAST8 "hhu"
628#endif
629#if !defined SCNxLEAST8
630# define SCNxLEAST8 "hhx"
631#endif
632#if !defined SCNdLEAST16
633# define SCNdLEAST16 "hd"
634#endif
635#if !defined SCNiLEAST16
636# define SCNiLEAST16 "hi"
637#endif
638#if !defined SCNoLEAST16
639# define SCNoLEAST16 "ho"
640#endif
641#if !defined SCNuLEAST16
642# define SCNuLEAST16 "hu"
643#endif
644#if !defined SCNxLEAST16
645# define SCNxLEAST16 "hx"
646#endif
647#if !defined SCNdLEAST32
648# define SCNdLEAST32 "d"
649#endif
650#if !defined SCNiLEAST32
651# define SCNiLEAST32 "i"
652#endif
653#if !defined SCNoLEAST32
654# define SCNoLEAST32 "o"
655#endif
656#if !defined SCNuLEAST32
657# define SCNuLEAST32 "u"
658#endif
659#if !defined SCNxLEAST32
660# define SCNxLEAST32 "x"
661#endif
662#ifdef INT64_MAX
663# if !defined SCNdLEAST64
664#  define SCNdLEAST64 SCNd64
665# endif
666# if !defined SCNiLEAST64
667#  define SCNiLEAST64 SCNi64
668# endif
669#endif
670#ifdef UINT64_MAX
671# if !defined SCNoLEAST64
672#  define SCNoLEAST64 SCNo64
673# endif
674# if !defined SCNuLEAST64
675#  define SCNuLEAST64 SCNu64
676# endif
677# if !defined SCNxLEAST64
678#  define SCNxLEAST64 SCNx64
679# endif
680#endif
681
682#if !defined SCNdFAST8
683# if INT_FAST8_MAX > INT32_MAX
684#  define SCNdFAST8 SCNd64
685# elif INT_FAST8_MAX == 0x7fff
686#  define SCNdFAST8 "hd"
687# elif INT_FAST8_MAX == 0x7f
688#  define SCNdFAST8 "hhd"
689# else
690#  define SCNdFAST8 "d"
691# endif
692#endif
693#if !defined SCNiFAST8
694# if INT_FAST8_MAX > INT32_MAX
695#  define SCNiFAST8 SCNi64
696# elif INT_FAST8_MAX == 0x7fff
697#  define SCNiFAST8 "hi"
698# elif INT_FAST8_MAX == 0x7f
699#  define SCNiFAST8 "hhi"
700# else
701#  define SCNiFAST8 "i"
702# endif
703#endif
704#if !defined SCNoFAST8
705# if UINT_FAST8_MAX > UINT32_MAX
706#  define SCNoFAST8 SCNo64
707# elif UINT_FAST8_MAX == 0xffff
708#  define SCNoFAST8 "ho"
709# elif UINT_FAST8_MAX == 0xff
710#  define SCNoFAST8 "hho"
711# else
712#  define SCNoFAST8 "o"
713# endif
714#endif
715#if !defined SCNuFAST8
716# if UINT_FAST8_MAX > UINT32_MAX
717#  define SCNuFAST8 SCNu64
718# elif UINT_FAST8_MAX == 0xffff
719#  define SCNuFAST8 "hu"
720# elif UINT_FAST8_MAX == 0xff
721#  define SCNuFAST8 "hhu"
722# else
723#  define SCNuFAST8 "u"
724# endif
725#endif
726#if !defined SCNxFAST8
727# if UINT_FAST8_MAX > UINT32_MAX
728#  define SCNxFAST8 SCNx64
729# elif UINT_FAST8_MAX == 0xffff
730#  define SCNxFAST8 "hx"
731# elif UINT_FAST8_MAX == 0xff
732#  define SCNxFAST8 "hhx"
733# else
734#  define SCNxFAST8 "x"
735# endif
736#endif
737#if !defined SCNdFAST16
738# if INT_FAST16_MAX > INT32_MAX
739#  define SCNdFAST16 SCNd64
740# elif INT_FAST16_MAX == 0x7fff
741#  define SCNdFAST16 "hd"
742# else
743#  define SCNdFAST16 "d"
744# endif
745#endif
746#if !defined SCNiFAST16
747# if INT_FAST16_MAX > INT32_MAX
748#  define SCNiFAST16 SCNi64
749# elif INT_FAST16_MAX == 0x7fff
750#  define SCNiFAST16 "hi"
751# else
752#  define SCNiFAST16 "i"
753# endif
754#endif
755#if !defined SCNoFAST16
756# if UINT_FAST16_MAX > UINT32_MAX
757#  define SCNoFAST16 SCNo64
758# elif UINT_FAST16_MAX == 0xffff
759#  define SCNoFAST16 "ho"
760# else
761#  define SCNoFAST16 "o"
762# endif
763#endif
764#if !defined SCNuFAST16
765# if UINT_FAST16_MAX > UINT32_MAX
766#  define SCNuFAST16 SCNu64
767# elif UINT_FAST16_MAX == 0xffff
768#  define SCNuFAST16 "hu"
769# else
770#  define SCNuFAST16 "u"
771# endif
772#endif
773#if !defined SCNxFAST16
774# if UINT_FAST16_MAX > UINT32_MAX
775#  define SCNxFAST16 SCNx64
776# elif UINT_FAST16_MAX == 0xffff
777#  define SCNxFAST16 "hx"
778# else
779#  define SCNxFAST16 "x"
780# endif
781#endif
782#if !defined SCNdFAST32
783# if INT_FAST32_MAX > INT32_MAX
784#  define SCNdFAST32 SCNd64
785# else
786#  define SCNdFAST32 "d"
787# endif
788#endif
789#if !defined SCNiFAST32
790# if INT_FAST32_MAX > INT32_MAX
791#  define SCNiFAST32 SCNi64
792# else
793#  define SCNiFAST32 "i"
794# endif
795#endif
796#if !defined SCNoFAST32
797# if UINT_FAST32_MAX > UINT32_MAX
798#  define SCNoFAST32 SCNo64
799# else
800#  define SCNoFAST32 "o"
801# endif
802#endif
803#if !defined SCNuFAST32
804# if UINT_FAST32_MAX > UINT32_MAX
805#  define SCNuFAST32 SCNu64
806# else
807#  define SCNuFAST32 "u"
808# endif
809#endif
810#if !defined SCNxFAST32
811# if UINT_FAST32_MAX > UINT32_MAX
812#  define SCNxFAST32 SCNx64
813# else
814#  define SCNxFAST32 "x"
815# endif
816#endif
817#ifdef INT64_MAX
818# if !defined SCNdFAST64
819#  define SCNdFAST64 SCNd64
820# endif
821# if !defined SCNiFAST64
822#  define SCNiFAST64 SCNi64
823# endif
824#endif
825#ifdef UINT64_MAX
826# if !defined SCNoFAST64
827#  define SCNoFAST64 SCNo64
828# endif
829# if !defined SCNuFAST64
830#  define SCNuFAST64 SCNu64
831# endif
832# if !defined SCNxFAST64
833#  define SCNxFAST64 SCNx64
834# endif
835#endif
836
837#if !defined SCNdMAX
838# if @INT32_MAX_LT_INTMAX_MAX@
839#  define SCNdMAX SCNd64
840# else
841#  define SCNdMAX "ld"
842# endif
843#endif
844#if !defined SCNiMAX
845# if @INT32_MAX_LT_INTMAX_MAX@
846#  define SCNiMAX SCNi64
847# else
848#  define SCNiMAX "li"
849# endif
850#endif
851#if !defined SCNoMAX
852# if @UINT32_MAX_LT_UINTMAX_MAX@
853#  define SCNoMAX SCNo64
854# else
855#  define SCNoMAX "lo"
856# endif
857#endif
858#if !defined SCNuMAX
859# if @UINT32_MAX_LT_UINTMAX_MAX@
860#  define SCNuMAX SCNu64
861# else
862#  define SCNuMAX "lu"
863# endif
864#endif
865#if !defined SCNxMAX
866# if @UINT32_MAX_LT_UINTMAX_MAX@
867#  define SCNxMAX SCNx64
868# else
869#  define SCNxMAX "lx"
870# endif
871#endif
872
873#if !defined SCNdPTR
874# ifdef INTPTR_MAX
875#  define SCNdPTR @PRIPTR_PREFIX@ "d"
876# endif
877#endif
878#if !defined SCNiPTR
879# ifdef INTPTR_MAX
880#  define SCNiPTR @PRIPTR_PREFIX@ "i"
881# endif
882#endif
883#if !defined SCNoPTR
884# ifdef UINTPTR_MAX
885#  define SCNoPTR @PRIPTR_PREFIX@ "o"
886# endif
887#endif
888#if !defined SCNuPTR
889# ifdef UINTPTR_MAX
890#  define SCNuPTR @PRIPTR_PREFIX@ "u"
891# endif
892#endif
893#if !defined SCNxPTR
894# ifdef UINTPTR_MAX
895#  define SCNxPTR @PRIPTR_PREFIX@ "x"
896# endif
897#endif
898
899/* 7.8.2 Functions for greatest-width integer types */
900
901#ifdef __cplusplus
902extern "C" {
903#endif
904
905#if @GNULIB_IMAXABS@
906# if !@HAVE_DECL_IMAXABS@
907extern intmax_t imaxabs (intmax_t);
908# endif
909#elif defined GNULIB_POSIXCHECK
910# undef imaxabs
911# if HAVE_RAW_DECL_IMAXABS
912_GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
913                 "use gnulib module imaxabs for portability");
914# endif
915#endif
916
917#if @GNULIB_IMAXDIV@
918# if !@HAVE_IMAXDIV_T@
919#  if !GNULIB_defined_imaxdiv_t
920typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
921#   define GNULIB_defined_imaxdiv_t 1
922#  endif
923# endif
924# if !@HAVE_DECL_IMAXDIV@
925extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
926# endif
927#elif defined GNULIB_POSIXCHECK
928# undef imaxdiv
929# if HAVE_RAW_DECL_IMAXDIV
930_GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
931                 "use gnulib module imaxdiv for portability");
932# endif
933#endif
934
935#if @GNULIB_STRTOIMAX@
936# if @REPLACE_STRTOIMAX@
937#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
938#   undef strtoimax
939#   define strtoimax rpl_strtoimax
940#  endif
941_GL_FUNCDECL_RPL (strtoimax, intmax_t,
942                  (const char *restrict, char **restrict, int)
943                  _GL_ARG_NONNULL ((1)));
944_GL_CXXALIAS_RPL (strtoimax, intmax_t,
945                  (const char *restrict, char **restrict, int));
946# else
947#  if !@HAVE_DECL_STRTOIMAX@
948#   undef strtoimax
949_GL_FUNCDECL_SYS (strtoimax, intmax_t,
950                  (const char *restrict, char **restrict, int)
951                  _GL_ARG_NONNULL ((1)));
952#  endif
953_GL_CXXALIAS_SYS (strtoimax, intmax_t,
954                  (const char *restrict, char **restrict, int));
955# endif
956_GL_CXXALIASWARN (strtoimax);
957#elif defined GNULIB_POSIXCHECK
958# undef strtoimax
959# if HAVE_RAW_DECL_STRTOIMAX
960_GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
961                 "use gnulib module strtoimax for portability");
962# endif
963#endif
964
965#if @GNULIB_STRTOUMAX@
966# if @REPLACE_STRTOUMAX@
967#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
968#   undef strtoumax
969#   define strtoumax rpl_strtoumax
970#  endif
971_GL_FUNCDECL_RPL (strtoumax, uintmax_t,
972                  (const char *restrict, char **restrict, int)
973                  _GL_ARG_NONNULL ((1)));
974_GL_CXXALIAS_RPL (strtoumax, uintmax_t,
975                  (const char *restrict, char **restrict, int));
976# else
977#  if !@HAVE_DECL_STRTOUMAX@
978#   undef strtoumax
979_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
980                  (const char *restrict, char **restrict, int)
981                  _GL_ARG_NONNULL ((1)));
982#  endif
983_GL_CXXALIAS_SYS (strtoumax, uintmax_t,
984                  (const char *restrict, char **restrict, int));
985# endif
986_GL_CXXALIASWARN (strtoumax);
987#elif defined GNULIB_POSIXCHECK
988# undef strtoumax
989# if HAVE_RAW_DECL_STRTOUMAX
990_GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - "
991                 "use gnulib module strtoumax for portability");
992# endif
993#endif
994
995/* Don't bother defining or declaring wcstoimax and wcstoumax, since
996   wide-character functions like this are hardly ever useful.  */
997
998#ifdef __cplusplus
999}
1000#endif
1001
1002#endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */
1003