Commit 2340f471 authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: remove unused FmtBody flag and associated code

For #15323.

Change-Id: I23192a05ce57012aa2f96909d90d6a33b913766b
Reviewed-on: https://go-review.googlesource.com/28151
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent f42f20ad
...@@ -27,7 +27,6 @@ const ( ...@@ -27,7 +27,6 @@ const (
FmtLong // "l" FmtLong // "l"
FmtComma // "," FmtComma // ","
FmtByte // "hh" FmtByte // "hh"
FmtBody // for printing export bodies
) )
// //
...@@ -80,8 +79,6 @@ var fmtmode int = FErr ...@@ -80,8 +79,6 @@ var fmtmode int = FErr
var fmtpkgpfx int // %uT stickyness var fmtpkgpfx int // %uT stickyness
var fmtbody bool
// //
// E.g. for %S: %+S %#S %-S print an identifier properly qualified for debug/export/internal mode. // E.g. for %S: %+S %#S %-S print an identifier properly qualified for debug/export/internal mode.
// //
...@@ -106,9 +103,8 @@ var fmtbody bool ...@@ -106,9 +103,8 @@ var fmtbody bool
// %-uT type identifiers with package name instead of prefix (typesym, dcommontype, typehash) // %-uT type identifiers with package name instead of prefix (typesym, dcommontype, typehash)
// //
func setfmode(flags *FmtFlag) (fm int, fb bool) { func setfmode(flags *FmtFlag) (fm int) {
fm = fmtmode fm = fmtmode
fb = fmtbody
if *flags&FmtSign != 0 { if *flags&FmtSign != 0 {
fmtmode = FDbg fmtmode = FDbg
} else if *flags&FmtSharp != 0 { } else if *flags&FmtSharp != 0 {
...@@ -117,11 +113,7 @@ func setfmode(flags *FmtFlag) (fm int, fb bool) { ...@@ -117,11 +113,7 @@ func setfmode(flags *FmtFlag) (fm int, fb bool) {
fmtmode = FTypeId fmtmode = FTypeId
} }
if *flags&FmtBody != 0 { *flags &^= (FmtSharp | FmtLeft | FmtSign)
fmtbody = true
}
*flags &^= (FmtSharp | FmtLeft | FmtSign | FmtBody)
return return
} }
...@@ -1350,13 +1342,6 @@ func (p *printer) exprfmt(n *Node, prec int) *printer { ...@@ -1350,13 +1342,6 @@ func (p *printer) exprfmt(n *Node, prec int) *printer {
p.f(" %#v ", Op(n.Etype)) p.f(" %#v ", Op(n.Etype))
p.exprfmt(n.Right, nprec+1) p.exprfmt(n.Right, nprec+1)
return p return p
case ODCLCONST:
// if exporting, DCLCONST should just be removed as its usage
// has already been replaced with literals
if fmtbody {
return p.s("")
}
} }
return p.f("<node %v>", n.Op) return p.f("<node %v>", n.Op)
...@@ -1504,11 +1489,10 @@ func (p *printer) sconv(s *Sym, flag FmtFlag) *printer { ...@@ -1504,11 +1489,10 @@ func (p *printer) sconv(s *Sym, flag FmtFlag) *printer {
} }
sf := flag sf := flag
sm, sb := setfmode(&flag) sm := setfmode(&flag)
p.symfmt(s, flag) p.symfmt(s, flag)
flag = sf flag = sf
fmtmode = sm fmtmode = sm
fmtbody = sb
return p return p
} }
...@@ -1529,7 +1513,7 @@ func Fldconv(f *Field, flag FmtFlag) string { ...@@ -1529,7 +1513,7 @@ func Fldconv(f *Field, flag FmtFlag) string {
} }
sf := flag sf := flag
sm, sb := setfmode(&flag) sm := setfmode(&flag)
if fmtmode == FTypeId && (sf&FmtUnsigned != 0) { if fmtmode == FTypeId && (sf&FmtUnsigned != 0) {
fmtpkgpfx++ fmtpkgpfx++
...@@ -1585,12 +1569,7 @@ func Fldconv(f *Field, flag FmtFlag) string { ...@@ -1585,12 +1569,7 @@ func Fldconv(f *Field, flag FmtFlag) string {
str = name + " " + typ str = name + " " + typ
} }
// The fmtbody flag is intended to suppress escape analysis annotations if flag&FmtShort == 0 && f.Funarg == FunargNone && f.Note != "" {
// when printing a function type used in a function body.
// (The escape analysis tags do not apply to func vars.)
// But it must not suppress struct field tags.
// See golang.org/issue/13777 and golang.org/issue/14331.
if flag&FmtShort == 0 && (!fmtbody || f.Funarg == FunargNone) && f.Note != "" {
str += " " + strconv.Quote(f.Note) str += " " + strconv.Quote(f.Note)
} }
...@@ -1599,7 +1578,6 @@ func Fldconv(f *Field, flag FmtFlag) string { ...@@ -1599,7 +1578,6 @@ func Fldconv(f *Field, flag FmtFlag) string {
} }
flag = sf flag = sf
fmtbody = sb
fmtmode = sm fmtmode = sm
return str return str
} }
...@@ -1623,7 +1601,7 @@ func (p *printer) Tconv(t *Type, flag FmtFlag) *printer { ...@@ -1623,7 +1601,7 @@ func (p *printer) Tconv(t *Type, flag FmtFlag) *printer {
t.Trecur++ t.Trecur++
sf := flag sf := flag
sm, sb := setfmode(&flag) sm := setfmode(&flag)
if fmtmode == FTypeId && (sf&FmtUnsigned != 0) { if fmtmode == FTypeId && (sf&FmtUnsigned != 0) {
fmtpkgpfx++ fmtpkgpfx++
...@@ -1639,7 +1617,6 @@ func (p *printer) Tconv(t *Type, flag FmtFlag) *printer { ...@@ -1639,7 +1617,6 @@ func (p *printer) Tconv(t *Type, flag FmtFlag) *printer {
} }
flag = sf flag = sf
fmtbody = sb
fmtmode = sm fmtmode = sm
t.Trecur-- t.Trecur--
...@@ -1668,7 +1645,7 @@ func (p *printer) Nconv(n *Node, flag FmtFlag) *printer { ...@@ -1668,7 +1645,7 @@ func (p *printer) Nconv(n *Node, flag FmtFlag) *printer {
return p.s("<N>") return p.s("<N>")
} }
sf := flag sf := flag
sm, sb := setfmode(&flag) sm := setfmode(&flag)
switch fmtmode { switch fmtmode {
case FErr: case FErr:
...@@ -1684,7 +1661,6 @@ func (p *printer) Nconv(n *Node, flag FmtFlag) *printer { ...@@ -1684,7 +1661,6 @@ func (p *printer) Nconv(n *Node, flag FmtFlag) *printer {
} }
flag = sf flag = sf
fmtbody = sb
fmtmode = sm fmtmode = sm
return p return p
...@@ -1712,7 +1688,7 @@ func (p *printer) hconv(l Nodes, flag FmtFlag) *printer { ...@@ -1712,7 +1688,7 @@ func (p *printer) hconv(l Nodes, flag FmtFlag) *printer {
} }
sf := flag sf := flag
sm, sb := setfmode(&flag) sm := setfmode(&flag)
sep := "; " sep := "; "
if fmtmode == FDbg { if fmtmode == FDbg {
sep = "\n" sep = "\n"
...@@ -1728,7 +1704,6 @@ func (p *printer) hconv(l Nodes, flag FmtFlag) *printer { ...@@ -1728,7 +1704,6 @@ func (p *printer) hconv(l Nodes, flag FmtFlag) *printer {
} }
flag = sf flag = sf
fmtbody = sb
fmtmode = sm fmtmode = sm
return p return p
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment