mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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:
parent
d0f3100b47
commit
951f74c4d0
13 changed files with 48 additions and 100 deletions
|
|
@ -329,7 +329,7 @@ func pushback(r0 *gc.Flow) {
|
||||||
if gc.Debug['P'] != 0 && gc.Debug['v'] != 0 {
|
if gc.Debug['P'] != 0 && gc.Debug['v'] != 0 {
|
||||||
fmt.Printf("no pushback: %v\n", r0.Prog)
|
fmt.Printf("no pushback: %v\n", r0.Prog)
|
||||||
if r != nil {
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -543,25 +543,6 @@ func rawgins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
|
||||||
return p
|
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
|
* insert n into reg slot of p
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ func copyprop(r0 *gc.Flow) bool {
|
||||||
v2 := (*obj.Addr)(&p.To)
|
v2 := (*obj.Addr)(&p.To)
|
||||||
if copyas(v1, v2) {
|
if copyas(v1, v2) {
|
||||||
if gc.Debug['P'] != 0 {
|
if gc.Debug['P'] != 0 {
|
||||||
fmt.Printf("eliminating self-move\n", r0.Prog)
|
fmt.Printf("eliminating self-move: %v\n", r0.Prog)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -638,31 +638,6 @@ func rawgins(as int, f *gc.Node, t *gc.Node) *obj.Prog {
|
||||||
return p
|
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.
|
* return Axxx for Oxxx on type t.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,7 @@ func copyprop(r0 *gc.Flow) bool {
|
||||||
v2 := (*obj.Addr)(&p.To)
|
v2 := (*obj.Addr)(&p.To)
|
||||||
if copyas(v1, v2) {
|
if copyas(v1, v2) {
|
||||||
if gc.Debug['P'] != 0 {
|
if gc.Debug['P'] != 0 {
|
||||||
fmt.Printf("eliminating self-move\n", r0.Prog)
|
fmt.Printf("eliminating self-move: %v\n", r0.Prog)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1135,7 +1135,6 @@ func idealkind(n *Node) int {
|
||||||
} else {
|
} else {
|
||||||
return k2
|
return k2
|
||||||
}
|
}
|
||||||
fallthrough
|
|
||||||
|
|
||||||
case OREAL, OIMAG:
|
case OREAL, OIMAG:
|
||||||
return CTFLT
|
return CTFLT
|
||||||
|
|
|
||||||
|
|
@ -1184,7 +1184,6 @@ func exprfmt(n *Node, prec int) string {
|
||||||
return fmt.Sprintf("chan %v", n.Left)
|
return fmt.Sprintf("chan %v", n.Left)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fallthrough
|
|
||||||
|
|
||||||
case OTSTRUCT:
|
case OTSTRUCT:
|
||||||
return "<struct>"
|
return "<struct>"
|
||||||
|
|
|
||||||
|
|
@ -1738,51 +1738,48 @@ OpSwitch:
|
||||||
break OpSwitch
|
break OpSwitch
|
||||||
|
|
||||||
case OCONV:
|
case OCONV:
|
||||||
{
|
ok |= Erv
|
||||||
ok |= Erv
|
saveorignode(n)
|
||||||
saveorignode(n)
|
typecheck(&n.Left, Erv|top&(Eindir|Eiota))
|
||||||
typecheck(&n.Left, Erv|top&(Eindir|Eiota))
|
convlit1(&n.Left, n.Type, true)
|
||||||
convlit1(&n.Left, n.Type, true)
|
t := n.Left.Type
|
||||||
t := n.Left.Type
|
if t == nil || n.Type == nil {
|
||||||
if t == nil || n.Type == nil {
|
n.Type = nil
|
||||||
n.Type = nil
|
return
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
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
|
break OpSwitch
|
||||||
|
|
||||||
case OMAKE:
|
case OMAKE:
|
||||||
|
|
|
||||||
|
|
@ -791,14 +791,14 @@ func Codeblk(addr int64, size int64) {
|
||||||
q = sym.P
|
q = sym.P
|
||||||
|
|
||||||
for n >= 16 {
|
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
|
addr += 16
|
||||||
q = q[16:]
|
q = q[16:]
|
||||||
n -= 16
|
n -= 16
|
||||||
}
|
}
|
||||||
|
|
||||||
if n > 0 {
|
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
|
addr += n
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -973,7 +973,7 @@ func defgotype(gotype *LSym) *DWDie {
|
||||||
}
|
}
|
||||||
|
|
||||||
if false && Debug['v'] > 2 {
|
if false && Debug['v'] > 2 {
|
||||||
fmt.Printf("new type: %%Y\n", gotype)
|
fmt.Printf("new type: %v\n", gotype)
|
||||||
}
|
}
|
||||||
|
|
||||||
kind := decodetype_kind(gotype)
|
kind := decodetype_kind(gotype)
|
||||||
|
|
|
||||||
|
|
@ -1011,8 +1011,6 @@ func hostlink() {
|
||||||
func ldobj(f *Biobuf, pkg string, length int64, pn string, file string, whence int) {
|
func ldobj(f *Biobuf, pkg string, length int64, pn string, file string, whence int) {
|
||||||
eof := Boffset(f) + length
|
eof := Boffset(f) + length
|
||||||
|
|
||||||
pn = pn
|
|
||||||
|
|
||||||
start := Boffset(f)
|
start := Boffset(f)
|
||||||
c1 := Bgetc(f)
|
c1 := Bgetc(f)
|
||||||
c2 := Bgetc(f)
|
c2 := Bgetc(f)
|
||||||
|
|
|
||||||
|
|
@ -781,7 +781,6 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym) {
|
||||||
}
|
}
|
||||||
|
|
||||||
p.As = obj.ARET
|
p.As = obj.ARET
|
||||||
p.Lineno = p.Lineno
|
|
||||||
p.To.Type = obj.TYPE_MEM
|
p.To.Type = obj.TYPE_MEM
|
||||||
p.To.Offset = 0
|
p.To.Offset = 0
|
||||||
p.To.Reg = REGLINK
|
p.To.Reg = REGLINK
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,7 @@ func (ctx *traceContext) emit(e *ViewerEvent) {
|
||||||
|
|
||||||
func (ctx *traceContext) time(ev *trace.Event) int64 {
|
func (ctx *traceContext) time(ev *trace.Event) int64 {
|
||||||
if ev.Ts < ctx.startTime || ev.Ts > ctx.endTime {
|
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")
|
panic("timestamp is outside of trace range")
|
||||||
}
|
}
|
||||||
// NOTE: trace viewer wants timestamps in microseconds and it does not
|
// NOTE: trace viewer wants timestamps in microseconds and it does not
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue