r225100 - Really don't warn about -flto/fno-lto :-(
Robinson, Paul
Paul_Robinson at playstation.sony.com
Mon Jan 5 01:02:02 PST 2015
> -----Original Message-----
> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-
> bounces at cs.uiuc.edu] On Behalf Of Rafael Espindola
> Sent: Friday, January 02, 2015 4:06 PM
> To: cfe-commits at cs.uiuc.edu
> Subject: r225100 - Really don't warn about -flto/fno-lto :-(
>
> Author: rafael
> Date: Fri Jan 2 18:06:04 2015
> New Revision: 225100
>
> URL: http://llvm.org/viewvc/llvm-project?rev=225100&view=rev
> Log:
> Really don't warn about -flto/fno-lto :-(
>
> This should fix the last bots.
>
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/test/Driver/clang-s-opts.s
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/cfe/trunk/lib/Driver/Tools.cpp?rev=225100&r1=225099&r2=225100&view
> =diff
> ==========================================================================
> ====
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri Jan 2 18:06:04 2015
> @@ -2440,6 +2440,19 @@ static std::string getMSCompatibilityVer
> llvm::utostr_32(Build);
> }
>
> +// Claim options we don't want to warn if they are unused. We do this for
> +// options that
> +// build systems might add but are unused when assembling or only running the
> +// preprocessor
> +// for example.
The formatting on that comment seems kind of strange...
--paulr
> +static void claimNoWarnArgs(const ArgList &Args) {
> + // Don't warn about unused -f(no-)?lto. This can happen when we're
> + // preprocessing,
> + // precompiling or assembling.
> + Args.ClaimAllArgs(options::OPT_flto);
> + Args.ClaimAllArgs(options::OPT_fno_lto);
> +}
> +
> void Clang::ConstructJob(Compilation &C, const JobAction &JA,
> const InputInfo &Output,
> const InputInfoList &Inputs,
> @@ -3379,10 +3392,7 @@ void Clang::ConstructJob(Compilation &C,
> D.Diag(diag::warn_ignored_gcc_optimization) << (*it)-
> >getAsString(Args);
> }
>
> - // Don't warn about unused -f(no-)?lto. This can happen when we're
> preprocessing or
> - // precompiling.
> - Args.ClaimAllArgs(options::OPT_flto);
> - Args.ClaimAllArgs(options::OPT_fno_lto);
> + claimNoWarnArgs(Args);
>
> Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
> Args.AddAllArgs(CmdArgs, options::OPT_W_Group);
> @@ -4810,10 +4820,7 @@ void ClangAs::ConstructJob(Compilation &
> // and "clang -emit-llvm -c foo.s"
> Args.ClaimAllArgs(options::OPT_emit_llvm);
>
> - // Don't warn on -flto/-fno-lto
> - // FIXME: Code duplicated with Clang::ConstructJob.
> - Args.ClaimAllArgs(options::OPT_flto);
> - Args.ClaimAllArgs(options::OPT_fno_lto);
> + claimNoWarnArgs(Args);
>
> // Invoke ourselves in -cc1as mode.
> //
> @@ -5095,6 +5102,7 @@ void hexagon::Assemble::ConstructJob(Com
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
>
> const Driver &D = getToolChain().getDriver();
> ArgStringList CmdArgs;
> @@ -6004,6 +6012,7 @@ void solaris::Assemble::ConstructJob(Com
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
> ArgStringList CmdArgs;
>
> Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
> @@ -6129,6 +6138,7 @@ void openbsd::Assemble::ConstructJob(Com
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
> ArgStringList CmdArgs;
> bool NeedsKPIC = false;
>
> @@ -6331,6 +6341,7 @@ void bitrig::Assemble::ConstructJob(Comp
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
> ArgStringList CmdArgs;
>
> Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
> @@ -6467,6 +6478,7 @@ void freebsd::Assemble::ConstructJob(Com
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
> ArgStringList CmdArgs;
>
> // When building 32-bit code on FreeBSD/amd64, we have to explicitly
> @@ -6732,6 +6744,7 @@ void netbsd::Assemble::ConstructJob(Comp
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
> ArgStringList CmdArgs;
>
> // GNU as needs different flags for creating the correct output format
> @@ -7014,6 +7027,8 @@ void gnutools::Assemble::ConstructJob(Co
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
> +
> ArgStringList CmdArgs;
> bool NeedsKPIC = false;
>
> @@ -7574,6 +7589,7 @@ void minix::Assemble::ConstructJob(Compi
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
> ArgStringList CmdArgs;
>
> Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
> options::OPT_Xassembler);
> @@ -7651,6 +7667,7 @@ void dragonfly::Assemble::ConstructJob(C
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
> ArgStringList CmdArgs;
>
> // When building 32-bit code on DragonFly/pc64, we have to explicitly
> @@ -8083,6 +8100,7 @@ void XCore::Assemble::ConstructJob(Compi
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput) const {
> + claimNoWarnArgs(Args);
> ArgStringList CmdArgs;
>
> CmdArgs.push_back("-o");
> @@ -8142,6 +8160,7 @@ void CrossWindows::Assemble::ConstructJo
> const InputInfoList &Inputs,
> const ArgList &Args,
> const char *LinkingOutput)
> const {
> + claimNoWarnArgs(Args);
> const auto &TC =
> static_cast<const toolchains::CrossWindowsToolChain
> &>(getToolChain());
> ArgStringList CmdArgs;
>
> Modified: cfe/trunk/test/Driver/clang-s-opts.s
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-s-
> opts.s?rev=225100&r1=225099&r2=225100&view=diff
> ==========================================================================
> ====
> --- cfe/trunk/test/Driver/clang-s-opts.s (original)
> +++ cfe/trunk/test/Driver/clang-s-opts.s Fri Jan 2 18:06:04 2015
> @@ -1,3 +1,4 @@
> // RUN: %clang -### -c -Werror -flto -fno-lto %s 2>&1 | FileCheck %s
> +// RUN: %clang -### -c -Werror -flto -fno-lto -fno-integrated-as %s 2>&1
> | FileCheck %s
>
> // CHECK-NOT: argument unused during compilation
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list