mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
65c5d62420
commit
0a15d95091
26 changed files with 181 additions and 187 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue