[PATCH] D53997: [gold-plugin] Fix a bunch of build warnings

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 1 14:20:02 PDT 2018


mgrang created this revision.
mgrang added reviewers: tejohnson, chapuni.
mgrang added a comment.

Fixed the following warnings:

  1. gold-plugin.cpp:452:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
    case DS_Warning:
    ^
  gold-plugin.cpp:452:3: note: insert 'LLVM_FALLTHROUGH;' to silence this warning
  
  
  2. gold-plugin.cpp:449:8: warning: variable 'Level' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
    case DS_Error:
         ^~~~~~~~
  gold-plugin.cpp:461:11: note: uninitialized use occurs here
    message(Level, "LLVM gold plugin: %s",  ErrStorage.c_str());
            ^~~~~
  gold-plugin.cpp:447:3: note: variable 'Level' is declared here
    ld_plugin_level Level;


Repository:
  rL LLVM

https://reviews.llvm.org/D53997

Files:
  tools/gold/gold-plugin.cpp


Index: tools/gold/gold-plugin.cpp
===================================================================
--- tools/gold/gold-plugin.cpp
+++ tools/gold/gold-plugin.cpp
@@ -444,11 +444,12 @@
     DiagnosticPrinterRawOStream DP(OS);
     DI.print(DP);
   }
-  ld_plugin_level Level;
+  ld_plugin_level Level = LDPL_FATAL;
   switch (DI.getSeverity()) {
   case DS_Error:
-    message(LDPL_FATAL, "LLVM gold plugin has failed to create LTO module: %s",
+    message(Level, "LLVM gold plugin has failed to create LTO module: %s",
             ErrStorage.c_str());
+    break;
   case DS_Warning:
     Level = LDPL_WARNING;
     break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53997.172232.patch
Type: text/x-patch
Size: 627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181101/9f5410fc/attachment.bin>


More information about the llvm-commits mailing list