Commit 16cdba85 authored by Russ Cox's avatar Russ Cox

errchk: add -0 flag

R=lvd
CC=golang-dev
https://golang.org/cl/4837049
parent 11e254e6
...@@ -17,6 +17,13 @@ ...@@ -17,6 +17,13 @@
use POSIX; use POSIX;
my $exitcode = 1;
if(@ARGV >= 1 && $ARGV[0] eq "-0") {
$exitcode = 0;
shift;
}
if(@ARGV < 1) { if(@ARGV < 1) {
print STDERR "Usage: errchk COMPILER [OPTS] SOURCEFILES\n"; print STDERR "Usage: errchk COMPILER [OPTS] SOURCEFILES\n";
exit 1; exit 1;
...@@ -47,12 +54,18 @@ $out = join('', <CMD>); ...@@ -47,12 +54,18 @@ $out = join('', <CMD>);
close CMD; close CMD;
if($? == 0) { if($exitcode != 0 && $? == 0) {
print STDERR "BUG: errchk: command succeeded unexpectedly\n"; print STDERR "BUG: errchk: command succeeded unexpectedly\n";
print STDERR @out; print STDERR @out;
exit 0; exit 0;
} }
if($exitcode == 0 && $? != 0) {
print STDERR "BUG: errchk: command failed unexpectedly\n";
print STDERR @out;
exit 0;
}
if(!WIFEXITED($?)) { if(!WIFEXITED($?)) {
print STDERR "BUG: errchk: compiler crashed\n"; print STDERR "BUG: errchk: compiler crashed\n";
print STDERR @out, "\n"; print STDERR @out, "\n";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment