[PATCH] D68164: [Commandline] Clear error on raw_ostream when there is parsing error.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 30 22:28:55 PDT 2019


MaskRay requested changes to this revision.
MaskRay added a comment.
This revision now requires changes to proceed.

> The exit is called twice and somehow the test exit cleanly.

The current behavior is undefined. POSIX says "If exit() is called more than once, the behavior is undefined."  Changing exit to abort in D67847 <https://reviews.llvm.org/D67847> will fix the issue. Thanks.

The test `; RUN: sh -c 'opt --reject-this-option 2>&-; echo $?; opt -o /dev/null /dev/null 2>&-; echo $?;'` is testing an undefined behavior, but I can see `2>&-` is a simple alternative to a full-fledged test that makes write operations fail with some other errno. My feeling is that you can just update close-stderr.ll to (`not --crash opt --reject-this-option 2>&1`) in D67847 <https://reviews.llvm.org/D67847> and be prepared to update it if build bots on some platforms have different behaviors.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68164





More information about the llvm-commits mailing list