[PATCH] D66475: [llvm-objcopy] Append '\n' to warning messages

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 07:42:36 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: abrachet, alexshap, grimar, jhenderson, rupprecht.
Herald added subscribers: llvm-commits, seiya, jakehehrlich, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

Currently the warning message of `llvm-strip %t.o %t.o` does not include
the trailing newline. Fix this by appending a '\n'.

This is the only warning llvm-objcopy and llvm-strip can issue.


Repository:
  rL LLVM

https://reviews.llvm.org/D66475

Files:
  test/tools/llvm-objcopy/ELF/same-file-strip.test
  tools/llvm-objcopy/llvm-objcopy.cpp


Index: tools/llvm-objcopy/llvm-objcopy.cpp
===================================================================
--- tools/llvm-objcopy/llvm-objcopy.cpp
+++ tools/llvm-objcopy/llvm-objcopy.cpp
@@ -84,7 +84,7 @@
 
 ErrorSuccess reportWarning(Error E) {
   assert(E);
-  WithColor::warning(errs(), ToolName) << toString(std::move(E));
+  WithColor::warning(errs(), ToolName) << toString(std::move(E)) << '\n';
   return Error::success();
 }
 
Index: test/tools/llvm-objcopy/ELF/same-file-strip.test
===================================================================
--- test/tools/llvm-objcopy/ELF/same-file-strip.test
+++ test/tools/llvm-objcopy/ELF/same-file-strip.test
@@ -9,10 +9,11 @@
 
 # ERR: error: cannot specify '-' as an input file more than once
 
-# RUN: llvm-strip %t %t 2>&1 | FileCheck -check-prefix=WARN %s -DFILE=%t
-# RUN: llvm-strip %t %t %t 2>&1 | FileCheck -check-prefix=WARN %s -DFILE=%t
+# RUN: cp %t %t2
+# RUN: llvm-strip %t %t %t %t2 %t2 2>&1 | FileCheck -check-prefix=WARN %s -DFILE=%t -DFILE2=%t2
 
-# WARN: warning: '[[FILE]]' was already specified
+# WARN:      warning: '[[FILE]]' was already specified
+# WARN-NEXT: warning: '[[FILE2]]' was already specified
 
 --- !ELF
 FileHeader:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66475.216145.patch
Type: text/x-patch
Size: 1214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190820/75890326/attachment.bin>


More information about the llvm-commits mailing list