forked from OSchip/llvm-project
[driver] Fix unused argument warnings.
1. Don't short-circuit conditional statements that are checking flags. Otherwise, the driver emits warnings about unused arguments. 2. -mkernel and -fapple-kext imply no exceptions, so claim exception related arguments now to avoid warnings about unused arguments. rdar://11120518 llvm-svn: 153478
This commit is contained in:
parent
41b77265e3
commit
4fab82cda6
|
|
@ -1081,8 +1081,17 @@ static void addExceptionArgs(const ArgList &Args, types::ID InputType,
|
||||||
bool KernelOrKext, bool IsRewriter,
|
bool KernelOrKext, bool IsRewriter,
|
||||||
unsigned objcABIVersion,
|
unsigned objcABIVersion,
|
||||||
ArgStringList &CmdArgs) {
|
ArgStringList &CmdArgs) {
|
||||||
if (KernelOrKext)
|
if (KernelOrKext) {
|
||||||
|
// -mkernel and -fapple-kext imply no exceptions, so claim exception related
|
||||||
|
// arguments now to avoid warnings about unused arguments.
|
||||||
|
Args.ClaimAllArgs(options::OPT_fexceptions);
|
||||||
|
Args.ClaimAllArgs(options::OPT_fno_exceptions);
|
||||||
|
Args.ClaimAllArgs(options::OPT_fobjc_exceptions);
|
||||||
|
Args.ClaimAllArgs(options::OPT_fno_objc_exceptions);
|
||||||
|
Args.ClaimAllArgs(options::OPT_fcxx_exceptions);
|
||||||
|
Args.ClaimAllArgs(options::OPT_fno_cxx_exceptions);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Exceptions are enabled by default.
|
// Exceptions are enabled by default.
|
||||||
bool ExceptionsEnabled = true;
|
bool ExceptionsEnabled = true;
|
||||||
|
|
@ -1965,9 +1974,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
Args.AddLastArg(CmdArgs, options::OPT_fvisibility_inlines_hidden);
|
Args.AddLastArg(CmdArgs, options::OPT_fvisibility_inlines_hidden);
|
||||||
|
|
||||||
// -fhosted is default.
|
// -fhosted is default.
|
||||||
if (KernelOrKext || Args.hasFlag(options::OPT_ffreestanding,
|
if (Args.hasFlag(options::OPT_ffreestanding, options::OPT_fhosted, false) ||
|
||||||
options::OPT_fhosted,
|
KernelOrKext)
|
||||||
false))
|
|
||||||
CmdArgs.push_back("-ffreestanding");
|
CmdArgs.push_back("-ffreestanding");
|
||||||
|
|
||||||
// Forward -f (flag) options which we can pass directly.
|
// Forward -f (flag) options which we can pass directly.
|
||||||
|
|
@ -2123,8 +2131,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
CmdArgs.push_back("-fno-elide-constructors");
|
CmdArgs.push_back("-fno-elide-constructors");
|
||||||
|
|
||||||
// -frtti is default.
|
// -frtti is default.
|
||||||
if (KernelOrKext ||
|
if (!Args.hasFlag(options::OPT_frtti, options::OPT_fno_rtti) ||
|
||||||
!Args.hasFlag(options::OPT_frtti, options::OPT_fno_rtti))
|
KernelOrKext)
|
||||||
CmdArgs.push_back("-fno-rtti");
|
CmdArgs.push_back("-fno-rtti");
|
||||||
|
|
||||||
// -fshort-enums=0 is default for all architectures except Hexagon.
|
// -fshort-enums=0 is default for all architectures except Hexagon.
|
||||||
|
|
@ -2145,12 +2153,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
CmdArgs.push_back("-fno-threadsafe-statics");
|
CmdArgs.push_back("-fno-threadsafe-statics");
|
||||||
|
|
||||||
// -fuse-cxa-atexit is default.
|
// -fuse-cxa-atexit is default.
|
||||||
if (KernelOrKext ||
|
if (!Args.hasFlag(options::OPT_fuse_cxa_atexit,
|
||||||
!Args.hasFlag(options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
|
options::OPT_fno_use_cxa_atexit,
|
||||||
getToolChain().getTriple().getOS() != llvm::Triple::Cygwin &&
|
getToolChain().getTriple().getOS() != llvm::Triple::Cygwin &&
|
||||||
getToolChain().getTriple().getOS() != llvm::Triple::MinGW32 &&
|
getToolChain().getTriple().getOS() != llvm::Triple::MinGW32 &&
|
||||||
getToolChain().getTriple().getArch() !=
|
getToolChain().getTriple().getArch() != llvm::Triple::hexagon) ||
|
||||||
llvm::Triple::hexagon))
|
KernelOrKext)
|
||||||
CmdArgs.push_back("-fno-use-cxa-atexit");
|
CmdArgs.push_back("-fno-use-cxa-atexit");
|
||||||
|
|
||||||
// -fms-extensions=0 is default.
|
// -fms-extensions=0 is default.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue