]> Cypherpunks repositories - gostls13.git/commitdiff
use errchk in more places.
authorRuss Cox <rsc@golang.org>
Thu, 30 Jul 2009 23:46:14 +0000 (16:46 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 30 Jul 2009 23:46:14 +0000 (16:46 -0700)
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

20 files changed:
test/errchk
test/fixedbugs/bug035.go
test/fixedbugs/bug037.go
test/fixedbugs/bug039.go
test/fixedbugs/bug049.go
test/fixedbugs/bug050.go
test/fixedbugs/bug051.go
test/fixedbugs/bug062.go
test/fixedbugs/bug068.go
test/fixedbugs/bug072.go
test/fixedbugs/bug073.go
test/fixedbugs/bug074.go
test/fixedbugs/bug083.dir/bug1.go
test/fixedbugs/bug086.go
test/fixedbugs/bug091.go
test/fixedbugs/bug103.go
test/fixedbugs/bug131.go
test/fixedbugs/bug133.dir/bug2.go
test/fixedbugs/bug146.go
test/golden.out

index 31e548aa55d5804fff2216e6586a4c46c4a89fa4..00694c256f76ec7715a681e45dd31026a1bc9506 100755 (executable)
@@ -28,19 +28,18 @@ TMPOUT=/tmp/errchk-out-$$
 TMPERR=/tmp/errchk-err-$$
 TMPALL=/tmp/errchk-all-$$
 TMPTMP=/tmp/errchk-tmp-$$
-TMPSTAT=/tmp/errchk-stat-$$
 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
   echo 1>&2 "BUG: errchk: command succeeded unexpectedly"
   cat $TMPOUT
   cat 1>&2 $TMPERR
   rm -f $TMPOUT $TMPERR
-  exit 1
+  exit 0
 fi
 
 cat $TMPOUT $TMPERR | grep -v '^       ' > $TMPALL
@@ -54,7 +53,6 @@ bug() {
 }
 
 header=0
-echo 0 > $TMPSTAT
 pr -n -t $SOURCEFILE | grep '// ERROR' | while read line; do
   lineno=`echo $line | sed -e 's/^[ ]*\([0-9]*\).*$/\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
     bug
     echo 1>&2 "errchk: $SOURCEFILE:$lineno: missing expected error: '$regexp'"
-    echo 1 > $TMPSTAT
   elif ! echo "$errmsg" | egrep -q "$regexp"; then
     bug
     echo 1>&2 "errchk: $SOURCEFILE:$lineno: error message does not match '$regexp'"
     echo 1>&2 $errmsg
-    echo 1 > $TMPSTAT
   fi
 done
 
@@ -79,9 +75,6 @@ if test -s $TMPALL; then
   echo 1>&2 "=================================================="
   cat 1>&2 $TMPALL
   echo 1>&2 "=================================================="
-  echo 1 > $TMPSTAT
 fi
 
-status=`cat $TMPSTAT`
-
-exit $status
+exit 0
index 5e93a8d89b09ff4a6c23840dfdc39aed9ab8add7..3c31fa553d20aaa1310de66f57bdd6a74bbe8174 100644 (file)
@@ -7,7 +7,7 @@
 package main
 
 func f9(a int) (i int, f float) {
-       i := 9;  // BUG redeclaration
-       f := float(9);  // BUG redeclaration
+       i := 9;  // ERROR "redecl"
+       f := float(9);  // ERROR "redecl"
        return i, f;
 }
index b0345ccf15509f430e0f11d176ea2ae88988238b..ff7d28710a111d483db41a2604e5e743a35e6ffa 100644 (file)
@@ -7,5 +7,5 @@
 package main
 
 func main() {
-       s := vlong(0);  // BUG no vlong specified in the language
+       s := vlong(0);  // ERROR "undef"
 }
index a87e9865103b40fe781c24feee8fb500192d7305..712e843326a05234723a1c46db039eea21359208 100644 (file)
@@ -7,5 +7,5 @@
 package main
 
 func main (x int) {
-  var x int;  // BUG redeclaration error
+  var x int;  // ERROR "redecl"
 }
index 72ac7ecbd8fdc74e9de631dd746e9c7e49a46739..13527e872276b044c5646705af1cc695e21ef7a2 100644 (file)
@@ -7,7 +7,7 @@
 package main
 
 func atom(s string) {
-       if s == nil {
+       if s == nil {   // ERROR "nil"
                return;
        }
 }
index afc545588e54d16bb17ef7975f12ee63f43515eb..585c44623723439e405f56c824dd1b8e88d3c93a 100644 (file)
@@ -4,5 +4,5 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-func main() {
+func main() {  // ERROR "package"
 }
index c5b960602bbc7e950df7daba068abd5f18c522f8..199a4b95c1233fa25103053ba1777fdd5d5dad4a 100644 (file)
@@ -11,5 +11,5 @@ func f() int {
 }
 
 func main() {
-  const n = f();  // should report only one error
+  const n = f();  // ERROR "const"
 }
index 65d676fc44a0a5824cd216e2f2993f6f9f6e61b4..8a9ba959ec906d1d9961e2b01285eadd9847568f 100644 (file)
@@ -7,5 +7,5 @@
 package main
 
 func main() {
-  var s string = nil;  // nil should not be assignment compatible with string
+  var s string = nil;  // ERROR "illegal|invalid"
 }
index f1dcce379f12b41083f9084bc78a362004757320..a7cf4239c43ea0d2f57e7c53b85953e1623e3057 100644 (file)
@@ -9,7 +9,7 @@
 package main
 
 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.
index f711790570792e4deae0d6ade0c6ba85cf51aeca..efe5626db591de4c054a64b79440633be575ef4e 100644 (file)
@@ -7,5 +7,5 @@
 package main
 
 func main() {
-       s := string(bug);  // crash
+       s := string(bug);  // ERROR "undef"
 }
index e7a084306e5b9515f6b499b6f11b4e0cf1d7f364..99e7cd19ee41f4a368eda2bb14a964cce583b924 100644 (file)
@@ -9,6 +9,6 @@ package main
 func main() {
        var s int = 0;
        var x int = 0;
-       x = x << s;  // should complain that s is not a uint
-       x = x >> s;  // should complain that s is not a uint
+       x = x << s;  // ERROR "illegal|inval|shift"
+       x = x >> s;  // ERROR "illegal|inval|shift"
 }
index d9865c579c2a0ba6518afc8efa874bd48b6a3d1b..7b6d14e7e63429957d5eb69c004eccdacc0aa28f 100644 (file)
@@ -7,6 +7,6 @@
 package main
 
 func main() {
-       x := string{'a', 'b', '\n'};
+       x := string{'a', 'b', '\n'};    // ERROR "composite"
        print(x);
 }
index a48edbe33074852491733582ade20f1d55948e11..486fe760734e1f910fff048f020c0b6de9c7f0a1 100644 (file)
@@ -10,4 +10,5 @@ import "./bug0"
 // visible here in package bug1.  The test for failure is in
 // ../bug083.go.
 
-var v1 bug0.t0
+var v1 bug0.t0;        // ERROR "bug0"
+
index ef50c0c5948cc3f7e6c288fef52f2456151840e1..7d85063f1bd1fd6438ace6b5fe55891c8afc1c68 100644 (file)
@@ -6,7 +6,7 @@
 
 package main
 
-func f() int {
+func f() int { // ERROR "return"
        if false {
                return 0;
        }
index 82391ead041db88147861473fb568c0dffae29f2..cfbb09cd820b1c747d1b977e316bddc86e451bc8 100644 (file)
@@ -16,8 +16,7 @@ func f2() {
 }
 
 func f3() {
-       i := c; // BUG: compiles but should not. constant is not in scope in this function
-       goto exit;      // BUG: compiles but should not. label is not in this function
+       i := c; // ERROR "undef"
 }
 
 func main() {
index c350a53bb01e9513fe21012f18c9fbd53e1def27..6ac4e9a14fc6803031532200078d4639b2924093 100644 (file)
@@ -9,6 +9,6 @@ package main
 func f() /* no return type */ {}
 
 func main() {
-       x := f();  // should not compile
+       x := f();  // ERROR "mismatch"
 }
 
index 96e7cc7647230dbc10094d3eee0da57e1448a0d5..376f528f657d0d7f659317c5df87c58973508db1 100644 (file)
@@ -8,5 +8,5 @@ package main
 
 func main() {
   const a uint64 = 10;
-  var b int64 = a;
+  var b int64 = a;     // ERROR "convert"
 }
index 2b2b50b7f3b3b2e90a694a7296ab7eea33a6e695..0b8393c9341108d4e3ddbadea19a0099bd6f6c89 100644 (file)
@@ -12,5 +12,5 @@ type T2 struct { t bug0.T }
 func fn(p *T2) int {
        // This reference should be invalid, because bug0.T.i is local
        // to package bug0 and should not be visible in package bug1.
-       return p.t.i
+       return p.t.i;   // ERROR "field|undef"
 }
index 3095d2691b45b30da49f91482bc88a5652494dde..aef8476453161cae75a20d23922d8612fff21f96 100644 (file)
@@ -10,5 +10,5 @@ func main() {
        type Slice []byte;
        a := [...]byte{ 0 };
        b := Slice(&a);         // This should be OK.
-       c := Slice(a);          // ERROR "invalid"
+       c := Slice(a);          // ERROR "invalid|illegal"
 }
index a528fa8186d24ccd4d6d0d3618162ce078009e06..ca01bd2a660e658daf20d57caa09f60841d5a874 100644 (file)
@@ -111,91 +111,21 @@ hi
 3 11
 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
 ok
 
-=========== fixedbugs/bug068.go
-fixedbugs/bug068.go:8: unknown escape sequence: '
-
 =========== fixedbugs/bug070.go
 outer loop top k 0
 inner loop top i 0
 do break
 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: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
 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
 interface is int, not int32
 throw: interface conversion
@@ -209,17 +139,6 @@ fixedbugs/bug121.go:20: illegal types for operand: AS
        I
        *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
 2 3
 interface is main.T, not main.T·bug148·1