mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: remove global bout variable
Change-Id: I7054bbec080708c3a11ed62d7f6594e82aa33747 Reviewed-on: https://go-review.googlesource.com/61691 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
This commit is contained in:
parent
34db5f0c4d
commit
0fb82fbcce
3 changed files with 7 additions and 11 deletions
|
|
@ -19,7 +19,7 @@ var (
|
||||||
Debug_export int // if set, print debugging information about export data
|
Debug_export int // if set, print debugging information about export data
|
||||||
)
|
)
|
||||||
|
|
||||||
func exportf(format string, args ...interface{}) {
|
func exportf(bout *bio.Writer, format string, args ...interface{}) {
|
||||||
fmt.Fprintf(bout, format, args...)
|
fmt.Fprintf(bout, format, args...)
|
||||||
if Debug_export != 0 {
|
if Debug_export != 0 {
|
||||||
fmt.Printf(format, args...)
|
fmt.Printf(format, args...)
|
||||||
|
|
@ -222,14 +222,14 @@ func (x methodbyname) Len() int { return len(x) }
|
||||||
func (x methodbyname) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
|
func (x methodbyname) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
|
||||||
func (x methodbyname) Less(i, j int) bool { return x[i].Sym.Name < x[j].Sym.Name }
|
func (x methodbyname) Less(i, j int) bool { return x[i].Sym.Name < x[j].Sym.Name }
|
||||||
|
|
||||||
func dumpexport() {
|
func dumpexport(bout *bio.Writer) {
|
||||||
if buildid != "" {
|
if buildid != "" {
|
||||||
exportf("build id %q\n", buildid)
|
exportf(bout, "build id %q\n", buildid)
|
||||||
}
|
}
|
||||||
|
|
||||||
size := 0 // size of export section without enclosing markers
|
size := 0 // size of export section without enclosing markers
|
||||||
// The linker also looks for the $$ marker - use char after $$ to distinguish format.
|
// The linker also looks for the $$ marker - use char after $$ to distinguish format.
|
||||||
exportf("\n$$B\n") // indicate binary export format
|
exportf(bout, "\n$$B\n") // indicate binary export format
|
||||||
if debugFormat {
|
if debugFormat {
|
||||||
// save a copy of the export data
|
// save a copy of the export data
|
||||||
var copy bytes.Buffer
|
var copy bytes.Buffer
|
||||||
|
|
@ -253,7 +253,7 @@ func dumpexport() {
|
||||||
} else {
|
} else {
|
||||||
size = export(bout.Writer, Debug_export != 0)
|
size = export(bout.Writer, Debug_export != 0)
|
||||||
}
|
}
|
||||||
exportf("\n$$\n")
|
exportf(bout, "\n$$\n")
|
||||||
|
|
||||||
if Debug_export != 0 {
|
if Debug_export != 0 {
|
||||||
fmt.Printf("export data size = %d bytes\n", size)
|
fmt.Printf("export data size = %d bytes\n", size)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ package gc
|
||||||
import (
|
import (
|
||||||
"cmd/compile/internal/ssa"
|
"cmd/compile/internal/ssa"
|
||||||
"cmd/compile/internal/types"
|
"cmd/compile/internal/types"
|
||||||
"cmd/internal/bio"
|
|
||||||
"cmd/internal/obj"
|
"cmd/internal/obj"
|
||||||
"cmd/internal/src"
|
"cmd/internal/src"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
@ -85,8 +84,6 @@ var outfile string
|
||||||
var linkobj string
|
var linkobj string
|
||||||
var dolinkobj bool
|
var dolinkobj bool
|
||||||
|
|
||||||
var bout *bio.Writer
|
|
||||||
|
|
||||||
// nerrors is the number of compiler errors reported
|
// nerrors is the number of compiler errors reported
|
||||||
// since the last call to saveerrors.
|
// since the last call to saveerrors.
|
||||||
var nerrors int
|
var nerrors int
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,7 @@ func dumpobj() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func dumpobj1(outfile string, mode int) {
|
func dumpobj1(outfile string, mode int) {
|
||||||
var err error
|
bout, err := bio.Create(outfile)
|
||||||
bout, err = bio.Create(outfile)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
flusherrors()
|
flusherrors()
|
||||||
fmt.Printf("can't create %s: %v\n", outfile, err)
|
fmt.Printf("can't create %s: %v\n", outfile, err)
|
||||||
|
|
@ -92,7 +91,7 @@ func dumpobj1(outfile string, mode int) {
|
||||||
printheader()
|
printheader()
|
||||||
|
|
||||||
if mode&modeCompilerObj != 0 {
|
if mode&modeCompilerObj != 0 {
|
||||||
dumpexport()
|
dumpexport(bout)
|
||||||
}
|
}
|
||||||
|
|
||||||
if writearchive {
|
if writearchive {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue