mirror of
https://github.com/golang/go
synced 2024-09-05 07:54:46 +00:00
use errchk in more places.
let errchk exit 0 even if it has reported a BUG. it echoed BUG and that's all that matters. R=r DELTA=143 (1 added, 89 deleted, 53 changed) OCL=32533 CL=32542
This commit is contained in:
parent
36ca5fde68
commit
34b277f046
15
test/errchk
15
test/errchk
|
@ -28,19 +28,18 @@ TMPOUT=/tmp/errchk-out-$$
|
||||||
TMPERR=/tmp/errchk-err-$$
|
TMPERR=/tmp/errchk-err-$$
|
||||||
TMPALL=/tmp/errchk-all-$$
|
TMPALL=/tmp/errchk-all-$$
|
||||||
TMPTMP=/tmp/errchk-tmp-$$
|
TMPTMP=/tmp/errchk-tmp-$$
|
||||||
TMPSTAT=/tmp/errchk-stat-$$
|
|
||||||
TMPBUG=/tmp/errchk-bug-$$
|
TMPBUG=/tmp/errchk-bug-$$
|
||||||
|
|
||||||
rm -f $TMPOUT $TMPERR $TMPALL $TMPTMP $TMPSTAT $TMPBUG
|
rm -f $TMPOUT $TMPERR $TMPALL $TMPTMP $TMPBUG
|
||||||
|
|
||||||
trap "rm -f $TMPOUT $TMPERR $TMPALL $TMPTMP $TMPSTAT $TMPBUG" 0 1 2 3 14 15
|
trap "rm -f $TMPOUT $TMPERR $TMPALL $TMPTMP $TMPBUG" 0 1 2 3 14 15
|
||||||
|
|
||||||
if $* >$TMPOUT 2>$TMPERR; then
|
if $* >$TMPOUT 2>$TMPERR; then
|
||||||
echo 1>&2 "BUG: errchk: command succeeded unexpectedly"
|
echo 1>&2 "BUG: errchk: command succeeded unexpectedly"
|
||||||
cat $TMPOUT
|
cat $TMPOUT
|
||||||
cat 1>&2 $TMPERR
|
cat 1>&2 $TMPERR
|
||||||
rm -f $TMPOUT $TMPERR
|
rm -f $TMPOUT $TMPERR
|
||||||
exit 1
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat $TMPOUT $TMPERR | grep -v '^ ' > $TMPALL
|
cat $TMPOUT $TMPERR | grep -v '^ ' > $TMPALL
|
||||||
|
@ -54,7 +53,6 @@ bug() {
|
||||||
}
|
}
|
||||||
|
|
||||||
header=0
|
header=0
|
||||||
echo 0 > $TMPSTAT
|
|
||||||
pr -n -t $SOURCEFILE | grep '// ERROR' | while read line; do
|
pr -n -t $SOURCEFILE | grep '// ERROR' | while read line; do
|
||||||
lineno=`echo $line | sed -e 's/^[ ]*\([0-9]*\).*$/\1/'`
|
lineno=`echo $line | sed -e 's/^[ ]*\([0-9]*\).*$/\1/'`
|
||||||
regexp=`echo $line | sed -e 's|.*// ERROR "\([^"]*\)".*$|\1|'`
|
regexp=`echo $line | sed -e 's|.*// ERROR "\([^"]*\)".*$|\1|'`
|
||||||
|
@ -64,12 +62,10 @@ pr -n -t $SOURCEFILE | grep '// ERROR' | while read line; do
|
||||||
if test -z "$errmsg"; then
|
if test -z "$errmsg"; then
|
||||||
bug
|
bug
|
||||||
echo 1>&2 "errchk: $SOURCEFILE:$lineno: missing expected error: '$regexp'"
|
echo 1>&2 "errchk: $SOURCEFILE:$lineno: missing expected error: '$regexp'"
|
||||||
echo 1 > $TMPSTAT
|
|
||||||
elif ! echo "$errmsg" | egrep -q "$regexp"; then
|
elif ! echo "$errmsg" | egrep -q "$regexp"; then
|
||||||
bug
|
bug
|
||||||
echo 1>&2 "errchk: $SOURCEFILE:$lineno: error message does not match '$regexp'"
|
echo 1>&2 "errchk: $SOURCEFILE:$lineno: error message does not match '$regexp'"
|
||||||
echo 1>&2 $errmsg
|
echo 1>&2 $errmsg
|
||||||
echo 1 > $TMPSTAT
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -79,9 +75,6 @@ if test -s $TMPALL; then
|
||||||
echo 1>&2 "=================================================="
|
echo 1>&2 "=================================================="
|
||||||
cat 1>&2 $TMPALL
|
cat 1>&2 $TMPALL
|
||||||
echo 1>&2 "=================================================="
|
echo 1>&2 "=================================================="
|
||||||
echo 1 > $TMPSTAT
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status=`cat $TMPSTAT`
|
exit 0
|
||||||
|
|
||||||
exit $status
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
func f9(a int) (i int, f float) {
|
func f9(a int) (i int, f float) {
|
||||||
i := 9; // BUG redeclaration
|
i := 9; // ERROR "redecl"
|
||||||
f := float(9); // BUG redeclaration
|
f := float(9); // ERROR "redecl"
|
||||||
return i, f;
|
return i, f;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
s := vlong(0); // BUG no vlong specified in the language
|
s := vlong(0); // ERROR "undef"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
func main (x int) {
|
func main (x int) {
|
||||||
var x int; // BUG redeclaration error
|
var x int; // ERROR "redecl"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
func atom(s string) {
|
func atom(s string) {
|
||||||
if s == nil {
|
if s == nil { // ERROR "nil"
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
func main() {
|
func main() { // ERROR "package"
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@ func f() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
const n = f(); // should report only one error
|
const n = f(); // ERROR "const"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var s string = nil; // nil should not be assignment compatible with string
|
var s string = nil; // ERROR "illegal|invalid"
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
const c = '\''; // this works
|
const c = '\''; // this works
|
||||||
const s = "\'"; // this doesn't
|
const s = "\'"; // ERROR "invalid|escape"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
There is no reason why the escapes need to be different inside strings and chars.
|
There is no reason why the escapes need to be different inside strings and chars.
|
||||||
|
|
|
@ -7,5 +7,5 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
s := string(bug); // crash
|
s := string(bug); // ERROR "undef"
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,6 @@ package main
|
||||||
func main() {
|
func main() {
|
||||||
var s int = 0;
|
var s int = 0;
|
||||||
var x int = 0;
|
var x int = 0;
|
||||||
x = x << s; // should complain that s is not a uint
|
x = x << s; // ERROR "illegal|inval|shift"
|
||||||
x = x >> s; // should complain that s is not a uint
|
x = x >> s; // ERROR "illegal|inval|shift"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
x := string{'a', 'b', '\n'};
|
x := string{'a', 'b', '\n'}; // ERROR "composite"
|
||||||
print(x);
|
print(x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,5 @@ import "./bug0"
|
||||||
// visible here in package bug1. The test for failure is in
|
// visible here in package bug1. The test for failure is in
|
||||||
// ../bug083.go.
|
// ../bug083.go.
|
||||||
|
|
||||||
var v1 bug0.t0
|
var v1 bug0.t0; // ERROR "bug0"
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
func f() int {
|
func f() int { // ERROR "return"
|
||||||
if false {
|
if false {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,7 @@ func f2() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func f3() {
|
func f3() {
|
||||||
i := c; // BUG: compiles but should not. constant is not in scope in this function
|
i := c; // ERROR "undef"
|
||||||
goto exit; // BUG: compiles but should not. label is not in this function
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -9,6 +9,6 @@ package main
|
||||||
func f() /* no return type */ {}
|
func f() /* no return type */ {}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
x := f(); // should not compile
|
x := f(); // ERROR "mismatch"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,5 +8,5 @@ package main
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
const a uint64 = 10;
|
const a uint64 = 10;
|
||||||
var b int64 = a;
|
var b int64 = a; // ERROR "convert"
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@ type T2 struct { t bug0.T }
|
||||||
func fn(p *T2) int {
|
func fn(p *T2) int {
|
||||||
// This reference should be invalid, because bug0.T.i is local
|
// This reference should be invalid, because bug0.T.i is local
|
||||||
// to package bug0 and should not be visible in package bug1.
|
// to package bug0 and should not be visible in package bug1.
|
||||||
return p.t.i
|
return p.t.i; // ERROR "field|undef"
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,5 +10,5 @@ func main() {
|
||||||
type Slice []byte;
|
type Slice []byte;
|
||||||
a := [...]byte{ 0 };
|
a := [...]byte{ 0 };
|
||||||
b := Slice(&a); // This should be OK.
|
b := Slice(&a); // This should be OK.
|
||||||
c := Slice(a); // ERROR "invalid"
|
c := Slice(a); // ERROR "invalid|illegal"
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,91 +111,21 @@ hi
|
||||||
3 11
|
3 11
|
||||||
4 0
|
4 0
|
||||||
|
|
||||||
=========== fixedbugs/bug035.go
|
|
||||||
fixedbugs/bug035.go:6: variable i redeclared in this block
|
|
||||||
previous declaration at fixedbugs/bug035.go:5
|
|
||||||
fixedbugs/bug035.go:7: variable f redeclared in this block
|
|
||||||
previous declaration at fixedbugs/bug035.go:5
|
|
||||||
|
|
||||||
=========== fixedbugs/bug037.go
|
|
||||||
fixedbugs/bug037.go:6: undefined: vlong
|
|
||||||
fixedbugs/bug037.go:6: undefined: s
|
|
||||||
|
|
||||||
=========== fixedbugs/bug039.go
|
|
||||||
fixedbugs/bug039.go:6: variable x redeclared in this block
|
|
||||||
previous declaration at fixedbugs/bug039.go:5
|
|
||||||
|
|
||||||
=========== fixedbugs/bug049.go
|
|
||||||
fixedbugs/bug049.go:6: invalid operation: s == nil
|
|
||||||
fixedbugs/bug049.go:6: illegal types for operand: EQ
|
|
||||||
string
|
|
||||||
nil
|
|
||||||
|
|
||||||
=========== fixedbugs/bug050.go
|
|
||||||
fixedbugs/bug050.go:3: package statement must be first
|
|
||||||
|
|
||||||
=========== fixedbugs/bug051.go
|
|
||||||
fixedbugs/bug051.go:10: const initializer must be constant
|
|
||||||
|
|
||||||
=========== fixedbugs/bug062.go
|
|
||||||
fixedbugs/bug062.go:6: illegal types for operand: AS
|
|
||||||
string
|
|
||||||
nil
|
|
||||||
|
|
||||||
=========== fixedbugs/bug067.go
|
=========== fixedbugs/bug067.go
|
||||||
ok
|
ok
|
||||||
|
|
||||||
=========== fixedbugs/bug068.go
|
|
||||||
fixedbugs/bug068.go:8: unknown escape sequence: '
|
|
||||||
|
|
||||||
=========== fixedbugs/bug070.go
|
=========== fixedbugs/bug070.go
|
||||||
outer loop top k 0
|
outer loop top k 0
|
||||||
inner loop top i 0
|
inner loop top i 0
|
||||||
do break
|
do break
|
||||||
broke
|
broke
|
||||||
|
|
||||||
=========== fixedbugs/bug072.go
|
|
||||||
fixedbugs/bug072.go:6: undefined: bug
|
|
||||||
|
|
||||||
=========== fixedbugs/bug073.go
|
|
||||||
fixedbugs/bug073.go:8: illegal types for operand: LSH
|
|
||||||
int
|
|
||||||
int
|
|
||||||
fixedbugs/bug073.go:8: illegal types for operand: AS
|
|
||||||
int
|
|
||||||
fixedbugs/bug073.go:9: illegal types for operand: RSH
|
|
||||||
int
|
|
||||||
int
|
|
||||||
fixedbugs/bug073.go:9: illegal types for operand: AS
|
|
||||||
int
|
|
||||||
|
|
||||||
=========== fixedbugs/bug074.go
|
|
||||||
fixedbugs/bug074.go:6: invalid type for composite literal: string
|
|
||||||
fixedbugs/bug074.go:6: invalid type for composite literal: string
|
|
||||||
|
|
||||||
=========== fixedbugs/bug081.go
|
=========== fixedbugs/bug081.go
|
||||||
fixedbugs/bug081.go:5: fatal error: loop
|
fixedbugs/bug081.go:5: fatal error: loop
|
||||||
|
|
||||||
=========== fixedbugs/bug083.go
|
|
||||||
fixedbugs/bug083.dir/bug1.go:9: cannot refer to bug0.t0
|
|
||||||
|
|
||||||
=========== fixedbugs/bug086.go
|
|
||||||
fixedbugs/bug086.go:5: function ends without a return statement
|
|
||||||
|
|
||||||
=========== fixedbugs/bug091.go
|
|
||||||
fixedbugs/bug091.go:15: undefined: c
|
|
||||||
fixedbugs/bug091.go:15: illegal types for operand: AS
|
|
||||||
undefined
|
|
||||||
|
|
||||||
=========== fixedbugs/bug093.go
|
=========== fixedbugs/bug093.go
|
||||||
M
|
M
|
||||||
|
|
||||||
=========== fixedbugs/bug103.go
|
|
||||||
fixedbugs/bug103.go:8: assignment count mismatch: 1 = 0
|
|
||||||
fixedbugs/bug103.go:8: function requires a return type
|
|
||||||
fixedbugs/bug103.go:8: illegal types for operand: AS
|
|
||||||
int
|
|
||||||
|
|
||||||
=========== fixedbugs/bug113.go
|
=========== fixedbugs/bug113.go
|
||||||
interface is int, not int32
|
interface is int, not int32
|
||||||
throw: interface conversion
|
throw: interface conversion
|
||||||
|
@ -209,17 +139,6 @@ fixedbugs/bug121.go:20: illegal types for operand: AS
|
||||||
I
|
I
|
||||||
*S
|
*S
|
||||||
|
|
||||||
=========== fixedbugs/bug131.go
|
|
||||||
fixedbugs/bug131.go:7: cannot convert uint64 constant to int64
|
|
||||||
fixedbugs/bug131.go:7: illegal types for operand: AS
|
|
||||||
int64
|
|
||||||
uint64
|
|
||||||
|
|
||||||
=========== fixedbugs/bug133.go
|
|
||||||
fixedbugs/bug133.dir/bug2.go:11: undefined: bug0.T field i
|
|
||||||
fixedbugs/bug133.dir/bug2.go:11: illegal types for operand: RETURN
|
|
||||||
int
|
|
||||||
|
|
||||||
=========== fixedbugs/bug148.go
|
=========== fixedbugs/bug148.go
|
||||||
2 3
|
2 3
|
||||||
interface is main.T, not main.T·bug148·1
|
interface is main.T, not main.T·bug148·1
|
||||||
|
|
Loading…
Reference in a new issue