File: inttypes-macros.h

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,235,796 kB
  • sloc: cpp: 7,617,614; ansic: 1,433,901; asm: 1,058,726; python: 252,096; f90: 94,671; objc: 70,753; lisp: 42,813; pascal: 18,401; sh: 10,032; ml: 5,111; perl: 4,720; awk: 3,523; makefile: 3,401; javascript: 2,272; xml: 892; fortran: 770
file content (420 lines) | stat: -rw-r--r-- 13,176 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
//===-- Definition of macros from inttypes.h ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_INTTYPES_MACROS_H
#define LLVM_LIBC_MACROS_INTTYPES_MACROS_H

// fprintf/scanf format macros.
#define __STDC_VERSION_INTTYPES_H__ 202311L

// clang provides these macros, so we don't need to define them.
#ifndef __clang__
#if __UINTPTR_MAX__ == __UINT64_MAX__
#define __PRI64 "l"
#define __PRIPTR "l"
#elif __UINTPTR_MAX__ == __UINT32_MAX__
#define __PRI64 "ll"
#define __PRIPTR ""
#else
// CHERI achitecture for example, has 128-bit pointers that use special "P"
// format.
#error "Unsupported pointer format"
#endif
#define __INT8_FMTd__ "hhd"
#define __INT16_FMTd__ "hd"
#define __INT32_FMTd__ "d"
#define __INT64_FMTd__ __PRI64 "d"
#define __INT_LEAST8_FMTd__ "hhd"
#define __INT_LEAST16_FMTd__ "hd"
#define __INT_LEAST32_FMTd__ "d"
#define __INT_LEAST64_FMTd__ __PRI64 "d"
#define __INT_FAST8_FMTd__ "hhd"
#define __INT_FAST16_FMTd__ "hd"
#define __INT_FAST32_FMTd__ "d"
#define __INT_FAST64_FMTd__ __PRI64 "d"
#define __INTMAX_FMTd__ __PRI64 "d"
#define __INTPTR_FMTd__ __PRIPTR "d"

#define __INT8_FMTi__ "hhi"
#define __INT16_FMTi__ "hi"
#define __INT32_FMTi__ "i"
#define __INT64_FMTi__ __PRI64 "i"
#define __INT_LEAST8_FMTi__ "hhi"
#define __INT_LEAST16_FMTi__ "hi"
#define __INT_LEAST32_FMTi__ "i"
#define __INT_LEAST64_FMTi__ __PRI64 "i"
#define __INT_FAST8_FMTi__ "hhi"
#define __INT_FAST16_FMTi__ "hi"
#define __INT_FAST32_FMTi__ "i"
#define __INT_FAST64_FMTi__ __PRI64 "i"
#define __INTMAX_FMTi__ __PRI64 "i"
#define __INTPTR_FMTi__ __PRIPTR "i"

#define __UINT8_FMTo__ "hho"
#define __UINT16_FMTo__ "ho"
#define __UINT32_FMTo__ "o"
#define __UINT64_FMTo__ __PRI64 "o"
#define __UINT_LEAST8_FMTo__ "hho"
#define __UINT_LEAST16_FMTo__ "ho"
#define __UINT_LEAST32_FMTo__ "o"
#define __UINT_LEAST64_FMTo__ __PRI64 "o"
#define __UINT_FAST8_FMTo__ "hho"
#define __UINT_FAST16_FMTo__ "ho"
#define __UINT_FAST32_FMTo__ "o"
#define __UINT_FAST64_FMTo__ __PRI64 "o"
#define __UINTMAX_FMTo__ __PRI64 "o"
#define __UINTPTR_FMTo__ __PRIPTR "o"

#define __UINT8_FMTu__ "hhu"
#define __UINT16_FMTu__ "hu"
#define __UINT32_FMTu__ "u"
#define __UINT64_FMTu__ __PRI64 "u"
#define __UINT_LEAST8_FMTu__ "hhu"
#define __UINT_LEAST16_FMTu__ "hu"
#define __UINT_LEAST32_FMTu__ "u"
#define __UINT_LEAST64_FMTu__ __PRI64 "u"
#define __UINT_FAST8_FMTu__ "hhu"
#define __UINT_FAST16_FMTu__ "hu"
#define __UINT_FAST32_FMTu__ "u"
#define __UINT_FAST64_FMTu__ __PRI64 "u"
#define __UINTMAX_FMTu__ __PRI64 "u"
#define __UINTPTR_FMTu__ __PRIPTR "u"

#define __UINT8_FMTx__ "hhx"
#define __UINT16_FMTx__ "hx"
#define __UINT32_FMTx__ "x"
#define __UINT64_FMTx__ __PRI64 "x"
#define __UINT_LEAST8_FMTx__ "hhx"
#define __UINT_LEAST16_FMTx__ "hx"
#define __UINT_LEAST32_FMTx__ "x"
#define __UINT_LEAST64_FMTx__ __PRI64 "x"
#define __UINT_FAST8_FMTx__ "hhx"
#define __UINT_FAST16_FMTx__ "hx"
#define __UINT_FAST32_FMTx__ "x"
#define __UINT_FAST64_FMTx__ __PRI64 "x"
#define __UINTMAX_FMTx__ __PRI64 "x"
#define __UINTPTR_FMTx__ __PRIPTR "x"

#define __UINT8_FMTX__ "hhX"
#define __UINT16_FMTX__ "hX"
#define __UINT32_FMTX__ "X"
#define __UINT64_FMTX__ __PRI64 "X"
#define __UINT_LEAST8_FMTX__ "hhX"
#define __UINT_LEAST16_FMTX__ "hX"
#define __UINT_LEAST32_FMTX__ "X"
#define __UINT_LEAST64_FMTX__ __PRI64 "X"
#define __UINT_FAST8_FMTX__ "hhX"
#define __UINT_FAST16_FMTX__ "hX"
#define __UINT_FAST32_FMTX__ "X"
#define __UINT_FAST64_FMTX__ __PRI64 "X"
#define __UINTMAX_FMTX__ __PRI64 "X"
#define __UINTPTR_FMTX__ __PRIPTR "X"
#endif

// only recent clang provides these macros, so we need to check if they are
// available.
#ifndef __UINT8_FMTb__
#define __UINT8_FMTb__ "hhb"
#endif
#ifndef __UINT16_FMTb__
#define __UINT16_FMTb__ "hb"
#endif
#ifndef __UINT32_FMTb__
#define __UINT32_FMTb__ "b"
#endif
#ifndef __UINT64_FMTb__
#define __UINT64_FMTb__ __PRI64 "b"
#endif
#ifndef __UINT_LEAST8_FMTb__
#define __UINT_LEAST8_FMTb__ "hhb"
#endif
#ifndef __UINT_LEAST16_FMTb__
#define __UINT_LEAST16_FMTb__ "hb"
#endif
#ifndef __UINT_LEAST32_FMTb__
#define __UINT_LEAST32_FMTb__ "b"
#endif
#ifndef __UINT_LEAST64_FMTb__
#define __UINT_LEAST64_FMTb__ __PRI64 "b"
#endif
#ifndef __UINT_FAST8_FMTb__
#define __UINT_FAST8_FMTb__ "hhb"
#endif
#ifndef __UINT_FAST16_FMTb__
#define __UINT_FAST16_FMTb__ "hb"
#endif
#ifndef __UINT_FAST32_FMTb__
#define __UINT_FAST32_FMTb__ "b"
#endif
#ifndef __UINT_FAST64_FMTb__
#define __UINT_FAST64_FMTb__ __PRI64 "b"
#endif
#ifndef __UINTMAX_FMTb__
#define __UINTMAX_FMTb__ __PRI64 "b"
#endif
#ifndef __UINTPTR_FMTb__
#define __UINTPTR_FMTb__ __PRIPTR "b"
#endif

#ifndef __UINT8_FMTB__
#define __UINT8_FMTB__ "hhB"
#endif
#ifndef __UINT16_FMTB__
#define __UINT16_FMTB__ "hB"
#endif
#ifndef __UINT32_FMTB__
#define __UINT32_FMTB__ "B"
#endif
#ifndef __UINT64_FMTB__
#define __UINT64_FMTB__ __PRI64 "B"
#endif
#ifndef __UINT_LEAST8_FMTB__
#define __UINT_LEAST8_FMTB__ "hhB"
#endif
#ifndef __UINT_LEAST16_FMTB__
#define __UINT_LEAST16_FMTB__ "hB"
#endif
#ifndef __UINT_LEAST32_FMTB__
#define __UINT_LEAST32_FMTB__ "B"
#endif
#ifndef __UINT_LEAST64_FMTB__
#define __UINT_LEAST64_FMTB__ __PRI64 "B"
#endif
#ifndef __UINT_FAST8_FMTB__
#define __UINT_FAST8_FMTB__ "hhB"
#endif
#ifndef __UINT_FAST16_FMTB__
#define __UINT_FAST16_FMTB__ "hB"
#endif
#ifndef __UINT_FAST32_FMTB__
#define __UINT_FAST32_FMTB__ "B"
#endif
#ifndef __UINT_FAST64_FMTB__
#define __UINT_FAST64_FMTB__ __PRI64 "B"
#endif
#ifndef __UINTMAX_FMTB__
#define __UINTMAX_FMTB__ __PRI64 "B"
#endif
#ifndef __UINTPTR_FMTB__
#define __UINTPTR_FMTB__ __PRIPTR "B"
#endif

// The fprintf() macros for signed integers.
#define PRId8 __INT8_FMTd__
#define PRId16 __INT16_FMTd__
#define PRId32 __INT32_FMTd__
#define PRId64 __INT64_FMTd__
#define PRIdLEAST8 __INT_LEAST8_FMTd__
#define PRIdLEAST16 __INT_LEAST16_FMTd__
#define PRIdLEAST32 __INT_LEAST32_FMTd__
#define PRIdLEAST64 __INT_LEAST64_FMTd__
#define PRIdFAST8 __INT_FAST8_FMTd__
#define PRIdFAST16 __INT_FAST16_FMTd__
#define PRIdFAST32 __INT_FAST32_FMTd__
#define PRIdFAST64 __INT_FAST64_FMTd__
#define PRIdMAX __INTMAX_FMTd__
#define PRIdPTR __INTPTR_FMTd__

#define PRIi8 __INT8_FMTi__
#define PRIi16 __INT16_FMTi__
#define PRIi32 __INT32_FMTi__
#define PRIi64 __INT64_FMTi__
#define PRIiLEAST8 __INT_LEAST8_FMTi__
#define PRIiLEAST16 __INT_LEAST16_FMTi__
#define PRIiLEAST32 __INT_LEAST32_FMTi__
#define PRIiLEAST64 __INT_LEAST64_FMTi__
#define PRIiFAST8 __INT_FAST8_FMTi__
#define PRIiFAST16 __INT_FAST16_FMTi__
#define PRIiFAST32 __INT_FAST32_FMTi__
#define PRIiFAST64 __INT_FAST64_FMTi__
#define PRIiMAX __INTMAX_FMTi__
#define PRIiPTR __INTPTR_FMTi__

// The fprintf() macros for unsigned integers.
#define PRIo8 __UINT8_FMTo__
#define PRIo16 __UINT16_FMTo__
#define PRIo32 __UINT32_FMTo__
#define PRIo64 __UINT64_FMTo__
#define PRIoLEAST8 __UINT_LEAST8_FMTo__
#define PRIoLEAST16 __UINT_LEAST16_FMTo__
#define PRIoLEAST32 __UINT_LEAST32_FMTo__
#define PRIoLEAST64 __UINT_LEAST64_FMTo__
#define PRIoFAST8 __UINT_FAST8_FMTo__
#define PRIoFAST16 __UINT_FAST16_FMTo__
#define PRIoFAST32 __UINT_FAST32_FMTo__
#define PRIoFAST64 __UINT_FAST64_FMTo__
#define PRIoMAX __UINTMAX_FMTo__
#define PRIoPTR __UINTPTR_FMTo__

#define PRIu8 __UINT8_FMTu__
#define PRIu16 __UINT16_FMTu__
#define PRIu32 __UINT32_FMTu__
#define PRIu64 __UINT64_FMTu__
#define PRIuLEAST8 __UINT_LEAST8_FMTu__
#define PRIuLEAST16 __UINT_LEAST16_FMTu__
#define PRIuLEAST32 __UINT_LEAST32_FMTu__
#define PRIuLEAST64 __UINT_LEAST64_FMTu__
#define PRIuFAST8 __UINT_FAST8_FMTu__
#define PRIuFAST16 __UINT_FAST16_FMTu__
#define PRIuFAST32 __UINT_FAST32_FMTu__
#define PRIuFAST64 __UINT_FAST64_FMTu__
#define PRIuMAX __UINTMAX_FMTu__
#define PRIuPTR __UINTPTR_FMTu__

