forked from OSchip/llvm-project
Parameterize the constant-generating macros in stdint.h with new built-in
__INTn_C_SUFFIX__ macros that are defined for types with corresponding constant suffixes (i.e. long and long long). llvm-svn: 88914
This commit is contained in:
parent
551861e7d9
commit
2dc8d5fa3e
|
@ -240,8 +240,16 @@ static void DefineType(const char *MacroName, TargetInfo::IntType Ty,
|
|||
static void DefineExactWidthIntType(TargetInfo::IntType Ty,
|
||||
const TargetInfo &TI, std::vector<char> &Buf) {
|
||||
char MacroBuf[60];
|
||||
sprintf(MacroBuf, "__INT%d_TYPE__", TI.getTypeWidth(Ty));
|
||||
int TypeWidth = TI.getTypeWidth(Ty);
|
||||
sprintf(MacroBuf, "__INT%d_TYPE__", TypeWidth);
|
||||
DefineType(MacroBuf, Ty, Buf);
|
||||
|
||||
|
||||
const char *ConstSuffix = TargetInfo::getTypeConstantSuffix(Ty);
|
||||
if (strlen(ConstSuffix) > 0) {
|
||||
sprintf(MacroBuf, "__INT%d_C_SUFFIX__=%s", TypeWidth, ConstSuffix);
|
||||
DefineBuiltinMacro(Buf, MacroBuf);
|
||||
}
|
||||
}
|
||||
|
||||
static void InitializePredefinedMacros(const TargetInfo &TI,
|
||||
|
|
|
@ -247,8 +247,6 @@ typedef __UINTMAX_TYPE__ uintmax_t;
|
|||
|
||||
|
||||
#ifdef __INT64_TYPE__
|
||||
/* FIXME: predefine suffix based on type*/
|
||||
# define __INT64_C_SUFFIX__ LL
|
||||
# ifdef __INT64_C_SUFFIX__
|
||||
# define __int64_c_suffix __INT64_C_SUFFIX__
|
||||
# define __int32_c_suffix __INT64_C_SUFFIX__
|
||||
|
@ -274,8 +272,6 @@ typedef __UINTMAX_TYPE__ uintmax_t;
|
|||
|
||||
|
||||
#ifdef __INT56_TYPE__
|
||||
/* FIXME: predefine suffix based on type */
|
||||
# define __INT56_C_SUFFIX__ L
|
||||
# ifdef __INT56_C_SUFFIX__
|
||||
# define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
|
||||
# define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
|
||||
|
@ -293,8 +289,6 @@ typedef __UINTMAX_TYPE__ uintmax_t;
|
|||
|
||||
|
||||
#ifdef __INT48_TYPE__
|
||||
/* FIXME: predefine suffix based on type */
|
||||
# define __INT48_C_SUFFIX__ L
|
||||
# ifdef __INT48_C_SUFFIX__
|
||||
# define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
|
||||
# define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
|
||||
|
@ -312,8 +306,6 @@ typedef __UINTMAX_TYPE__ uintmax_t;
|
|||
|
||||
|
||||
#ifdef __INT40_TYPE__
|
||||
/* FIXME: predefine suffix based on type */
|
||||
# define __INT40_C_SUFFIX__ L
|
||||
# ifdef __INT40_C_SUFFIX__
|
||||
# define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
|
||||
# define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
|
||||
|
|
|
@ -155,6 +155,7 @@
|
|||
// ARM:#define __FLT_RADIX__ 2
|
||||
// ARM:#define __INT16_TYPE__ short
|
||||
// ARM:#define __INT32_TYPE__ int
|
||||
// ARM:#define __INT64_C_SUFFIX__ LL
|
||||
// ARM:#define __INT64_TYPE__ long long int
|
||||
// ARM:#define __INT8_TYPE__ char
|
||||
// ARM:#define __INTMAX_MAX__ 9223372036854775807LL
|
||||
|
@ -232,6 +233,7 @@
|
|||
// BFIN:#define __FLT_RADIX__ 2
|
||||
// BFIN:#define __INT16_TYPE__ short
|
||||
// BFIN:#define __INT32_TYPE__ int
|
||||
// BFIN:#define __INT64_C_SUFFIX__ LL
|
||||
// BFIN:#define __INT64_TYPE__ long long int
|
||||
// BFIN:#define __INT8_TYPE__ char
|
||||
// BFIN:#define __INTMAX_MAX__ 9223372036854775807LL
|
||||
|
@ -302,6 +304,7 @@
|
|||
// I386:#define __FLT_RADIX__ 2
|
||||
// I386:#define __INT16_TYPE__ short
|
||||
// I386:#define __INT32_TYPE__ int
|
||||
// I386:#define __INT64_C_SUFFIX__ LL
|
||||
// I386:#define __INT64_TYPE__ long long int
|
||||
// I386:#define __INT8_TYPE__ char
|
||||
// I386:#define __INTMAX_MAX__ 9223372036854775807LL
|
||||
|
@ -378,6 +381,7 @@
|
|||
// MSP430:#define __FLT_MIN__ 1.17549435e-38F
|
||||
// MSP430:#define __FLT_RADIX__ 2
|
||||
// MSP430:#define __INT16_TYPE__ short
|
||||
// MSP430:#define __INT32_C_SUFFIX__ L
|
||||
// MSP430:#define __INT32_TYPE__ long int
|
||||
// MSP430:#define __INT8_TYPE__ char
|
||||
// MSP430:#define __INTMAX_MAX__ 2147483647L
|
||||
|
@ -447,6 +451,7 @@
|
|||
// PIC16:#define __FLT_MIN__ 1.17549435e-38F
|
||||
// PIC16:#define __FLT_RADIX__ 2
|
||||
// PIC16:#define __INT16_TYPE__ short
|
||||
// PIC16:#define __INT32_C_SUFFIX__ L
|
||||
// PIC16:#define __INT32_TYPE__ long int
|
||||
// PIC16:#define __INT8_TYPE__ char
|
||||
// PIC16:#define __INTMAX_MAX__ 2147483647L
|
||||
|
@ -528,6 +533,7 @@
|
|||
// PPC64:#define __FLT_RADIX__ 2
|
||||
// PPC64:#define __INT16_TYPE__ short
|
||||
// PPC64:#define __INT32_TYPE__ int
|
||||
// PPC64:#define __INT64_C_SUFFIX__ L
|
||||
// PPC64:#define __INT64_TYPE__ long int
|
||||
// PPC64:#define __INT8_TYPE__ char
|
||||
// PPC64:#define __INTMAX_MAX__ 9223372036854775807L
|
||||
|
@ -606,6 +612,7 @@
|
|||
// PPC:#define __FLT_RADIX__ 2
|
||||
// PPC:#define __INT16_TYPE__ short
|
||||
// PPC:#define __INT32_TYPE__ int
|
||||
// PPC:#define __INT64_C_SUFFIX__ LL
|
||||
// PPC:#define __INT64_TYPE__ long long int
|
||||
// PPC:#define __INT8_TYPE__ char
|
||||
// PPC:#define __INTMAX_MAX__ 9223372036854775807LL
|
||||
|
@ -679,6 +686,7 @@
|
|||
// S390X:#define __FLT_RADIX__ 2
|
||||
// S390X:#define __INT16_TYPE__ short
|
||||
// S390X:#define __INT32_TYPE__ int
|
||||
// S390X:#define __INT64_C_SUFFIX__ L
|
||||
// S390X:#define __INT64_TYPE__ long int
|
||||
// S390X:#define __INT8_TYPE__ char
|
||||
// S390X:#define __INTMAX_MAX__ 9223372036854775807LL
|
||||
|
@ -748,6 +756,7 @@
|
|||
// SPARC:#define __FLT_RADIX__ 2
|
||||
// SPARC:#define __INT16_TYPE__ short
|
||||
// SPARC:#define __INT32_TYPE__ int
|
||||
// SPARC:#define __INT64_C_SUFFIX__ LL
|
||||
// SPARC:#define __INT64_TYPE__ long long int
|
||||
// SPARC:#define __INT8_TYPE__ char
|
||||
// SPARC:#define __INTMAX_MAX__ 9223372036854775807LL
|
||||
|
@ -893,6 +902,7 @@
|
|||
// X86_64:#define __FLT_RADIX__ 2
|
||||
// X86_64:#define __INT16_TYPE__ short
|
||||
// X86_64:#define __INT32_TYPE__ int
|
||||
// X86_64:#define __INT64_C_SUFFIX__ L
|
||||
// X86_64:#define __INT64_TYPE__ long int
|
||||
// X86_64:#define __INT8_TYPE__ char
|
||||
// X86_64:#define __INTMAX_MAX__ 9223372036854775807L
|
||||
|
|
|
@ -413,8 +413,8 @@
|
|||
// MSP430:UINT8_C_(0) (0U)
|
||||
// MSP430:INT16_C_(0) (0)
|
||||
// MSP430:UINT16_C_(0) (0U)
|
||||
// MSP430:INT32_C_(0) (0)
|
||||
// MSP430:UINT32_C_(0) (0U)
|
||||
// MSP430:INT32_C_(0) (0L)
|
||||
// MSP430:UINT32_C_(0) (0UL)
|
||||
// MSP430:INT64_C_(0) INT64_C(0)
|
||||
// MSP430:UINT64_C_(0) UINT64_C(0)
|
||||
//
|
||||
|
@ -513,8 +513,8 @@
|
|||
// PIC16:UINT8_C_(0) (0U)
|
||||
// PIC16:INT16_C_(0) (0)
|
||||
// PIC16:UINT16_C_(0) (0U)
|
||||
// PIC16:INT32_C_(0) (0)
|
||||
// PIC16:UINT32_C_(0) (0U)
|
||||
// PIC16:INT32_C_(0) (0L)
|
||||
// PIC16:UINT32_C_(0) (0UL)
|
||||
// PIC16:INT64_C_(0) INT64_C(0)
|
||||
// PIC16:UINT64_C_(0) UINT64_C(0)
|
||||
//
|
||||
|
@ -622,8 +622,8 @@
|
|||
// PPC64:UINT16_C_(0) (0U)
|
||||
// PPC64:INT32_C_(0) (0)
|
||||
// PPC64:UINT32_C_(0) (0U)
|
||||
// PPC64:INT64_C_(0) (0LL)
|
||||
// PPC64:UINT64_C_(0) (0ULL)
|
||||
// PPC64:INT64_C_(0) (0L)
|
||||
// PPC64:UINT64_C_(0) (0UL)
|
||||
//
|
||||
// PPC64:INTMAX_C_(0) (0LL)
|
||||
// PPC64:UINTMAX_C_(0) (0ULL)
|
||||
|
@ -837,8 +837,8 @@
|
|||
// S390X:UINT16_C_(0) (0U)
|
||||
// S390X:INT32_C_(0) (0)
|
||||
// S390X:UINT32_C_(0) (0U)
|
||||
// S390X:INT64_C_(0) (0LL)
|
||||
// S390X:UINT64_C_(0) (0ULL)
|
||||
// S390X:INT64_C_(0) (0L)
|
||||
// S390X:UINT64_C_(0) (0UL)
|
||||
//
|
||||
// S390X:INTMAX_C_(0) (0LL)
|
||||
// S390X:UINTMAX_C_(0) (0ULL)
|
||||
|
@ -1152,8 +1152,8 @@
|
|||
// X86_64:UINT16_C_(0) (0U)
|
||||
// X86_64:INT32_C_(0) (0)
|
||||
// X86_64:UINT32_C_(0) (0U)
|
||||
// X86_64:INT64_C_(0) (0LL)
|
||||
// X86_64:UINT64_C_(0) (0ULL)
|
||||
// X86_64:INT64_C_(0) (0L)
|
||||
// X86_64:UINT64_C_(0) (0UL)
|
||||
//
|
||||
// X86_64:INTMAX_C_(0) (0LL)
|
||||
// X86_64:UINTMAX_C_(0) (0ULL)
|
||||
|
|
Loading…
Reference in New Issue