[PATCH] D141019: Support/CommandLine: replace argument mapping error with a warning

Manuel Ullmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 22:17:49 PST 2023


labre updated this revision to Diff 487048.
labre added a comment.

Patch seemed to not apply anymore against 16.x. Fixed that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141019/new/

https://reviews.llvm.org/D141019

Files:
  llvm/lib/Support/CommandLine.cpp


Index: llvm/lib/Support/CommandLine.cpp
===================================================================
--- llvm/lib/Support/CommandLine.cpp
+++ llvm/lib/Support/CommandLine.cpp
@@ -40,6 +40,7 @@
 #include "llvm/Support/Process.h"
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/VirtualFileSystem.h"
+#include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cstdlib>
 #include <optional>
@@ -214,9 +215,8 @@
 
       // Add argument to the argument map!
       if (!SC->OptionsMap.insert(std::make_pair(O->ArgStr, O)).second) {
-        errs() << ProgramName << ": CommandLine Error: Option '" << O->ArgStr
+        WithColor::warning() << ProgramName << ": CommandLine Error: Option '" << O->ArgStr
                << "' registered more than once!\n";
-        HadErrors = true;
       }
     }
 
@@ -233,10 +233,15 @@
       SC->ConsumeAfterOpt = O;
     }
 
-    // Fail hard if there were errors. These are strictly unrecoverable and
-    // indicate serious issues such as conflicting option names or an
-    // incorrectly
-    // linked LLVM distribution.
+    // Fail hard if there were errors. These are strictly
+    // unrecoverable and indicate serious issues such as conflicting
+    // option names or an incorrectly linked LLVM distribution.
+    //
+    // Argument mapping errors may indicate issues, but also indicate
+    // two libraries linking dynamically to the same libLLVM, which
+    // has valid use cases, e.g. simultaneously using OpenCL and
+    // VAAPI.  Therefore it is only warned about that.
+
     if (HadErrors)
       report_fatal_error("inconsistency in registered CommandLine options");
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141019.487048.patch
Type: text/x-patch
Size: 1677 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230107/950afe2a/attachment.bin>


More information about the llvm-commits mailing list