#define PRIx8 __UINT8_FMTx__
#define PRIx16 __UINT16_FMTx__
#define PRIx32 __UINT32_FMTx__
#define PRIx64 __UINT64_FMTx__
#define PRIxLEAST8 __UINT_LEAST8_FMTx__
#define PRIxLEAST16 __UINT_LEAST16_FMTx__
#define PRIxLEAST32 __UINT_LEAST32_FMTx__
#define PRIxLEAST64 __UINT_LEAST64_FMTx__
#define PRIxFAST8 __UINT_FAST8_FMTx__
#define PRIxFAST16 __UINT_FAST16_FMTx__
#define PRIxFAST32 __UINT_FAST32_FMTx__
#define PRIxFAST64 __UINT_FAST64_FMTx__
#define PRIxMAX __UINTMAX_FMTx__
#define PRIxPTR __UINTPTR_FMTx__

#define PRIX8 __UINT8_FMTX__
#define PRIX16 __UINT16_FMTX__
#define PRIX32 __UINT32_FMTX__
#define PRIX64 __UINT64_FMTX__
#define PRIXLEAST8 __UINT_LEAST8_FMTX__
#define PRIXLEAST16 __UINT_LEAST16_FMTX__
#define PRIXLEAST32 __UINT_LEAST32_FMTX__
#define PRIXLEAST64 __UINT_LEAST64_FMTX__
#define PRIXFAST8 __UINT_FAST8_FMTX__
#define PRIXFAST16 __UINT_FAST16_FMTX__
#define PRIXFAST32 __UINT_FAST32_FMTX__
#define PRIXFAST64 __UINT_FAST64_FMTX__
#define PRIXMAX __UINTMAX_FMTX__
#define PRIXPTR __UINTPTR_FMTX__

#define PRIb8 __UINT8_FMTb__
#define PRIb16 __UINT16_FMTb__
#define PRIb32 __UINT32_FMTb__
#define PRIb64 __UINT64_FMTb__
#define PRIbLEAST8 __UINT_LEAST8_FMTb__
#define PRIbLEAST16 __UINT_LEAST16_FMTb__
#define PRIbLEAST32 __UINT_LEAST32_FMTb__
#define PRIbLEAST64 __UINT_LEAST64_FMTb__
#define PRIbFAST8 __UINT_FAST8_FMTb__
#define PRIbFAST16 __UINT_FAST16_FMTb__
#define PRIbFAST32 __UINT_FAST32_FMTb__
#define PRIbFAST64 __UINT_FAST64_FMTb__
#define PRIbMAX __UINTMAX_FMTb__
#define PRIbPTR __UINTPTR_FMTb__

#define PRIB8 __UINT8_FMTB__
#define PRIB16 __UINT16_FMTB__
#define PRIB32 __UINT32_FMTB__
#define PRIB64 __UINT64_FMTB__
#define PRIBLEAST8 __UINT_LEAST8_FMTB__
#define PRIBLEAST16 __UINT_LEAST16_FMTB__
#define PRIBLEAST32 __UINT_LEAST32_FMTB__
#define PRIBLEAST64 __UINT_LEAST64_FMTB__
#define PRIBFAST8 __UINT_FAST8_FMTB__
#define PRIBFAST16 __UINT_FAST16_FMTB__
#define PRIBFAST32 __UINT_FAST32_FMTB__
#define PRIBFAST64 __UINT_FAST64_FMTB__
#define PRIBMAX __UINTMAX_FMTB__
#define PRIBPTR __UINTPTR_FMTB__

// The fscanf() macros for signed integers.
#define SCNd8 __INT8_FMTd__
#define SCNd16 __INT16_FMTd__
#define SCNd32 __INT32_FMTd__
#define SCNd64 __INT64_FMTd__
#define SCNdLEAST8 __INT_LEAST8_FMTd__
#define SCNdLEAST16 __INT_LEAST16_FMTd__
#define SCNdLEAST32 __INT_LEAST32_FMTd__
#define SCNdLEAST64 __INT_LEAST64_FMTd__
#define SCNdFAST8 __INT_FAST8_FMTd__
#define SCNdFAST16 __INT_FAST16_FMTd__
#define SCNdFAST32 __INT_FAST32_FMTd__
#define SCNdFAST64 __INT_FAST64_FMTd__
#define SCNdMAX __INTMAX_FMTd__
#define SCNdPTR __INTPTR_FMTd__

