brintos

brintos / llvm-project-archived public Read only

0
0
Text · 12.9 KiB · 9b55467 Raw
421 lines · c
1//===-- Definition of macros from inttypes.h ------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8#ifndef LLVM_LIBC_MACROS_INTTYPES_MACROS_H9#define LLVM_LIBC_MACROS_INTTYPES_MACROS_H10 11// fprintf/scanf format macros.12#define __STDC_VERSION_INTTYPES_H__ 202311L13 14// clang provides these macros, so we don't need to define them.15#ifndef __clang__16#if __UINTPTR_MAX__ == __UINT64_MAX__17#define __PRI64 "l"18#define __PRIPTR "l"19#elif __UINTPTR_MAX__ == __UINT32_MAX__20#define __PRI64 "ll"21#define __PRIPTR ""22#else23// CHERI achitecture for example, has 128-bit pointers that use special "P"24// format.25#error "Unsupported pointer format"26#endif27#define __INT8_FMTd__ "hhd"28#define __INT16_FMTd__ "hd"29#define __INT32_FMTd__ "d"30#define __INT64_FMTd__ __PRI64 "d"31#define __INT_LEAST8_FMTd__ "hhd"32#define __INT_LEAST16_FMTd__ "hd"33#define __INT_LEAST32_FMTd__ "d"34#define __INT_LEAST64_FMTd__ __PRI64 "d"35#define __INT_FAST8_FMTd__ "hhd"36#define __INT_FAST16_FMTd__ "hd"37#define __INT_FAST32_FMTd__ "d"38#define __INT_FAST64_FMTd__ __PRI64 "d"39#define __INTMAX_FMTd__ __PRI64 "d"40#define __INTPTR_FMTd__ __PRIPTR "d"41 42#define __INT8_FMTi__ "hhi"43#define __INT16_FMTi__ "hi"44#define __INT32_FMTi__ "i"45#define __INT64_FMTi__ __PRI64 "i"46#define __INT_LEAST8_FMTi__ "hhi"47#define __INT_LEAST16_FMTi__ "hi"48#define __INT_LEAST32_FMTi__ "i"49#define __INT_LEAST64_FMTi__ __PRI64 "i"50#define __INT_FAST8_FMTi__ "hhi"51#define __INT_FAST16_FMTi__ "hi"52#define __INT_FAST32_FMTi__ "i"53#define __INT_FAST64_FMTi__ __PRI64 "i"54#define __INTMAX_FMTi__ __PRI64 "i"55#define __INTPTR_FMTi__ __PRIPTR "i"56 57#define __UINT8_FMTo__ "hho"58#define __UINT16_FMTo__ "ho"59#define __UINT32_FMTo__ "o"60#define __UINT64_FMTo__ __PRI64 "o"61#define __UINT_LEAST8_FMTo__ "hho"62#define __UINT_LEAST16_FMTo__ "ho"63#define __UINT_LEAST32_FMTo__ "o"64#define __UINT_LEAST64_FMTo__ __PRI64 "o"65#define __UINT_FAST8_FMTo__ "hho"66#define __UINT_FAST16_FMTo__ "ho"67#define __UINT_FAST32_FMTo__ "o"68#define __UINT_FAST64_FMTo__ __PRI64 "o"69#define __UINTMAX_FMTo__ __PRI64 "o"70#define __UINTPTR_FMTo__ __PRIPTR "o"71 72#define __UINT8_FMTu__ "hhu"73#define __UINT16_FMTu__ "hu"74#define __UINT32_FMTu__ "u"75#define __UINT64_FMTu__ __PRI64 "u"76#define __UINT_LEAST8_FMTu__ "hhu"77#define __UINT_LEAST16_FMTu__ "hu"78#define __UINT_LEAST32_FMTu__ "u"79#define __UINT_LEAST64_FMTu__ __PRI64 "u"80#define __UINT_FAST8_FMTu__ "hhu"81#define __UINT_FAST16_FMTu__ "hu"82#define __UINT_FAST32_FMTu__ "u"83#define __UINT_FAST64_FMTu__ __PRI64 "u"84#define __UINTMAX_FMTu__ __PRI64 "u"85#define __UINTPTR_FMTu__ __PRIPTR "u"86 87#define __UINT8_FMTx__ "hhx"88#define __UINT16_FMTx__ "hx"89#define __UINT32_FMTx__ "x"90#define __UINT64_FMTx__ __PRI64 "x"91#define __UINT_LEAST8_FMTx__ "hhx"92#define __UINT_LEAST16_FMTx__ "hx"93#define __UINT_LEAST32_FMTx__ "x"94#define __UINT_LEAST64_FMTx__ __PRI64 "x"95#define __UINT_FAST8_FMTx__ "hhx"96#define __UINT_FAST16_FMTx__ "hx"97#define __UINT_FAST32_FMTx__ "x"98#define __UINT_FAST64_FMTx__ __PRI64 "x"99#define __UINTMAX_FMTx__ __PRI64 "x"100#define __UINTPTR_FMTx__ __PRIPTR "x"101 102#define __UINT8_FMTX__ "hhX"103#define __UINT16_FMTX__ "hX"104#define __UINT32_FMTX__ "X"105#define __UINT64_FMTX__ __PRI64 "X"106#define __UINT_LEAST8_FMTX__ "hhX"107#define __UINT_LEAST16_FMTX__ "hX"108#define __UINT_LEAST32_FMTX__ "X"109#define __UINT_LEAST64_FMTX__ __PRI64 "X"110#define __UINT_FAST8_FMTX__ "hhX"111#define __UINT_FAST16_FMTX__ "hX"112#define __UINT_FAST32_FMTX__ "X"113#define __UINT_FAST64_FMTX__ __PRI64 "X"114#define __UINTMAX_FMTX__ __PRI64 "X"115#define __UINTPTR_FMTX__ __PRIPTR "X"116#endif117 118// only recent clang provides these macros, so we need to check if they are119// available.120#ifndef __UINT8_FMTb__121#define __UINT8_FMTb__ "hhb"122#endif123#ifndef __UINT16_FMTb__124#define __UINT16_FMTb__ "hb"125#endif126#ifndef __UINT32_FMTb__127#define __UINT32_FMTb__ "b"128#endif129#ifndef __UINT64_FMTb__130#define __UINT64_FMTb__ __PRI64 "b"131#endif132#ifndef __UINT_LEAST8_FMTb__133#define __UINT_LEAST8_FMTb__ "hhb"134#endif135#ifndef __UINT_LEAST16_FMTb__136#define __UINT_LEAST16_FMTb__ "hb"137#endif138#ifndef __UINT_LEAST32_FMTb__139#define __UINT_LEAST32_FMTb__ "b"140#endif141#ifndef __UINT_LEAST64_FMTb__142#define __UINT_LEAST64_FMTb__ __PRI64 "b"143#endif144#ifndef __UINT_FAST8_FMTb__145#define __UINT_FAST8_FMTb__ "hhb"146#endif147#ifndef __UINT_FAST16_FMTb__148#define __UINT_FAST16_FMTb__ "hb"149#endif150#ifndef __UINT_FAST32_FMTb__151#define __UINT_FAST32_FMTb__ "b"152#endif153#ifndef __UINT_FAST64_FMTb__154#define __UINT_FAST64_FMTb__ __PRI64 "b"155#endif156#ifndef __UINTMAX_FMTb__157#define __UINTMAX_FMTb__ __PRI64 "b"158#endif159#ifndef __UINTPTR_FMTb__160#define __UINTPTR_FMTb__ __PRIPTR "b"161#endif162 163#ifndef __UINT8_FMTB__164#define __UINT8_FMTB__ "hhB"165#endif166#ifndef __UINT16_FMTB__167#define __UINT16_FMTB__ "hB"168#endif169#ifndef __UINT32_FMTB__170#define __UINT32_FMTB__ "B"171#endif172#ifndef __UINT64_FMTB__173#define __UINT64_FMTB__ __PRI64 "B"174#endif175#ifndef __UINT_LEAST8_FMTB__176#define __UINT_LEAST8_FMTB__ "hhB"177#endif178#ifndef __UINT_LEAST16_FMTB__179#define __UINT_LEAST16_FMTB__ "hB"180#endif181#ifndef __UINT_LEAST32_FMTB__182#define __UINT_LEAST32_FMTB__ "B"183#endif184#ifndef __UINT_LEAST64_FMTB__185#define __UINT_LEAST64_FMTB__ __PRI64 "B"186#endif187#ifndef __UINT_FAST8_FMTB__188#define __UINT_FAST8_FMTB__ "hhB"189#endif190#ifndef __UINT_FAST16_FMTB__191#define __UINT_FAST16_FMTB__ "hB"192#endif193#ifndef __UINT_FAST32_FMTB__194#define __UINT_FAST32_FMTB__ "B"195#endif196#ifndef __UINT_FAST64_FMTB__197#define __UINT_FAST64_FMTB__ __PRI64 "B"198#endif199#ifndef __UINTMAX_FMTB__200#define __UINTMAX_FMTB__ __PRI64 "B"201#endif202#ifndef __UINTPTR_FMTB__203#define __UINTPTR_FMTB__ __PRIPTR "B"204#endif205 206// The fprintf() macros for signed integers.207#define PRId8 __INT8_FMTd__208#define PRId16 __INT16_FMTd__209#define PRId32 __INT32_FMTd__210#define PRId64 __INT64_FMTd__211#define PRIdLEAST8 __INT_LEAST8_FMTd__212#define PRIdLEAST16 __INT_LEAST16_FMTd__213#define PRIdLEAST32 __INT_LEAST32_FMTd__214#define PRIdLEAST64 __INT_LEAST64_FMTd__215#define PRIdFAST8 __INT_FAST8_FMTd__216#define PRIdFAST16 __INT_FAST16_FMTd__217#define PRIdFAST32 __INT_FAST32_FMTd__218#define PRIdFAST64 __INT_FAST64_FMTd__219#define PRIdMAX __INTMAX_FMTd__220#define PRIdPTR __INTPTR_FMTd__221 222#define PRIi8 __INT8_FMTi__223#define PRIi16 __INT16_FMTi__224#define PRIi32 __INT32_FMTi__225#define PRIi64 __INT64_FMTi__226#define PRIiLEAST8 __INT_LEAST8_FMTi__227#define PRIiLEAST16 __INT_LEAST16_FMTi__228#define PRIiLEAST32 __INT_LEAST32_FMTi__229#define PRIiLEAST64 __INT_LEAST64_FMTi__230#define PRIiFAST8 __INT_FAST8_FMTi__231#define PRIiFAST16 __INT_FAST16_FMTi__232#define PRIiFAST32 __INT_FAST32_FMTi__233#define PRIiFAST64 __INT_FAST64_FMTi__234#define PRIiMAX __INTMAX_FMTi__235#define PRIiPTR __INTPTR_FMTi__236 237// The fprintf() macros for unsigned integers.238#define PRIo8 __UINT8_FMTo__239#define PRIo16 __UINT16_FMTo__240#define PRIo32 __UINT32_FMTo__241#define PRIo64 __UINT64_FMTo__242#define PRIoLEAST8 __UINT_LEAST8_FMTo__243#define PRIoLEAST16 __UINT_LEAST16_FMTo__244#define PRIoLEAST32 __UINT_LEAST32_FMTo__245#define PRIoLEAST64 __UINT_LEAST64_FMTo__246#define PRIoFAST8 __UINT_FAST8_FMTo__247#define PRIoFAST16 __UINT_FAST16_FMTo__248#define PRIoFAST32 __UINT_FAST32_FMTo__249#define PRIoFAST64 __UINT_FAST64_FMTo__250#define PRIoMAX __UINTMAX_FMTo__251#define PRIoPTR __UINTPTR_FMTo__252 253#define PRIu8 __UINT8_FMTu__254#define PRIu16 __UINT16_FMTu__255#define PRIu32 __UINT32_FMTu__256#define PRIu64 __UINT64_FMTu__257#define PRIuLEAST8 __UINT_LEAST8_FMTu__258#define PRIuLEAST16 __UINT_LEAST16_FMTu__259#define PRIuLEAST32 __UINT_LEAST32_FMTu__260#define PRIuLEAST64 __UINT_LEAST64_FMTu__261#define PRIuFAST8 __UINT_FAST8_FMTu__262#define PRIuFAST16 __UINT_FAST16_FMTu__263#define PRIuFAST32 __UINT_FAST32_FMTu__264#define PRIuFAST64 __UINT_FAST64_FMTu__265#define PRIuMAX __UINTMAX_FMTu__266#define PRIuPTR __UINTPTR_FMTu__267 268#define PRIx8 __UINT8_FMTx__269#define PRIx16 __UINT16_FMTx__270#define PRIx32 __UINT32_FMTx__271#define PRIx64 __UINT64_FMTx__272#define PRIxLEAST8 __UINT_LEAST8_FMTx__273#define PRIxLEAST16 __UINT_LEAST16_FMTx__274#define PRIxLEAST32 __UINT_LEAST32_FMTx__275#define PRIxLEAST64 __UINT_LEAST64_FMTx__276#define PRIxFAST8 __UINT_FAST8_FMTx__277#define PRIxFAST16 __UINT_FAST16_FMTx__278#define PRIxFAST32 __UINT_FAST32_FMTx__279#define PRIxFAST64 __UINT_FAST64_FMTx__280#define PRIxMAX __UINTMAX_FMTx__281#define PRIxPTR __UINTPTR_FMTx__282 283#define PRIX8 __UINT8_FMTX__284#define PRIX16 __UINT16_FMTX__285#define PRIX32 __UINT32_FMTX__286#define PRIX64 __UINT64_FMTX__287#define PRIXLEAST8 __UINT_LEAST8_FMTX__288#define PRIXLEAST16 __UINT_LEAST16_FMTX__289#define PRIXLEAST32 __UINT_LEAST32_FMTX__290#define PRIXLEAST64 __UINT_LEAST64_FMTX__291#define PRIXFAST8 __UINT_FAST8_FMTX__292#define PRIXFAST16 __UINT_FAST16_FMTX__293#define PRIXFAST32 __UINT_FAST32_FMTX__294#define PRIXFAST64 __UINT_FAST64_FMTX__295#define PRIXMAX __UINTMAX_FMTX__296#define PRIXPTR __UINTPTR_FMTX__297 298#define PRIb8 __UINT8_FMTb__299#define PRIb16 __UINT16_FMTb__300#define PRIb32 __UINT32_FMTb__301#define PRIb64 __UINT64_FMTb__302#define PRIbLEAST8 __UINT_LEAST8_FMTb__303#define PRIbLEAST16 __UINT_LEAST16_FMTb__304#define PRIbLEAST32 __UINT_LEAST32_FMTb__305#define PRIbLEAST64 __UINT_LEAST64_FMTb__306#define PRIbFAST8 __UINT_FAST8_FMTb__307#define PRIbFAST16 __UINT_FAST16_FMTb__308#define PRIbFAST32 __UINT_FAST32_FMTb__309#define PRIbFAST64 __UINT_FAST64_FMTb__310#define PRIbMAX __UINTMAX_FMTb__311#define PRIbPTR __UINTPTR_FMTb__312 313#define PRIB8 __UINT8_FMTB__314#define PRIB16 __UINT16_FMTB__315#define PRIB32 __UINT32_FMTB__316#define PRIB64 __UINT64_FMTB__317#define PRIBLEAST8 __UINT_LEAST8_FMTB__318#define PRIBLEAST16 __UINT_LEAST16_FMTB__319#define PRIBLEAST32 __UINT_LEAST32_FMTB__320#define PRIBLEAST64 __UINT_LEAST64_FMTB__321#define PRIBFAST8 __UINT_FAST8_FMTB__322#define PRIBFAST16 __UINT_FAST16_FMTB__323#define PRIBFAST32 __UINT_FAST32_FMTB__324#define PRIBFAST64 __UINT_FAST64_FMTB__325#define PRIBMAX __UINTMAX_FMTB__326#define PRIBPTR __UINTPTR_FMTB__327 328// The fscanf() macros for signed integers.329#define SCNd8 __INT8_FMTd__330#define SCNd16 __INT16_FMTd__331#define SCNd32 __INT32_FMTd__332#define SCNd64 __INT64_FMTd__333#define SCNdLEAST8 __INT_LEAST8_FMTd__334#define SCNdLEAST16 __INT_LEAST16_FMTd__335#define SCNdLEAST32 __INT_LEAST32_FMTd__336#define SCNdLEAST64 __INT_LEAST64_FMTd__337#define SCNdFAST8 __INT_FAST8_FMTd__338#define SCNdFAST16 __INT_FAST16_FMTd__339#define SCNdFAST32 __INT_FAST32_FMTd__340#define SCNdFAST64 __INT_FAST64_FMTd__341#define SCNdMAX __INTMAX_FMTd__342#define SCNdPTR __INTPTR_FMTd__343 344#define SCNi8 __INT8_FMTi__345#define SCNi16 __INT16_FMTi__346#define SCNi32 __INT32_FMTi__347#define SCNi64 __INT64_FMTi__348#define SCNiLEAST8 __INT_LEAST8_FMTi__349#define SCNiLEAST16 __INT_LEAST16_FMTi__350#define SCNiLEAST32 __INT_LEAST32_FMTi__351#define SCNiLEAST64 __INT_LEAST64_FMTi__352#define SCNiFAST8 __INT_FAST8_FMTi__353#define SCNiFAST16 __INT_FAST16_FMTi__354#define SCNiFAST32 __INT_FAST32_FMTi__355#define SCNiFAST64 __INT_FAST64_FMTi__356#define SCNiMAX __INTMAX_FMTi__357#define SCNiPTR __INTPTR_FMTi__358 359// The fscanf() macros for unsigned integers.360#define SCNo8 __UINT8_FMTo__361#define SCNo16 __UINT16_FMTo__362#define SCNo32 __UINT32_FMTo__363#define SCNo64 __UINT64_FMTo__364#define SCNoLEAST8 __UINT_LEAST8_FMTo__365#define SCNoLEAST16 __UINT_LEAST16_FMTo__366#define SCNoLEAST32 __UINT_LEAST32_FMTo__367#define SCNoLEAST64 __UINT_LEAST64_FMTo__368#define SCNoFAST8 __UINT_FAST8_FMTo__369#define SCNoFAST16 __UINT_FAST16_FMTo__370#define SCNoFAST32 __UINT_FAST32_FMTo__371#define SCNoFAST64 __UINT_FAST64_FMTo__372#define SCNoMAX __UINTMAX_FMTo__373#define SCNoPTR __UINTPTR_FMTo__374 375#define SCNu8 __UINT8_FMTu__376#define SCNu16 __UINT16_FMTu__377#define SCNu32 __UINT32_FMTu__378#define SCNu64 __UINT64_FMTu__379#define SCNuLEAST8 __UINT_LEAST8_FMTu__380#define SCNuLEAST16 __UINT_LEAST16_FMTu__381#define SCNuLEAST32 __UINT_LEAST32_FMTu__382#define SCNuLEAST64 __UINT_LEAST64_FMTu__383#define SCNuFAST8 __UINT_FAST8_FMTu__384#define SCNuFAST16 __UINT_FAST16_FMTu__385#define SCNuFAST32 __UINT_FAST32_FMTu__386#define SCNuFAST64 __UINT_FAST64_FMTu__387#define SCNuMAX __UINTMAX_FMTu__388#define SCNuPTR __UINTPTR_FMTu__389 390#define SCNx8 __UINT8_FMTx__391#define SCNx16 __UINT16_FMTx__392#define SCNx32 __UINT32_FMTx__393#define SCNx64 __UINT64_FMTx__394#define SCNxLEAST8 __UINT_LEAST8_FMTx__395#define SCNxLEAST16 __UINT_LEAST16_FMTx__396#define SCNxLEAST32 __UINT_LEAST32_FMTx__397#define SCNxLEAST64 __UINT_LEAST64_FMTx__398#define SCNxFAST8 __UINT_FAST8_FMTx__399#define SCNxFAST16 __UINT_FAST16_FMTx__400#define SCNxFAST32 __UINT_FAST32_FMTx__401#define SCNxFAST64 __UINT_FAST64_FMTx__402#define SCNxMAX __UINTMAX_FMTx__403#define SCNxPTR __UINTPTR_FMTx__404 405#define SCNb8 __UINT8_FMTb__406#define SCNb16 __UINT16_FMTb__407#define SCNb32 __UINT32_FMTb__408#define SCNb64 __UINT64_FMTb__409#define SCNbLEAST8 __UINT_LEAST8_FMTb__410#define SCNbLEAST16 __UINT_LEAST16_FMTb__411#define SCNbLEAST32 __UINT_LEAST32_FMTb__412#define SCNbLEAST64 __UINT_LEAST64_FMTb__413#define SCNbFAST8 __UINT_FAST8_FMTb__414#define SCNbFAST16 __UINT_FAST16_FMTb__415#define SCNbFAST32 __UINT_FAST32_FMTb__416#define SCNbFAST64 __UINT_FAST64_FMTb__417#define SCNbMAX __UINTMAX_FMTb__418#define SCNbPTR __UINTPTR_FMTb__419 420#endif // LLVM_LIBC_MACROS_INTTYPES_MACROS_H421