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)) ||