#define SCNi8 __INT8_FMTi__
#define SCNi16 __INT16_FMTi__
#define SCNi32 __INT32_FMTi__
#define SCNi64 __INT64_FMTi__
#define SCNiLEAST8 __INT_LEAST8_FMTi__
#define SCNiLEAST16 __INT_LEAST16_FMTi__
#define SCNiLEAST32 __INT_LEAST32_FMTi__
#define SCNiLEAST64 __INT_LEAST64_FMTi__
#define SCNiFAST8 __INT_FAST8_FMTi__
#define SCNiFAST16 __INT_FAST16_FMTi__
#define SCNiFAST32 __INT_FAST32_FMTi__
#define SCNiFAST64 __INT_FAST64_FMTi__
#define SCNiMAX __INTMAX_FMTi__
#define SCNiPTR __INTPTR_FMTi__

// The fscanf() macros for unsigned integers.
#define SCNo8 __UINT8_FMTo__
#define SCNo16 __UINT16_FMTo__
#define SCNo32 __UINT32_FMTo__
#define SCNo64 __UINT64_FMTo__
#define SCNoLEAST8 __UINT_LEAST8_FMTo__
#define SCNoLEAST16 __UINT_LEAST16_FMTo__
#define SCNoLEAST32 __UINT_LEAST32_FMTo__
#define SCNoLEAST64 __UINT_LEAST64_FMTo__
#define SCNoFAST8 __UINT_FAST8_FMTo__
#define SCNoFAST16 __UINT_FAST16_FMTo__
#define SCNoFAST32 __UINT_FAST32_FMTo__
#define SCNoFAST64 __UINT_FAST64_FMTo__
#define SCNoMAX __UINTMAX_FMTo__
#define SCNoPTR __UINTPTR_FMTo__

#define SCNu8 __UINT8_FMTu__
#define SCNu16 __UINT16_FMTu__
#define SCNu32 __UINT32_FMTu__
#define SCNu64 __UINT64_FMTu__
#define SCNuLEAST8 __UINT_LEAST8_FMTu__
#define SCNuLEAST16 __UINT_LEAST16_FMTu__
#define SCNuLEAST32 __UINT_LEAST32_FMTu__
#define SCNuLEAST64 __UINT_LEAST64_FMTu__
#define SCNuFAST8 __UINT_FAST8_FMTu__
#define SCNuFAST16 __UINT_FAST16_FMTu__
#define SCNuFAST32 __UINT_FAST32_FMTu__
#define SCNuFAST64 __UINT_FAST64_FMTu__
#define SCNuMAX __UINTMAX_FMTu__
#define SCNuPTR __UINTPTR_FMTu__

#define SCNx8 __UINT8_FMTx__
#define SCNx16 __UINT16_FMTx__
#define SCNx32 __UINT32_FMTx__
#define SCNx64 __UINT64_FMTx__
#define SCNxLEAST8 __UINT_LEAST8_FMTx__
#define SCNxLEAST16 __UINT_LEAST16_FMTx__
#define SCNxLEAST32 __UINT_LEAST32_FMTx__
#define SCNxLEAST64 __UINT_LEAST64_FMTx__
#define SCNxFAST8 __UINT_FAST8_FMTx__
#define SCNxFAST16 __UINT_FAST16_FMTx__
#define SCNxFAST32 __UINT_FAST32_FMTx__
#define SCNxFAST64 __UINT_FAST64_FMTx__
#define SCNxMAX __UINTMAX_FMTx__
#define SCNxPTR __UINTPTR_FMTx__

#define SCNb8 __UINT8_FMTb__
#define SCNb16 __UINT16_FMTb__
#define SCNb32 __UINT32_FMTb__
#define SCNb64 __UINT64_FMTb__
#define SCNbLEAST8 __UINT_LEAST8_FMTb__
#define SCNbLEAST16 __UINT_LEAST16_FMTb__
#define SCNbLEAST32 __UINT_LEAST32_FMTb__
#define SCNbLEAST64 __UINT_LEAST64_FMTb__
#define SCNbFAST8 __UINT_FAST8_FMTb__
#define SCNbFAST16 __UINT_FAST16_FMTb__
#define SCNbFAST32 __UINT_FAST32_FMTb__
#define SCNbFAST64 __UINT_FAST64_FMTb__
#define SCNbMAX __UINTMAX_FMTb__
#define SCNbPTR __UINTPTR_FMTb__

#endif // LLVM_LIBC_MACROS_INTTYPES_MACROS_H