[PATCH] D121159: llvm-nm should flush and error check output

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 7 13:50:13 PST 2022


davide created this revision.
davide added reviewers: ab, t.p.northover, pete.
Herald added a subscriber: rupprecht.
Herald added a reviewer: jhenderson.
Herald added a project: All.
davide requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

Recent additions to the UNIX03 conformance suite have started checking that utilities properly handle output errors by closing stdout on the program and checking for an error message + exit. llvm-nm needs to explicitly flush stdout prior to a successful exit and error-check the stream.

rdar://89760992


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121159

Files:
  llvm/tools/llvm-nm/llvm-nm.cpp


Index: llvm/tools/llvm-nm/llvm-nm.cpp
===================================================================
--- llvm/tools/llvm-nm/llvm-nm.cpp
+++ llvm/tools/llvm-nm/llvm-nm.cpp
@@ -2420,6 +2420,10 @@
     printExportSymbolList();
   }
 
+  // Needed for UNIX03 conformance.
+  outs.flush();
+
   if (HadError)
     return 1;
+  return 0;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121159.413622.patch
Type: text/x-patch
Size: 340 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220307/f09d81fb/attachment.bin>


More information about the llvm-commits mailing list