Commit 86c93c98 authored by Robert Griesemer's avatar Robert Griesemer

cmd/compile: don't write pos info for builtin packages

TestBuiltin will fail if run on Windows and builtin.go was generated
on a non-Windows machine (or vice versa) because path names have
different separators. Avoid problem altogether by not writing pos
info for builtin packages. It's not needed.

Affects -newexport only.

Change-Id: I8944f343452faebaea9a08b5fb62829bed77c148
Reviewed-on: https://go-review.googlesource.com/22498
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarMatthew Dempsky <mdempsky@google.com>
parent a19e60b2
......@@ -112,10 +112,6 @@ import (
// (suspected) format errors, and whenever a change is made to the format.
const debugFormat = false // default: false
// If posInfoFormat is set, position information (file, lineno) is written
// for each exported object, including methods and struct fields.
const posInfoFormat = true // default: true
// TODO(gri) remove eventually
const forceNewExport = false // force new export format - do NOT submit with this flag set
......@@ -144,6 +140,7 @@ type exporter struct {
funcList []*Func
// position encoding
posInfoFormat bool
prevFile string
prevLine int
......@@ -160,6 +157,10 @@ func export(out *bufio.Writer, trace bool) int {
strIndex: map[string]int{"": 0}, // empty string is mapped to 0
pkgIndex: make(map[*Pkg]int),
typIndex: make(map[*Type]int),
// don't emit pos info for builtin packages
// (not needed and avoids path name diffs in builtin.go between
// Windows and non-Windows machines, exposed via builtin_test.go)
posInfoFormat: Debug['A'] == 0,
trace: trace,
}
......@@ -171,7 +172,7 @@ func export(out *bufio.Writer, trace bool) int {
p.rawByte(format)
// posInfo exported or not?
p.bool(posInfoFormat)
p.bool(p.posInfoFormat)
// --- generic export data ---
......@@ -506,7 +507,7 @@ func (p *exporter) obj(sym *Sym) {
}
func (p *exporter) pos(n *Node) {
if !posInfoFormat {
if !p.posInfoFormat {
return
}
......
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