From 455e72e7625a8f87c2c302d8d82baee5c111e094 Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Thu, 19 Jul 2012 03:52:53 +0000 Subject: Define __FINITE_MATH_ONLY__ based on -ffast-math and -ffinite-math-only. This macro was being unconditionally set to zero, preceded by a FIXME comment. This fixes . Patch by Michael Gottesman! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160491 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/InitPreprocessor.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/Frontend/InitPreprocessor.cpp') diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 6120d117e3..3979731ff6 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -527,9 +527,10 @@ static void InitializePredefinedMacros(const TargetInfo &TI, if (const char *Prefix = TI.getUserLabelPrefix()) Builder.defineMacro("__USER_LABEL_PREFIX__", Prefix); - // Build configuration options. FIXME: these should be controlled by - // command line options or something. - Builder.defineMacro("__FINITE_MATH_ONLY__", "0"); + if (LangOpts.FastMath || LangOpts.FiniteMathOnly) + Builder.defineMacro("__FINITE_MATH_ONLY__", "1"); + else + Builder.defineMacro("__FINITE_MATH_ONLY__", "0"); if (LangOpts.GNUInline) Builder.defineMacro("__GNUC_GNU_INLINE__"); -- cgit v1.2.3