aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-05 21:49:27 +0000
committerChris Lattner <sabre@nondot.org>2008-10-05 21:49:27 +0000
commit12f09260294175dc097b843d3d06d048b9cd64a3 (patch)
treed9cd908f79159416ccc35c73a2be2486703fd8fe /lib/Lex/Preprocessor.cpp
parent5db552d5c81033636f52dcfa5234dde247a4ca6f (diff)
move __FLT_EVAL_METHOD__, __FLT_RADIX__, and __DECIMAL_DIG__ into
target indep code. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57139 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r--lib/Lex/Preprocessor.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 0c1accd6c2..6c5daae13b 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -612,11 +612,10 @@ static void InitializePredefinedMacros(Preprocessor &PP,
Buf.push_back('\n');
}
+ char MacroBuf[60];
if (const char *Prefix = TI.getUserLabelPrefix()) {
- llvm::SmallString<20> TmpStr;
- TmpStr += "__USER_LABEL_PREFIX__=";
- TmpStr += Prefix;
- DefineBuiltinMacro(Buf, TmpStr.c_str());
+ sprintf(MacroBuf, "__USER_LABEL_PREFIX__=%s", Prefix);
+ DefineBuiltinMacro(Buf, MacroBuf);
}
// Build configuration options. FIXME: these should be controlled by
@@ -626,6 +625,13 @@ static void InitializePredefinedMacros(Preprocessor &PP,
DefineBuiltinMacro(Buf, "__NO_INLINE__=1");
DefineBuiltinMacro(Buf, "__PIC__=1");
+ // Macros to control C99 numerics and <float.h>
+ DefineBuiltinMacro(Buf, "__FLT_EVAL_METHOD__=0");
+ DefineBuiltinMacro(Buf, "__FLT_RADIX__=2");
+ sprintf(MacroBuf, "__DECIMAL_DIG__=%d",
+ PickFP(&TI.getLongDoubleFormat(), -1/*FIXME*/, 17, 21, 33));
+ DefineBuiltinMacro(Buf, MacroBuf);
+
// Get other target #defines.
TI.getTargetDefines(Buf);