forked from OSchip/llvm-project
Use -fno-math-errno by default, and remove the IsMathErrnoDefault
targethook, which is no longer being used. This fixes PR5971. llvm-svn: 92987
This commit is contained in:
parent
39d70940e4
commit
d1e76b957b
|
@ -323,6 +323,8 @@ def fgnu_runtime : Flag<"-fgnu-runtime">,
|
|||
HelpText<"Generate output compatible with the standard GNU Objective-C runtime">;
|
||||
def std_EQ : Joined<"-std=">,
|
||||
HelpText<"Language standard to compile for">;
|
||||
def fmath_errno : Flag<"-fmath-errno">,
|
||||
HelpText<"Require math functions to indicate errors by setting errno">;
|
||||
def fms_extensions : Flag<"-fms-extensions">,
|
||||
HelpText<"Accept some non-standard constructs used in Microsoft header files ">;
|
||||
def main_file_name : Separate<"-main-file-name">,
|
||||
|
@ -331,8 +333,6 @@ def fno_elide_constructors : Flag<"-fno-elide-constructors">,
|
|||
HelpText<"Disable C++ copy constructor elision">;
|
||||
def fno_lax_vector_conversions : Flag<"-fno-lax-vector-conversions">,
|
||||
HelpText<"Disallow implicit conversions between vectors with a different number of elements or different element types">;
|
||||
def fno_math_errno : Flag<"-fno-math-errno">,
|
||||
HelpText<"Don't require math functions to respect errno">;
|
||||
def fno_signed_char : Flag<"-fno-signed-char">,
|
||||
HelpText<"Char is unsigned">;
|
||||
def fno_operator_names : Flag<"-fno-operator-names">,
|
||||
|
|
|
@ -87,10 +87,6 @@ public:
|
|||
|
||||
// Platform defaults information
|
||||
|
||||
/// IsMathErrnoDefault - Does this tool chain set -fmath-errno by
|
||||
/// default.
|
||||
virtual bool IsMathErrnoDefault() const = 0;
|
||||
|
||||
/// IsBlocksDefault - Does this tool chain enable -fblocks by default.
|
||||
virtual bool IsBlocksDefault() const { return false; }
|
||||
|
||||
|
|
|
@ -516,10 +516,6 @@ DerivedArgList *Darwin::TranslateArgs(InputArgList &Args,
|
|||
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 @@ Tool &Generic_GCC::SelectTool(const Compilation &C,
|
|||
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.
|
||||
|
|
|
@ -38,7 +38,6 @@ public:
|
|||
|
||||
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 @@ public:
|
|||
|
||||
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);
|
||||
|
|
|
@ -837,11 +837,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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)) ||
|
||||
|
|
|
@ -479,8 +479,8 @@ static void LangOptsToArgs(const LangOptions &Opts,
|
|||
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 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
|||
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);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// RUN: %clang_cc1 -emit-llvm -o %t %s -triple i386-unknown-unknown
|
||||
// RUN: %clang_cc1 -fmath-errno -emit-llvm -o %t %s -triple i386-unknown-unknown
|
||||
// RUN: grep "declare " %t | count 6
|
||||
// RUN: grep "declare " %t | grep "@llvm." | count 1
|
||||
// RUN: %clang_cc1 -fno-math-errno -emit-llvm -o %t %s -triple i386-unknown-unknown
|
||||
// RUN: %clang_cc1 -emit-llvm -o %t %s -triple i386-unknown-unknown
|
||||
// RUN: grep "declare " %t | count 6
|
||||
// RUN: grep "declare " %t | grep -v "@llvm." | count 0
|
||||
|
||||
|
|
|
@ -6,4 +6,3 @@
|
|||
|
||||
// CHECK: "-analyze"
|
||||
// CHECK: "-target-feature" "+sse"
|
||||
// CHECK: "-fno-math-errno"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// RUN: %clang -### -S -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
|
||||
// RUN: %clang -### -S -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
|
||||
// RUN: %clang -### -S -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
|
||||
// RUN: %clang -### -S -fblocks -fbuiltin -fno-math-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fmath-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
|
||||
// RUN: %clang -### -fshort-enums %s 2>&1 | FileCheck -check-prefix=CHECK-SHORT-ENUMS %s
|
||||
|
||||
// CHECK-OPTIONS1: -fblocks
|
||||
// CHECK-OPTIONS1: -fpascal-strings
|
||||
|
||||
// CHECK-OPTIONS2: -fno-math-errno
|
||||
// CHECK-OPTIONS2: -fmath-errno
|
||||
// CHECK-OPTIONS2: -fno-builtin
|
||||
// CHECK-OPTIONS2: -fshort-wchar
|
||||
// CHECK-OPTIONS2: -fno-common
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify -fno-math-errno %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
|
||||
int foo(int X, int Y);
|
||||
|
||||
double sqrt(double X); // implicitly const because of -fno-math-errno!
|
||||
double sqrt(double X); // implicitly const because of no -fmath-errno!
|
||||
|
||||
void bar(volatile int *VP, int *P, int A,
|
||||
_Complex double C, volatile _Complex double VC) {
|
||||
|
@ -24,7 +24,7 @@ void bar(volatile int *VP, int *P, int A,
|
|||
__real__ C; // expected-warning {{expression result unused}}
|
||||
__real__ VC;
|
||||
|
||||
// We know this can't change errno because of -fno-math-errno.
|
||||
// We know this can't change errno because of no -fmath-errno.
|
||||
sqrt(A); // expected-warning {{ignoring return value of function declared with const attribute}}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue