mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal: C->Go printf cleanup
Change-Id: I1cf94377c613fb51ae77f4fe1e3439268b1606a9 Reviewed-on: https://go-review.googlesource.com/9161 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
899a4ad47e
commit
88c08b06b9
5 changed files with 9 additions and 18 deletions
|
|
@ -2424,16 +2424,13 @@ var lexn = []struct {
|
||||||
{LVAR, "VAR"},
|
{LVAR, "VAR"},
|
||||||
}
|
}
|
||||||
|
|
||||||
var lexname_buf string
|
|
||||||
|
|
||||||
func lexname(lex int) string {
|
func lexname(lex int) string {
|
||||||
for i := 0; i < len(lexn); i++ {
|
for i := 0; i < len(lexn); i++ {
|
||||||
if lexn[i].lex == lex {
|
if lexn[i].lex == lex {
|
||||||
return lexn[i].name
|
return lexn[i].name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lexname_buf = fmt.Sprintf("LEX-%d", lex)
|
return fmt.Sprintf("LEX-%d", lex)
|
||||||
return lexname_buf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var yytfix = []struct {
|
var yytfix = []struct {
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,6 @@ var _typekind = []string{
|
||||||
TIDEAL: "untyped number",
|
TIDEAL: "untyped number",
|
||||||
}
|
}
|
||||||
|
|
||||||
var typekind_buf string
|
|
||||||
|
|
||||||
func typekind(t *Type) string {
|
func typekind(t *Type) string {
|
||||||
if Isslice(t) {
|
if Isslice(t) {
|
||||||
return "slice"
|
return "slice"
|
||||||
|
|
@ -88,8 +86,7 @@ func typekind(t *Type) string {
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
typekind_buf = fmt.Sprintf("etype=%d", et)
|
return fmt.Sprintf("etype=%d", et)
|
||||||
return typekind_buf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -33,10 +33,10 @@ package ld
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cmd/internal/obj"
|
"cmd/internal/obj"
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func yy_isalpha(c int) bool {
|
func yy_isalpha(c int) bool {
|
||||||
|
|
@ -208,16 +208,13 @@ func Linkrlookup(ctxt *Link, name string, v int) *LSym {
|
||||||
return _lookup(ctxt, name, v, 0)
|
return _lookup(ctxt, name, v, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
var headstr_buf string
|
|
||||||
|
|
||||||
func Headstr(v int) string {
|
func Headstr(v int) string {
|
||||||
for i := 0; i < len(headers); i++ {
|
for i := 0; i < len(headers); i++ {
|
||||||
if v == headers[i].val {
|
if v == headers[i].val {
|
||||||
return headers[i].name
|
return headers[i].name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
headstr_buf = fmt.Sprintf("%d", v)
|
return strconv.Itoa(v)
|
||||||
return headstr_buf
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func headtype(name string) int {
|
func headtype(name string) int {
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ func (i *int32Value) Set(s string) error {
|
||||||
|
|
||||||
func (i *int32Value) Get() interface{} { return int32(*i) }
|
func (i *int32Value) Get() interface{} { return int32(*i) }
|
||||||
|
|
||||||
func (i *int32Value) String() string { return fmt.Sprintf("%v", *i) }
|
func (i *int32Value) String() string { return fmt.Sprint(*i) }
|
||||||
|
|
||||||
type fn0 func()
|
type fn0 func()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -379,7 +379,7 @@ func Dconv(p *Prog, a *Addr) string {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
str = fmt.Sprintf("%v", Rconv(int(a.Reg)))
|
str = Rconv(int(a.Reg))
|
||||||
if a.Name != TYPE_NONE || a.Sym != nil {
|
if a.Name != TYPE_NONE || a.Sym != nil {
|
||||||
str = fmt.Sprintf("%v(%v)(REG)", Mconv(a), Rconv(int(a.Reg)))
|
str = fmt.Sprintf("%v(%v)(REG)", Mconv(a), Rconv(int(a.Reg)))
|
||||||
}
|
}
|
||||||
|
|
@ -388,9 +388,9 @@ func Dconv(p *Prog, a *Addr) string {
|
||||||
if a.Sym != nil {
|
if a.Sym != nil {
|
||||||
str = fmt.Sprintf("%s(SB)", a.Sym.Name)
|
str = fmt.Sprintf("%s(SB)", a.Sym.Name)
|
||||||
} else if p != nil && p.Pcond != nil {
|
} else if p != nil && p.Pcond != nil {
|
||||||
str = fmt.Sprintf("%d", p.Pcond.Pc)
|
str = fmt.Sprint(p.Pcond.Pc)
|
||||||
} else if a.Val != nil {
|
} else if a.Val != nil {
|
||||||
str = fmt.Sprintf("%d", a.Val.(*Prog).Pc)
|
str = fmt.Sprint(a.Val.(*Prog).Pc)
|
||||||
} else {
|
} else {
|
||||||
str = fmt.Sprintf("%d(PC)", a.Offset)
|
str = fmt.Sprintf("%d(PC)", a.Offset)
|
||||||
}
|
}
|
||||||
|
|
@ -467,7 +467,7 @@ func Mconv(a *Addr) string {
|
||||||
case NAME_NONE:
|
case NAME_NONE:
|
||||||
switch {
|
switch {
|
||||||
case a.Reg == REG_NONE:
|
case a.Reg == REG_NONE:
|
||||||
str = fmt.Sprintf("%d", a.Offset)
|
str = fmt.Sprint(a.Offset)
|
||||||
case a.Offset == 0:
|
case a.Offset == 0:
|
||||||
str = fmt.Sprintf("(%v)", Rconv(int(a.Reg)))
|
str = fmt.Sprintf("(%v)", Rconv(int(a.Reg)))
|
||||||
case a.Offset != 0:
|
case a.Offset != 0:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue