1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:14:42 -07:00

cmd/...: fix vet issues and cull dead code

Change-Id: Ied0eab872950793b34dd2268055b29c702b07e99
Reviewed-on: https://go-review.googlesource.com/9081
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Josh Bleecher Snyder 2015-04-17 17:23:51 -07:00
parent d0f3100b47
commit 951f74c4d0
13 changed files with 48 additions and 100 deletions

View File

@ -329,7 +329,7 @@ func pushback(r0 *gc.Flow) {
if gc.Debug['P'] != 0 && gc.Debug['v'] != 0 {
fmt.Printf("no pushback: %v\n", r0.Prog)
if r != nil {
fmt.Printf("\t%v [%d]\n", r.Prog, gc.Uniqs(r) != nil)
fmt.Printf("\t%v [%v]\n", r.Prog, gc.Uniqs(r) != nil)
}
}

View File

@ -543,25 +543,6 @@ func rawgins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
return p
}
func fixlargeoffset(n *gc.Node) {
if n == nil {
return
}
if n.Op != gc.OINDREG {
return
}
if -4096 <= n.Xoffset && n.Xoffset < 4096 {
return
}
a := gc.Node(*n)
a.Op = gc.OREGISTER
a.Type = gc.Types[gc.Tptr]
a.Xoffset = 0
gc.Cgen_checknil(&a)
ginscon(optoas(gc.OADD, gc.Types[gc.Tptr]), n.Xoffset, &a)
n.Xoffset = 0
}
/*
* insert n into reg slot of p
*/

View File

@ -293,7 +293,7 @@ func copyprop(r0 *gc.Flow) bool {
v2 := (*obj.Addr)(&p.To)
if copyas(v1, v2) {
if gc.Debug['P'] != 0 {
fmt.Printf("eliminating self-move\n", r0.Prog)
fmt.Printf("eliminating self-move: %v\n", r0.Prog)
}
return true
}

View File

@ -638,31 +638,6 @@ func rawgins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
return p
}
func fixlargeoffset(n *gc.Node) {
if n == nil {
return
}
if n.Op != gc.OINDREG {
return
}
if n.Reg == ppc64.REGSP { // stack offset cannot be large
return
}
if n.Xoffset != int64(int32(n.Xoffset)) {
// TODO(minux): offset too large, move into R31 and add to R31 instead.
// this is used only in test/fixedbugs/issue6036.go.
gc.Fatal("offset too large: %v", n)
a := gc.Node(*n)
a.Op = gc.OREGISTER
a.Type = gc.Types[gc.Tptr]
a.Xoffset = 0
gc.Cgen_checknil(&a)
ginscon(optoas(gc.OADD, gc.Types[gc.Tptr]), n.Xoffset, &a)
n.Xoffset = 0
}
}
/*
* return Axxx for Oxxx on type t.
*/

View File

@ -481,7 +481,7 @@ func copyprop(r0 *gc.Flow) bool {
v2 := (*obj.Addr)(&p.To)
if copyas(v1, v2) {
if gc.Debug['P'] != 0 {
fmt.Printf("eliminating self-move\n", r0.Prog)
fmt.Printf("eliminating self-move: %v\n", r0.Prog)
}
return true
}

View File

@ -1135,7 +1135,6 @@ func idealkind(n *Node) int {
} else {
return k2
}
fallthrough
case OREAL, OIMAG:
return CTFLT

View File

@ -1184,7 +1184,6 @@ func exprfmt(n *Node, prec int) string {
return fmt.Sprintf("chan %v", n.Left)
}
}
fallthrough
case OTSTRUCT:
return "<struct>"

View File

