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