]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove FmtFlag save and restore
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 7 Nov 2016 23:50:16 +0000 (15:50 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 14 Mar 2017 02:34:38 +0000 (02:34 +0000)
It is unnecessary.

Passes toolstash -cmp.

Change-Id: I7c03523b6110c3d9bd5ba2b37d9a1e17a7ae570e
Reviewed-on: https://go-review.googlesource.com/38145
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/fmt.go

index ba3c1d8bb9874c352916bc3a60c338bb5381d9ab..bddaeed3ac238694dfc72781809e2bed0d3eaab2 100644 (file)
@@ -1589,10 +1589,8 @@ func (s *Sym) sconv(flag FmtFlag) string {
                return "_"
        }
 
-       sf := flag
        sm := setfmode(&flag)
        str := s.symfmt(flag)
-       flag = sf
        fmtmode = sm
        return str
 }
@@ -1626,10 +1624,10 @@ func fldconv(f *Field, flag FmtFlag) string {
                return "<T>"
        }
 
-       sf := flag
+       unsigned := flag&FmtUnsigned != 0
        sm := setfmode(&flag)
 
-       if fmtmode == FTypeId && (sf&FmtUnsigned != 0) {
+       if fmtmode == FTypeId && unsigned {
                fmtpkgpfx++
        }
        if fmtpkgpfx != 0 {
@@ -1687,11 +1685,10 @@ func fldconv(f *Field, flag FmtFlag) string {
                str += " " + strconv.Quote(f.Note)
        }
 
-       if fmtmode == FTypeId && (sf&FmtUnsigned != 0) {
+       if fmtmode == FTypeId && unsigned {
                fmtpkgpfx--
        }
 
-       flag = sf
        fmtmode = sm
        return str
 }
@@ -1719,10 +1716,10 @@ func (t *Type) tconv(flag FmtFlag) string {
        }
 
        t.Trecur++
-       sf := flag
+       unsigned := flag&FmtUnsigned != 0
        sm := setfmode(&flag)
 
-       if fmtmode == FTypeId && (sf&FmtUnsigned != 0) {
+       if fmtmode == FTypeId && unsigned {
                fmtpkgpfx++
        }
        if fmtpkgpfx != 0 {
@@ -1731,11 +1728,10 @@ func (t *Type) tconv(flag FmtFlag) string {
 
        str := t.typefmt(flag)
 
-       if fmtmode == FTypeId && (sf&FmtUnsigned != 0) {
+       if fmtmode == FTypeId && unsigned {
                fmtpkgpfx--
        }
 
-       flag = sf
        fmtmode = sm
        t.Trecur--
        return str
@@ -1753,7 +1749,6 @@ func (n *Node) nconv(s fmt.State, flag FmtFlag) {
                return
        }
 
-       sf := flag
        sm := setfmode(&flag)
 
        switch fmtmode {
@@ -1769,7 +1764,6 @@ func (n *Node) nconv(s fmt.State, flag FmtFlag) {
                Fatalf("unhandled %%N mode: %d", fmtmode)
        }
 
-       flag = sf
        fmtmode = sm
 }
 
@@ -1794,7 +1788,6 @@ func (l Nodes) hconv(s fmt.State, flag FmtFlag) {
                return
        }
 
-       sf := flag
        sm := setfmode(&flag)
        sep := "; "
        if fmtmode == FDbg {
@@ -1810,7 +1803,6 @@ func (l Nodes) hconv(s fmt.State, flag FmtFlag) {
                }
        }
 
-       flag = sf
        fmtmode = sm
 }