For now -fno-math-errno is the default on BSD-derived platforms (Darwin,
DragonFlyBSD, FreeBSD, NetBSD, OpenBSD). If the default is not right for
your platform, please yell. I only verified the result with the default
compilers on Darwin and FreeBSD.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155990
91177308-0d34-0410-b5e6-
96231b3b80d8
/// default.
virtual bool IsStrictAliasingDefault() const { return true; }
+ /// IsMathErrnoDefault - Does this tool chain use -fmath-errno by default.
+ virtual bool IsMathErrnoDefault() const { return true; }
+
/// IsObjCDefaultSynthPropertiesDefault - Does this tool chain enable
/// -fobjc-default-synthesize-properties by default.
virtual bool IsObjCDefaultSynthPropertiesDefault() const { return false; }
return ToolChain::IsStrictAliasingDefault();
#endif
}
-
+
+ virtual bool IsMathErrnoDefault() const {
+ return false;
+ }
+
virtual bool IsObjCDefaultSynthPropertiesDefault() const {
return true;
}
public:
OpenBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args);
+ virtual bool IsMathErrnoDefault() const { return false; }
virtual bool IsObjCNonFragileABIDefault() const { return true; }
virtual bool IsObjCLegacyDispatchDefault() const {
llvm::Triple::ArchType Arch = getTriple().getArch();
public:
FreeBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args);
+ virtual bool IsMathErrnoDefault() const { return false; }
virtual bool IsObjCNonFragileABIDefault() const { return true; }
virtual bool IsObjCLegacyDispatchDefault() const {
llvm::Triple::ArchType Arch = getTriple().getArch();
public:
NetBSD(const Driver &D, const llvm::Triple& Triple, const ArgList &Args);
+ virtual bool IsMathErrnoDefault() const { return false; }
virtual bool IsObjCNonFragileABIDefault() const { return true; }
virtual bool IsObjCLegacyDispatchDefault() const {
llvm::Triple::ArchType Arch = getTriple().getArch();
public:
DragonFly(const Driver &D, const llvm::Triple& Triple, const ArgList &Args);
+ virtual bool IsMathErrnoDefault() const { return false; }
+
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA,
const ActionList &Inputs) const;
};
A->getOption().getID() != options::OPT_fhonor_nans)
CmdArgs.push_back("-menable-no-nans");
- // -fno-math-errno is default on Darwin. Other platforms, -fmath-errno is the
- // default.
- bool MathErrno = !getToolChain().getTriple().isOSDarwin();
+ // -fmath-errno is the default on some platforms, e.g. BSD-derived OSes.
+ bool MathErrno = getToolChain().IsMathErrnoDefault();
if (Arg *A = Args.getLastArg(options::OPT_ffast_math,
options::OPT_fmath_errno,
options::OPT_fno_math_errno))
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
// RUN: %clang -### -target i686-apple-darwin -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-unknown-freebsd -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-unknown-netbsd -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
+// RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s
// CHECK-NO-MATH-ERRNO: "-cc1"
// CHECK-NO-MATH-ERRNO-NOT: "-fmath-errno"
//