[PATCH] D21969: [ELF] - Implemented --fatal-warnings option.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 00:21:12 PDT 2016

-void warning(const Twine &Msg) { llvm::errs() << Msg << "\n"; }
+void warning(const Twine &Msg) {
+  if (Config->FatalWarnings)
+    error(Msg);
+  else
+    llvm::errs() << Msg << "\n";

> You don't need `llvm::`.

I need. Also it is consistent with other code in error.cpp


 void error(const Twine &Msg) {
   *ErrorOS << Msg << "\n";
Index: ELF/Driver.cpp
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -344,6 +344,7 @@
   Config->EhFrameHdr = Args.hasArg(OPT_eh_frame_hdr);
   Config->EnableNewDtags = !Args.hasArg(OPT_disable_new_dtags);
   Config->ExportDynamic = Args.hasArg(OPT_export_dynamic);
+  Config->FatalWarnings = Args.hasArg(OPT_fatal_warnings);

> This needs to be done earlier, probably at beginning of LinkerDriver::main. Otherwise, warnings before this line are not going to be handled as fatal errors.

Initially I placed it here for consistency. And I doubt we will need to use warnings untill this option be processed.
Looks the only place of using warning() was the one you removed in r274723 ("Do not call warning() from ELFOptTable::parse()."), that what I workarounded in r274507 as well.
So I guess nothing should be changed here anymore after r274723 ?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160707/38007d1f/attachment.html>

More information about the llvm-commits mailing list