aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/deadcode.go
diff options
context:
space:
mode:
authorMichael Matloob <matloob@golang.org>2016-08-21 18:25:28 -0400
committerMichael Matloob <matloob@golang.org>2016-08-21 23:00:27 +0000
commit0a15d95091f4d7db396da018e49653fbb3b19a53 (patch)
tree2ce868162de30f35700633f2ef8da09d03619f4b /src/cmd/link/internal/ld/deadcode.go
parent65c5d62420a539f2f0d06b3ea2ba837f0fbdd6cf (diff)
downloadgo-0a15d95091f4d7db396da018e49653fbb3b19a53.tar.xz
cmd/link: use standard library flag package where possible
The obj library's flag functions are (mostly) light wrappers around the standard library flag package. Use the flag package directly where possible. Most uses of the 'count'-type flags (except for -v) only check against 0, so they can safely be replaced by bools. Only -v and the flagfns haven't been replaced. Debug has been turned into a slice of bools rather than ints. There was a copy of the -v verbosity in ctxt.Debugvlog, so don't use Debug['v'] and just use ctxt.Debugvlog. Updates #16818 Change-Id: Icf6473a4823c9d35513bbd0c34ea02d5676d782a Reviewed-on: https://go-review.googlesource.com/27471 Run-TryBot: Michael Matloob <matloob@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/cmd/link/internal/ld/deadcode.go')
-rw-r--r--src/cmd/link/internal/ld/deadcode.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go
index 6278b5d580..36ed60344c 100644
--- a/src/cmd/link/internal/ld/deadcode.go
+++ b/src/cmd/link/internal/ld/deadcode.go
@@ -45,7 +45,7 @@ import (
//
// Any unreached text symbols are removed from ctxt.Textp.
func deadcode(ctxt *Link) {
- if Debug['v'] != 0 {
+ if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f deadcode\n", obj.Cputime())
}
@@ -180,7 +180,7 @@ func (d *deadcodepass) cleanupReloc(r *Reloc) {
if r.Sym.Attr.Reachable() {
r.Type = obj.R_ADDROFF
} else {
- if Debug['v'] > 1 {
+ if d.ctxt.Debugvlog > 1 {
fmt.Fprintf(d.ctxt.Bso, "removing method %s\n", r.Sym.Name)
}
r.Sym = nil
@@ -264,7 +264,7 @@ func (d *deadcodepass) flood() {
s := d.markQueue[0]
d.markQueue = d.markQueue[1:]
if s.Type == obj.STEXT {
- if Debug['v'] > 1 {
+ if d.ctxt.Debugvlog > 1 {
fmt.Fprintf(d.ctxt.Bso, "marktext %s\n", s.Name)
}
if s.FuncInfo != nil {
@@ -278,7 +278,7 @@ func (d *deadcodepass) flood() {
if strings.HasPrefix(s.Name, "type.") && s.Name[5] != '.' {
if decodetype_kind(s)&kindMask == kindInterface {
for _, sig := range decodetype_ifacemethods(d.ctxt.Arch, s) {
- if Debug['v'] > 1 {
+ if d.ctxt.Debugvlog > 1 {
fmt.Fprintf(d.ctxt.Bso, "reached iface method: %s\n", sig)
}
d.ifaceMethod[sig] = true