[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 22:03:37 PST 2022


davide added a comment.

In D121159#3366196 <https://reviews.llvm.org/D121159#3366196>, @jhenderson wrote:

> The pre-merge check is  failing to build this patch.
>
> There are loads of LLVM tools that print to stdout. This "fixes" just one of them. If there is an issue, it's in all the tools, so needs patching somewhere else. I'm also not convinced it should be needed:

I think this is for UNIX03 compliance. Not all the tools have to be compliant.

> 1. `returm 0` is implicit at the end of main (see the accepted answer to this question: https://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c).

Sure, I can remove it.

> 2. stdout is flushed on exit automatically: https://stackoverflow.com/questions/15911517/is-there-a-guarantee-of-stdout-auto-flush-before-exit-how-does-it-work

If stdout is flushed before exit, that's fine. What about `stderr` ?

> How does explicit flushing help us with output errors. More importantly, why do we care?

We care for POSIX compliance. Apple can keep this patch downstream, but I don't see the harm of having this one here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121159



More information about the llvm-commits mailing list