[lld] r274723 - Do not call warning() from ELFOptTable::parse().

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 06:23:05 PDT 2016


thanks. It is a nice cleanup anyway, the code calling warning + error
was probably a leftover from the days error was fatal.

Cheers,
Rafael


On 6 July 2016 at 21:58, Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> Author: ruiu
> Date: Wed Jul  6 20:58:04 2016
> New Revision: 274723
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274723&view=rev
> Log:
> Do not call warning() from ELFOptTable::parse().
>
> warning() depends on Config->FatalWarnings, so we don't want to call
> that function before we initialize that member.
>
> Modified:
>     lld/trunk/ELF/Config.h
>     lld/trunk/ELF/DriverUtils.cpp
>     lld/trunk/test/ELF/driver.test
>
> Modified: lld/trunk/ELF/Config.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=274723&r1=274722&r2=274723&view=diff
> ==============================================================================
> --- lld/trunk/ELF/Config.h (original)
> +++ lld/trunk/ELF/Config.h Wed Jul  6 20:58:04 2016
> @@ -81,7 +81,7 @@ struct Configuration {
>    bool EhFrameHdr;
>    bool EnableNewDtags;
>    bool ExportDynamic;
> -  bool FatalWarnings = false;
> +  bool FatalWarnings;
>    bool GcSections;
>    bool GnuHash = false;
>    bool ICF;
>
> Modified: lld/trunk/ELF/DriverUtils.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DriverUtils.cpp?rev=274723&r1=274722&r2=274723&view=diff
> ==============================================================================
> --- lld/trunk/ELF/DriverUtils.cpp (original)
> +++ lld/trunk/ELF/DriverUtils.cpp Wed Jul  6 20:58:04 2016
> @@ -87,11 +87,8 @@ opt::InputArgList ELFOptTable::parse(Arr
>            "\", expected " + Twine(MissingCount) +
>            (MissingCount == 1 ? " argument.\n" : " arguments"));
>
> -  iterator_range<opt::arg_iterator> Unknowns = Args.filtered(OPT_UNKNOWN);
> -  for (auto *Arg : Unknowns)
> -    warning("warning: unknown argument: " + Arg->getSpelling());
> -  if (Unknowns.begin() != Unknowns.end())
> -    error("unknown argument(s) found");
> +  for (auto *Arg : Args.filtered(OPT_UNKNOWN))
> +    error("unknown argument: " + Arg->getSpelling());
>    return Args;
>  }
>
>
> Modified: lld/trunk/test/ELF/driver.test
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/driver.test?rev=274723&r1=274722&r2=274723&view=diff
> ==============================================================================
> --- lld/trunk/test/ELF/driver.test (original)
> +++ lld/trunk/test/ELF/driver.test Wed Jul  6 20:58:04 2016
> @@ -3,9 +3,8 @@
>  # RUN: not ld.lld --unknown1 --unknown2 -m foo /no/such/file -lnosuchlib \
>  # RUN:   2>&1 | FileCheck -check-prefix=UNKNOWN %s
>
> -# UNKNOWN: warning: unknown argument: --unknown1
> -# UNKNOWN: warning: unknown argument: --unknown2
> -# UNKNOWN: unknown argument(s) found
> +# UNKNOWN: unknown argument: --unknown1
> +# UNKNOWN: unknown argument: --unknown2
>  # UNKNOWN: unknown emulation: foo
>  # UNKNOWN: cannot open /no/such/file
>  # UNKNOWN: unable to find library -lnosuchlib
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list