diff options
author | Ken Dyck <ken.dyck@onsemi.com> | 2009-11-16 16:36:33 +0000 |
---|---|---|
committer | Ken Dyck <ken.dyck@onsemi.com> | 2009-11-16 16:36:33 +0000 |
commit | 2dc8d5fa3ea16c00ce01dd3eed74861489dd998f (patch) | |
tree | c8785a7320e5701be7c7d2a0c2f3e3ac778a4e7b /clang/lib | |
parent | 551861e7d9d4b9f2bd7806e3b8b6875580c2b3c9 (diff) | |
download | bcm5719-llvm-2dc8d5fa3ea16c00ce01dd3eed74861489dd998f.tar.gz bcm5719-llvm-2dc8d5fa3ea16c00ce01dd3eed74861489dd998f.zip |
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
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Headers/stdint.h | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 69680491319..9648620ea07 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -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, diff --git a/clang/lib/Headers/stdint.h b/clang/lib/Headers/stdint.h index b404e3dfdf7..419dc0b9121 100644 --- a/clang/lib/Headers/stdint.h +++ b/clang/lib/Headers/stdint.h @@ -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__) |