@ -1738,51 +1738,48 @@ OpSwitch:
break OpSwitch
case OCONV:
{
ok |= Erv
saveorignode(n)
typecheck(&n.Left, Erv|top&(Eindir|Eiota))
convlit1(&n.Left, n.Type, true)
t := n.Left.Type
if t == nil || n.Type == nil {
n.Type = nil
return
}
var why string
n.Op = uint8(convertop(t, n.Type, &why))
if (n.Op) == 0 {
if n.Diag == 0 && n.Type.Broke == 0 {
Yyerror("cannot convert %v to type %v%s", Nconv(n.Left, obj.FmtLong), n.Type, why)
n.Diag = 1
}
n.Op = OCONV
}
switch n.Op {
case OCONVNOP:
if n.Left.Op == OLITERAL && n.Type != Types[TBOOL] {
r := Nod(OXXX, nil, nil)
n.Op = OCONV
n.Orig = r
*r = *n
n.Op = OLITERAL
n.Val = n.Left.Val
}
// do not use stringtoarraylit.
// generated code and compiler memory footprint is better without it.
case OSTRARRAYBYTE:
break
case OSTRARRAYRUNE:
if n.Left.Op == OLITERAL {
stringtoarraylit(&n)
}
}
break OpSwitch
ok |= Erv
saveorignode(n)
typecheck(&n.Left, Erv|top&(Eindir|Eiota))
convlit1(&n.Left, n.Type, true)
t := n.Left.Type
if t == nil || n.Type == nil {
n.Type = nil
return
}
var why string
n.Op = uint8(convertop(t, n.Type, &why))
if (n.Op) == 0 {
if n.Diag == 0 && n.Type.Broke == 0 {
Yyerror("cannot convert %v to type %v%s", Nconv(n.Left, obj.FmtLong), n.Type, why)
n.Diag = 1
}
n.Op = OCONV
}
switch n.Op {
case OCONVNOP:
if n.Left.Op == OLITERAL && n.Type != Types[TBOOL] {
r := Nod(OXXX, nil, nil)
n.Op = OCONV
n.Orig = r
*r = *n
n.Op = OLITERAL
n.Val = n.Left.Val
}
// do not use stringtoarraylit.
// generated code and compiler memory footprint is better without it.
case OSTRARRAYBYTE:
break
case OSTRARRAYRUNE:
if n.Left.Op == OLITERAL {
stringtoarraylit(&n)
}
}
break OpSwitch
case OMAKE:

View File

@ -791,14 +791,14 @@ func Codeblk(addr int64, size int64) {
q = sym.P
for n >= 16 {
fmt.Fprintf(&Bso, "%.6x\t%%-20.16I\n", uint64(addr), q)
fmt.Fprintf(&Bso, "%.6x\t%-20.16I\n", uint64(addr), q)
addr += 16
q = q[16:]
n -= 16
}
if n > 0 {
fmt.Fprintf(&Bso, "%.6x\t%%-20.*I\n", uint64(addr), int(n), q)
fmt.Fprintf(&Bso, "%.6x\t%-20.*I\n", uint64(addr), int(n), q)
}
addr += n
}

View File

@ -973,7 +973,7 @@ func defgotype(gotype *LSym) *DWDie {
}
if false && Debug['v'] > 2 {
fmt.Printf("new type: %%Y\n", gotype)
fmt.Printf("new type: %v\n", gotype)
}
kind := decodetype_kind(gotype)

View File

@ -1011,8 +1011,6 @@ func hostlink() {
func ldobj(f *Biobuf, pkg string, length int64, pn string, file string, whence int) {
eof := Boffset(f) + length
pn = pn
start := Boffset(f)
c1 := Bgetc(f)
c2 := Bgetc(f)

View File

@ -781,7 +781,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
}
p.As = obj.ARET
p.Lineno = p.Lineno
p.To.Type = obj.TYPE_MEM
p.To.Offset = 0
p.To.Reg = REGLINK

View File

@ -323,7 +323,7 @@ func (ctx *traceContext) emit(e *ViewerEvent) {
func (ctx *traceContext) time(ev *trace.Event) int64 {
if ev.Ts < ctx.startTime || ev.Ts > ctx.endTime {
fmt.Printf("ts=%v startTime=%v endTime\n", ev.Ts, ctx.startTime, ctx.endTime)
fmt.Printf("ts=%v startTime=%v endTime=%v\n", ev.Ts, ctx.startTime, ctx.endTime)
panic("timestamp is outside of trace range")
}
// NOTE: trace viewer wants timestamps in microseconds and it does not