Commit b3fb0fdd authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

cmd/internal/gc: fix vet detected printf problems

Fixes #10805.

Change-Id: Ia77639e606a0c18fc53cba9749d92f325014025f
Reviewed-on: https://go-review.googlesource.com/10040Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
parent dbf533a5
...@@ -183,7 +183,7 @@ func declare(n *Node, ctxt uint8) { ...@@ -183,7 +183,7 @@ func declare(n *Node, ctxt uint8) {
} }
if ctxt == PEXTERN && s.Name == "init" { if ctxt == PEXTERN && s.Name == "init" {
Yyerror("cannot declare init - must be func", s) Yyerror("cannot declare init - must be func")
} }
gen := 0 gen := 0
......
...@@ -965,7 +965,7 @@ func cgen_callmeth(n *Node, proc int) { ...@@ -965,7 +965,7 @@ func cgen_callmeth(n *Node, proc int) {
l := n.Left l := n.Left
if l.Op != ODOTMETH { if l.Op != ODOTMETH {
Fatal("cgen_callmeth: not dotmethod: %v") Fatal("cgen_callmeth: not dotmethod: %v", l)
} }
n2 := *n n2 := *n
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
package gc package gc
import ( import (
"fmt"
"strings" "strings"
) )
%} %}
...@@ -1975,9 +1976,9 @@ hidden_import: ...@@ -1975,9 +1976,9 @@ hidden_import:
importlist = list(importlist, $2); importlist = list(importlist, $2);
if Debug['E'] > 0 { if Debug['E'] > 0 {
print("import [%q] func %lN \n", importpkg.Path, $2); fmt.Printf("import [%q] func %v \n", importpkg.Path, $2)
if Debug['m'] > 2 && $2.Func.Inl != nil { if Debug['m'] > 2 && $2.Func.Inl != nil {
print("inl body:%+H\n", $2.Func.Inl); fmt.Printf("inl body:%v\n", $2.Func.Inl)
} }
} }
} }
......
...@@ -1303,7 +1303,7 @@ OpSwitch: ...@@ -1303,7 +1303,7 @@ OpSwitch:
if l.Op == OTYPE { if l.Op == OTYPE {
if n.Isddd || l.Type.Bound == -100 { if n.Isddd || l.Type.Bound == -100 {
if l.Type.Broke == 0 { if l.Type.Broke == 0 {
Yyerror("invalid use of ... in type conversion", l) Yyerror("invalid use of ... in type conversion to %v", l.Type)
} }
n.Diag = 1 n.Diag = 1
} }
...@@ -1528,7 +1528,7 @@ OpSwitch: ...@@ -1528,7 +1528,7 @@ OpSwitch:
var t *Type var t *Type
switch l.Type.Etype { switch l.Type.Etype {
default: default:
Yyerror("invalid operation: %v (arguments have type %v, expected floating-point)", n, l.Type, r.Type) Yyerror("invalid operation: %v (arguments have type %v, expected floating-point)", n, l.Type)
n.Type = nil n.Type = nil
return return
...@@ -1645,7 +1645,7 @@ OpSwitch: ...@@ -1645,7 +1645,7 @@ OpSwitch:
n.Type = t n.Type = t
if !Isslice(t) { if !Isslice(t) {
if Isconst(args.N, CTNIL) { if Isconst(args.N, CTNIL) {
Yyerror("first argument to append must be typed slice; have untyped nil", t) Yyerror("first argument to append must be typed slice; have untyped nil")
n.Type = nil n.Type = nil
return return
} }
...@@ -3526,7 +3526,7 @@ func typecheckfunc(n *Node) { ...@@ -3526,7 +3526,7 @@ func typecheckfunc(n *Node) {
func stringtoarraylit(np **Node) { func stringtoarraylit(np **Node) {
n := *np n := *np
if n.Left.Op != OLITERAL || n.Left.Val.Ctype != CTSTR { if n.Left.Op != OLITERAL || n.Left.Val.Ctype != CTSTR {
Fatal("stringtoarraylit %N", n) Fatal("stringtoarraylit %v", n)
} }
s := n.Left.Val.U.Sval s := n.Left.Val.U.Sval
......
This diff is collapsed.
This diff is collapsed.
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