]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove conditional code dealing with two export formats
authorRobert Griesemer <gri@golang.org>
Wed, 17 Aug 2016 00:32:54 +0000 (17:32 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 17 Aug 2016 00:57:35 +0000 (00:57 +0000)
This removes some scaffolding introduced pre-1.7, introduced to
fix an export format bug, and to minimize conflicts with older
formats. The currently deployed and recognized format is "v1",
so don't worry about other versions. This is a step towards a
better scheme for internal export format versioning.

For #16244.

Change-Id: Ic7cf99dd2a24ad5484cc54aed44fa09332c2cf72
Reviewed-on: https://go-review.googlesource.com/27205
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Robert Griesemer <gri@golang.org>

src/cmd/compile/internal/gc/bexport.go
src/cmd/compile/internal/gc/bimport.go
src/go/internal/gcimporter/bimport.go

index 8dafd51eb378dd51faef837c1cd4f472b8955ebf..7915bce8c6195b26a1a4bb0ffebd238600a1b19f 100644 (file)
@@ -153,13 +153,9 @@ const debugFormat = false // default: false
 // TODO(gri) disable and remove once there is only one export format again
 const forceObjFileStability = true
 
-// Supported export format versions.
+// Current export format version.
 // TODO(gri) Make this more systematic (issue #16244).
-const (
-       exportVersion0 = "v0"
-       exportVersion1 = "v1"
-       exportVersion  = exportVersion1
-)
+const exportVersion = "v1"
 
 // exportInlined enables the export of inlined function bodies and related
 // dependencies. The compiler should work w/o any loss of functionality with
@@ -734,14 +730,7 @@ func (p *exporter) typ(t *Type) {
                        p.paramList(sig.Recvs(), inlineable)
                        p.paramList(sig.Params(), inlineable)
                        p.paramList(sig.Results(), inlineable)
-
-                       // for issue #16243
-                       // We make this conditional for 1.7 to avoid consistency problems
-                       // with installed packages compiled with an older version.
-                       // TODO(gri) Clean up after 1.7 is out (issue #16244)
-                       if exportVersion == exportVersion1 {
-                               p.bool(m.Nointerface)
-                       }
+                       p.bool(m.Nointerface) // record go:nointerface pragma value (see also #16243)
 
                        var f *Func
                        if inlineable {
index 463178eafbb969d07679299678ce8e56adc8a1a7..b0c1f5c698cc1a879940c64144e9d711b83e54a0 100644 (file)
@@ -21,9 +21,8 @@ import (
 // changes to bimport.go and bexport.go.
 
 type importer struct {
-       in      *bufio.Reader
-       buf     []byte // reused for reading strings
-       version string
+       in  *bufio.Reader
+       buf []byte // reused for reading strings
 
        // object lists, in order of deserialization
        strList       []string
@@ -68,9 +67,8 @@ func Import(in *bufio.Reader) {
 
        // --- generic export data ---
 
-       p.version = p.string()
-       if p.version != exportVersion0 && p.version != exportVersion1 {
-               Fatalf("importer: unknown export data version: %s", p.version)
+       if v := p.string(); v != exportVersion {
+               Fatalf("importer: unknown export data version: %s", v)
        }
 
        // populate typList with predeclared "known" types
@@ -429,11 +427,7 @@ func (p *importer) typ() *Type {
                        recv := p.paramList() // TODO(gri) do we need a full param list for the receiver?
                        params := p.paramList()
                        result := p.paramList()
-
-                       nointerface := false
-                       if p.version == exportVersion1 {
-                               nointerface = p.bool()
-                       }
+                       nointerface := p.bool()
 
                        n := methodname1(newname(sym), recv[0].Right)
                        n.Type = functype(recv[0], params, result)
index 75c2d9123e98747e7ef4ddc49fe984a852654134..dc09e6574673788adbcfc80b9884a7fa5de15eec 100644 (file)
@@ -21,7 +21,6 @@ type importer struct {
        data    []byte
        path    string
        buf     []byte // for reading strings
-       version string
 
        // object lists
        strList       []string         // in order of appearance
@@ -67,9 +66,8 @@ func BImportData(imports map[string]*types.Package, data []byte, path string) (i
 
        // --- generic export data ---
 
-       p.version = p.string()
-       if p.version != "v0" && p.version != "v1" {
-               return p.read, nil, fmt.Errorf("unknown export data version: %s", p.version)
+       if v := p.string(); v != "v1" {
+               return p.read, nil, fmt.Errorf("unknown export data version: %s", v)
        }
 
        // populate typList with predeclared "known" types
@@ -305,10 +303,7 @@ func (p *importer) typ(parent *types.Package) types.Type {
                        recv, _ := p.paramList() // TODO(gri) do we need a full param list for the receiver?
                        params, isddd := p.paramList()
                        result, _ := p.paramList()
-
-                       if p.version == "v1" {
-                               p.int() // nointerface flag - discarded
-                       }
+                       p.int() // go:nointerface pragma - discarded
 
                        sig := types.NewSignature(recv.At(0), params, result, isddd)
                        t0.AddMethod(types.NewFunc(token.NoPos, parent, name, sig))