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
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 0c1accd..6c5daae 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -612,11 +612,10 @@
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 @@
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);