[lld] r248524 - [ELF2] Output of all unknown arguments instead of only one.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 11:55:33 PDT 2015


Author: ruiu
Date: Thu Sep 24 13:55:33 2015
New Revision: 248524

URL: http://llvm.org/viewvc/llvm-project?rev=248524&view=rev
Log:
[ELF2] Output of all unknown arguments instead of only one.

Patch from George Rimar!

Modified:
    lld/trunk/ELF/DriverUtils.cpp
    lld/trunk/ELF/Error.cpp
    lld/trunk/ELF/Error.h

Modified: lld/trunk/ELF/DriverUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/DriverUtils.cpp?rev=248524&r1=248523&r2=248524&view=diff
==============================================================================
--- lld/trunk/ELF/DriverUtils.cpp (original)
+++ lld/trunk/ELF/DriverUtils.cpp Thu Sep 24 13:55:33 2015
@@ -58,7 +58,12 @@ opt::InputArgList ArgParser::parse(Array
     error(Twine("missing arg value for \"") + Args.getArgString(MissingIndex) +
           "\", expected " + Twine(MissingCount) +
           (MissingCount == 1 ? " argument.\n" : " arguments"));
-  for (auto *Arg : Args.filtered(OPT_UNKNOWN))
-    error(Twine("unknown argument: ") + Arg->getSpelling());
+
+  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");
+
   return Args;
 }

Modified: lld/trunk/ELF/Error.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Error.cpp?rev=248524&r1=248523&r2=248524&view=diff
==============================================================================
--- lld/trunk/ELF/Error.cpp (original)
+++ lld/trunk/ELF/Error.cpp Thu Sep 24 13:55:33 2015
@@ -15,6 +15,8 @@
 namespace lld {
 namespace elf2 {
 
+void warning(const Twine &Msg) { llvm::errs() << Msg << "\n"; }
+
 void error(const Twine &Msg) {
   llvm::errs() << Msg << "\n";
   exit(1);

Modified: lld/trunk/ELF/Error.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Error.h?rev=248524&r1=248523&r2=248524&view=diff
==============================================================================
--- lld/trunk/ELF/Error.h (original)
+++ lld/trunk/ELF/Error.h Thu Sep 24 13:55:33 2015
@@ -15,6 +15,8 @@
 namespace lld {
 namespace elf2 {
 
+void warning(const Twine &Msg);
+
 LLVM_ATTRIBUTE_NORETURN void error(const Twine &Msg);
 void error(std::error_code EC, const Twine &Prefix);
 void error(std::error_code EC);




More information about the llvm-commits mailing list