Use -fno-math-errno by default, and remove the IsMathErrnoDefault
targethook, which is no longer being used. This fixes PR5971.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92987 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index cc3febf..419787d 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -516,10 +516,6 @@
return DAL;
}
-bool Darwin::IsMathErrnoDefault() const {
- return false;
-}
-
bool Darwin::IsUnwindTablesDefault() const {
// FIXME: Gross; we should probably have some separate target
// definition, possibly even reusing the one in clang.
@@ -599,10 +595,6 @@
return *T;
}
-bool Generic_GCC::IsMathErrnoDefault() const {
- return true;
-}
-
bool Generic_GCC::IsUnwindTablesDefault() const {
// FIXME: Gross; we should probably have some separate target
// definition, possibly even reusing the one in clang.
diff --git a/lib/Driver/ToolChains.h b/lib/Driver/ToolChains.h
index be36344..374ad8c 100644
--- a/lib/Driver/ToolChains.h
+++ b/lib/Driver/ToolChains.h
@@ -38,7 +38,6 @@
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
- virtual bool IsMathErrnoDefault() const;
virtual bool IsUnwindTablesDefault() const;
virtual const char *GetDefaultRelocationModel() const;
virtual const char *GetForcedPicModel() const;
@@ -136,7 +135,6 @@
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA) const;
- virtual bool IsMathErrnoDefault() const;
virtual bool IsBlocksDefault() const {
// Blocks default to on for 10.6 (darwin10) and beyond.
return (DarwinVersion[0] > 9);
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 8f0af21..bf59abc 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -837,11 +837,11 @@
break;
}
- // -fmath-errno is default.
- if (!Args.hasFlag(options::OPT_fmath_errno,
+ // -fno-math-errno is default.
+ if (Args.hasFlag(options::OPT_fmath_errno,
options::OPT_fno_math_errno,
- getToolChain().IsMathErrnoDefault()))
- CmdArgs.push_back("-fno-math-errno");
+ false))
+ CmdArgs.push_back("-fmath-errno");
Arg *Unsupported;
if ((Unsupported = Args.getLastArg(options::OPT_MG)) ||
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 63f66fa..8817469 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -479,8 +479,8 @@
Res.push_back("-fblocks");
if (Opts.EmitAllDecls)
Res.push_back("-femit-all-decls");
- if (!Opts.MathErrno)
- Res.push_back("-fno-math-errno");
+ if (Opts.MathErrno)
+ Res.push_back("-fmath-errno");
if (Opts.OverflowChecking)
Res.push_back("-ftrapv");
if (Opts.HeinousExtensions)
@@ -1147,7 +1147,7 @@
Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
Opts.AccessControl = Args.hasArg(OPT_faccess_control);
Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
- Opts.MathErrno = !Args.hasArg(OPT_fno_math_errno);
+ Opts.MathErrno = Args.hasArg(OPT_fmath_errno);
Opts.InstantiationDepth = getLastArgIntValue(Args, OPT_ftemplate_depth, 99,
Diags);
Opts.NeXTRuntime = !Args.hasArg(OPT_fgnu_runtime);