1 //===----------------------------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 // test <inttypes.h>
11
12 #include <inttypes.h>
13 #include <type_traits>
14
15 #ifndef PRId8
16 #error PRId8 not defined
17 #endif
18
19 #ifndef PRId16
20 #error PRId16 not defined
21 #endif
22
23 #ifndef PRId32
24 #error PRId32 not defined
25 #endif
26
27 #ifndef PRId64
28 #error PRId64 not defined
29 #endif
30
31 #ifndef PRIdLEAST8
32 #error PRIdLEAST8 not defined
33 #endif
34
35 #ifndef PRIdLEAST16
36 #error PRIdLEAST16 not defined
37 #endif
38
39 #ifndef PRIdLEAST32
40 #error PRIdLEAST32 not defined
41 #endif
42
43 #ifndef PRIdLEAST64
44 #error PRIdLEAST64 not defined
45 #endif
46
47 #ifndef PRIdFAST8
48 #error PRIdFAST8 not defined
49 #endif
50
51 #ifndef PRIdFAST16
52 #error PRIdFAST16 not defined
53 #endif
54
55 #ifndef PRIdFAST32
56 #error PRIdFAST32 not defined
57 #endif
58
59 #ifndef PRIdFAST64
60 #error PRIdFAST64 not defined
61 #endif
62
63 #ifndef PRIdMAX
64 #error PRIdMAX not defined
65 #endif
66
67 #ifndef PRIdPTR
68 #error PRIdPTR not defined
69 #endif
70
71 #ifndef PRIi8
72 #error PRIi8 not defined
73 #endif
74
75 #ifndef PRIi16
76 #error PRIi16 not defined
77 #endif
78
79 #ifndef PRIi32
80 #error PRIi32 not defined
81 #endif
82
83 #ifndef PRIi64
84 #error PRIi64 not defined
85 #endif
86
87 #ifndef PRIiLEAST8
88 #error PRIiLEAST8 not defined
89 #endif
90
91 #ifndef PRIiLEAST16
92 #error PRIiLEAST16 not defined
93 #endif
94
95 #ifndef PRIiLEAST32
96 #error PRIiLEAST32 not defined
97 #endif
98
99 #ifndef PRIiLEAST64
100 #error PRIiLEAST64 not defined
101 #endif
102
103 #ifndef PRIiFAST8
104 #error PRIiFAST8 not defined
105 #endif
106
107 #ifndef PRIiFAST16
108 #error PRIiFAST16 not defined
109 #endif
110
111 #ifndef PRIiFAST32
112 #error PRIiFAST32 not defined
113 #endif
114
115 #ifndef PRIiFAST64
116 #error PRIiFAST64 not defined
117 #endif
118
119 #ifndef PRIiMAX
120 #error PRIiMAX not defined
121 #endif
122
123 #ifndef PRIiPTR
124 #error PRIiPTR not defined
125 #endif
126
127 #ifndef PRIo8
128 #error PRIo8 not defined
129 #endif
130
131 #ifndef PRIo16
132 #error PRIo16 not defined
133 #endif
134
135 #ifndef PRIo32
136 #error PRIo32 not defined
137 #endif
138
139 #ifndef PRIo64
140 #error PRIo64 not defined
141 #endif
142
143 #ifndef PRIoLEAST8
144 #error PRIoLEAST8 not defined
145 #endif
146
147 #ifndef PRIoLEAST16
148 #error PRIoLEAST16 not defined
149 #endif
150
151 #ifndef PRIoLEAST32
152 #error PRIoLEAST32 not defined
153 #endif
154
155 #ifndef PRIoLEAST64
156 #error PRIoLEAST64 not defined
157 #endif
158
159 #ifndef PRIoFAST8
160 #error PRIoFAST8 not defined
161 #endif
162
163 #ifndef PRIoFAST16
164 #error PRIoFAST16 not defined
165 #endif
166
167 #ifndef PRIoFAST32
168 #error PRIoFAST32 not defined
169 #endif
170
171 #ifndef PRIoFAST64
172 #error PRIoFAST64 not defined
173 #endif
174
175 #ifndef PRIoMAX
176 #error PRIoMAX not defined
177 #endif
178
179 #ifndef PRIoPTR
180 #error PRIoPTR not defined
181 #endif
182
183 #ifndef PRIu8
184 #error PRIu8 not defined
185 #endif
186
187 #ifndef PRIu16
188 #error PRIu16 not defined
189 #endif
190
191 #ifndef PRIu32
192 #error PRIu32 not defined
193 #endif
194
195 #ifndef PRIu64
196 #error PRIu64 not defined
197 #endif
198
199 #ifndef PRIuLEAST8
200 #error PRIuLEAST8 not defined
201 #endif
202
203 #ifndef PRIuLEAST16
204 #error PRIuLEAST16 not defined
205 #endif
206
207 #ifndef PRIuLEAST32
208 #error PRIuLEAST32 not defined
209 #endif
210
211 #ifndef PRIuLEAST64
212 #error PRIuLEAST64 not defined
213 #endif
214
215 #ifndef PRIuFAST8
216 #error PRIuFAST8 not defined
217 #endif
218
219 #ifndef PRIuFAST16
220 #error PRIuFAST16 not defined
221 #endif
222
223 #ifndef PRIuFAST32
224 #error PRIuFAST32 not defined
225 #endif
226
227 #ifndef PRIuFAST64
228 #error PRIuFAST64 not defined
229 #endif
230
231 #ifndef PRIuMAX
232 #error PRIuMAX not defined
233 #endif
234
235 #ifndef PRIuPTR
236 #error PRIuPTR not defined
237 #endif
238
239 #ifndef PRIx8
240 #error PRIx8 not defined
241 #endif
242
243 #ifndef PRIx16
244 #error PRIx16 not defined
245 #endif
246
247 #ifndef PRIx32
248 #error PRIx32 not defined
249 #endif
250
251 #ifndef PRIx64
252 #error PRIx64 not defined
253 #endif
254
255 #ifndef PRIxLEAST8
256 #error PRIxLEAST8 not defined
257 #endif
258
259 #ifndef PRIxLEAST16
260 #error PRIxLEAST16 not defined
261 #endif
262
263 #ifndef PRIxLEAST32
264 #error PRIxLEAST32 not defined
265 #endif
266
267 #ifndef PRIxLEAST64
268 #error PRIxLEAST64 not defined
269 #endif
270
271 #ifndef PRIxFAST8
272 #error PRIxFAST8 not defined
273 #endif
274
275 #ifndef PRIxFAST16
276 #error PRIxFAST16 not defined
277 #endif
278
279 #ifndef PRIxFAST32
280 #error PRIxFAST32 not defined
281 #endif
282
283 #ifndef PRIxFAST64
284 #error PRIxFAST64 not defined
285 #endif
286
287 #ifndef PRIxMAX
288 #error PRIxMAX not defined
289 #endif
290
291 #ifndef PRIxPTR
292 #error PRIxPTR not defined
293 #endif
294
295 #ifndef PRIX8
296 #error PRIX8 not defined
297 #endif
298
299 #ifndef PRIX16
300 #error PRIX16 not defined
301 #endif
302
303 #ifndef PRIX32
304 #error PRIX32 not defined
305 #endif
306
307 #ifndef PRIX64
308 #error PRIX64 not defined
309 #endif
310
311 #ifndef PRIXLEAST8
312 #error PRIXLEAST8 not defined
313 #endif
314
315 #ifndef PRIXLEAST16
316 #error PRIXLEAST16 not defined
317 #endif
318
319 #ifndef PRIXLEAST32
320 #error PRIXLEAST32 not defined
321 #endif
322
323 #ifndef PRIXLEAST64
324 #error PRIXLEAST64 not defined
325 #endif
326
327 #ifndef PRIXFAST8
328 #error PRIXFAST8 not defined
329 #endif
330
331 #ifndef PRIXFAST16
332 #error PRIXFAST16 not defined
333 #endif
334
335 #ifndef PRIXFAST32
336 #error PRIXFAST32 not defined
337 #endif
338
339 #ifndef PRIXFAST64
340 #error PRIXFAST64 not defined
341 #endif
342
343 #ifndef PRIXMAX
344 #error PRIXMAX not defined
345 #endif
346
347 #ifndef PRIXPTR
348 #error PRIXPTR not defined
349 #endif
350
351 #ifndef SCNd8
352 #error SCNd8 not defined
353 #endif
354
355 #ifndef SCNd16
356 #error SCNd16 not defined
357 #endif
358
359 #ifndef SCNd32
360 #error SCNd32 not defined
361 #endif
362
363 #ifndef SCNd64
364 #error SCNd64 not defined
365 #endif
366
367 #ifndef SCNdLEAST8
368 #error SCNdLEAST8 not defined
369 #endif
370
371 #ifndef SCNdLEAST16
372 #error SCNdLEAST16 not defined
373 #endif
374
375 #ifndef SCNdLEAST32
376 #error SCNdLEAST32 not defined
377 #endif
378
379 #ifndef SCNdLEAST64
380 #error SCNdLEAST64 not defined
381 #endif
382
383 #ifndef SCNdFAST8
384 #error SCNdFAST8 not defined
385 #endif
386
387 #ifndef SCNdFAST16
388 #error SCNdFAST16 not defined
389 #endif
390
391 #ifndef SCNdFAST32
392 #error SCNdFAST32 not defined
393 #endif
394
395 #ifndef SCNdFAST64
396 #error SCNdFAST64 not defined
397 #endif
398
399 #ifndef SCNdMAX
400 #error SCNdMAX not defined
401 #endif
402
403 #ifndef SCNdPTR
404 #error SCNdPTR not defined
405 #endif
406
407 #ifndef SCNi8
408 #error SCNi8 not defined
409 #endif
410
411 #ifndef SCNi16
412 #error SCNi16 not defined
413 #endif
414
415 #ifndef SCNi32
416 #error SCNi32 not defined
417 #endif
418
419 #ifndef SCNi64
420 #error SCNi64 not defined
421 #endif
422
423 #ifndef SCNiLEAST8
424 #error SCNiLEAST8 not defined
425 #endif
426
427 #ifndef SCNiLEAST16
428 #error SCNiLEAST16 not defined
429 #endif
430
431 #ifndef SCNiLEAST32
432 #error SCNiLEAST32 not defined
433 #endif
434
435 #ifndef SCNiLEAST64
436 #error SCNiLEAST64 not defined
437 #endif
438
439 #ifndef SCNiFAST8
440 #error SCNiFAST8 not defined
441 #endif
442
443 #ifndef SCNiFAST16
444 #error SCNiFAST16 not defined
445 #endif
446
447 #ifndef SCNiFAST32
448 #error SCNiFAST32 not defined
449 #endif
450
451 #ifndef SCNiFAST64
452 #error SCNiFAST64 not defined
453 #endif
454
455 #ifndef SCNiMAX
456 #error SCNiMAX not defined
457 #endif
458
459 #ifndef SCNiPTR
460 #error SCNiPTR not defined
461 #endif
462
463 #ifndef SCNo8
464 #error SCNo8 not defined
465 #endif
466
467 #ifndef SCNo16
468 #error SCNo16 not defined
469 #endif
470
471 #ifndef SCNo32
472 #error SCNo32 not defined
473 #endif
474
475 #ifndef SCNo64
476 #error SCNo64 not defined
477 #endif
478
479 #ifndef SCNoLEAST8
480 #error SCNoLEAST8 not defined
481 #endif
482
483 #ifndef SCNoLEAST16
484 #error SCNoLEAST16 not defined
485 #endif
486
487 #ifndef SCNoLEAST32
488 #error SCNoLEAST32 not defined
489 #endif
490
491 #ifndef SCNoLEAST64
492 #error SCNoLEAST64 not defined
493 #endif
494
495 #ifndef SCNoFAST8
496 #error SCNoFAST8 not defined
497 #endif
498
499 #ifndef SCNoFAST16
500 #error SCNoFAST16 not defined
501 #endif
502
503 #ifndef SCNoFAST32
504 #error SCNoFAST32 not defined
505 #endif
506
507 #ifndef SCNoFAST64
508 #error SCNoFAST64 not defined
509 #endif
510
511 #ifndef SCNoMAX
512 #error SCNoMAX not defined
513 #endif
514
515 #ifndef SCNoPTR
516 #error SCNoPTR not defined
517 #endif
518
519 #ifndef SCNu8
520 #error SCNu8 not defined
521 #endif
522
523 #ifndef SCNu16
524 #error SCNu16 not defined
525 #endif
526
527 #ifndef SCNu32
528 #error SCNu32 not defined
529 #endif
530
531 #ifndef SCNu64
532 #error SCNu64 not defined
533 #endif
534
535 #ifndef SCNuLEAST8
536 #error SCNuLEAST8 not defined
537 #endif
538
539 #ifndef SCNuLEAST16
540 #error SCNuLEAST16 not defined
541 #endif
542
543 #ifndef SCNuLEAST32
544 #error SCNuLEAST32 not defined
545 #endif
546
547 #ifndef SCNuLEAST64
548 #error SCNuLEAST64 not defined
549 #endif
550
551 #ifndef SCNuFAST8
552 #error SCNuFAST8 not defined
553 #endif
554
555 #ifndef SCNuFAST16
556 #error SCNuFAST16 not defined
557 #endif
558
559 #ifndef SCNuFAST32
560 #error SCNuFAST32 not defined
561 #endif
562
563 #ifndef SCNuFAST64
564 #error SCNuFAST64 not defined
565 #endif
566
567 #ifndef SCNuMAX
568 #error SCNuMAX not defined
569 #endif
570
571 #ifndef SCNuPTR
572 #error SCNuPTR not defined
573 #endif
574
575 #ifndef SCNx8
576 #error SCNx8 not defined
577 #endif
578
579 #ifndef SCNx16
580 #error SCNx16 not defined
581 #endif
582
583 #ifndef SCNx32
584 #error SCNx32 not defined
585 #endif
586
587 #ifndef SCNx64
588 #error SCNx64 not defined
589 #endif
590
591 #ifndef SCNxLEAST8
592 #error SCNxLEAST8 not defined
593 #endif
594
595 #ifndef SCNxLEAST16
596 #error SCNxLEAST16 not defined
597 #endif
598
599 #ifndef SCNxLEAST32
600 #error SCNxLEAST32 not defined
601 #endif
602
603 #ifndef SCNxLEAST64
604 #error SCNxLEAST64 not defined
605 #endif
606
607 #ifndef SCNxFAST8
608 #error SCNxFAST8 not defined
609 #endif
610
611 #ifndef SCNxFAST16
612 #error SCNxFAST16 not defined
613 #endif
614
615 #ifndef SCNxFAST32
616 #error SCNxFAST32 not defined
617 #endif
618
619 #ifndef SCNxFAST64
620 #error SCNxFAST64 not defined
621 #endif
622
623 #ifndef SCNxMAX
624 #error SCNxMAX not defined
625 #endif
626
627 #ifndef SCNxPTR
628 #error SCNxPTR not defined
629 #endif
630
main()631 int main()
632 {
633 {
634 imaxdiv_t i1 = {0};
635 }
636 intmax_t i = 0;
637 static_assert((std::is_same<decltype(imaxabs(i)), intmax_t>::value), "");
638 static_assert((std::is_same<decltype(imaxdiv(i, i)), imaxdiv_t>::value), "");
639 static_assert((std::is_same<decltype(strtoimax("", (char**)0, 0)), intmax_t>::value), "");
640 static_assert((std::is_same<decltype(strtoumax("", (char**)0, 0)), uintmax_t>::value), "");
641 static_assert((std::is_same<decltype(wcstoimax(L"", (wchar_t**)0, 0)), intmax_t>::value), "");
642 static_assert((std::is_same<decltype(wcstoumax(L"", (wchar_t**)0, 0)), uintmax_t>::value), "");
643 }
644