]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: eliminate Io.importsafe
authorMatthew Dempsky <mdempsky@google.com>
Tue, 1 Dec 2015 19:58:41 +0000 (11:58 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 18 Feb 2016 21:28:57 +0000 (21:28 +0000)
It was only really necessary for ensuring that package runtime should
be treated as safe even without a "safe" marker, but mkbuiltin.go now
compiles it with -u.

Change-Id: Ifbcc62436ce40ab732ece667141afd82c1d3b64b
Reviewed-on: https://go-review.googlesource.com/19625
Reviewed-by: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/lex.go
src/cmd/compile/internal/gc/parser.go

index 3146caed2f1e37d2913022ffadd28d239bbcdd94..8053aaffe9dc620d8ff3b9c5e2f0fed4214ff396 100644 (file)
@@ -386,15 +386,14 @@ type Sig struct {
 }
 
 type Io struct {
-       infile     string
-       bin        *obj.Biobuf
-       cp         string // used for content when bin==nil
-       last       int
-       peekc      int
-       peekc1     int // second peekc for ...
-       nlsemi     bool
-       eofnl      bool
-       importsafe bool
+       infile string
+       bin    *obj.Biobuf
+       cp     string // used for content when bin==nil
+       last   int
+       peekc  int
+       peekc1 int // second peekc for ...
+       nlsemi bool
+       eofnl  bool
 }
 
 type Dlist struct {
index b9c27357bb61a81183d0ee985a4d87e5b64860ec..f1112e5af88f1e5c5bfb5153b3f0d9b8884854c7 100644 (file)
@@ -884,7 +884,6 @@ func cannedimports(file string, cp string) {
        curio.infile = file
        curio.cp = cp
        curio.nlsemi = false
-       curio.importsafe = false
 
        typecheckok = true
        incannedimport = 1
index 054cf7365617ce662a5b9b244c1c751900f95a0d..2e4be63a340aa78b4e5ee134bb596948e4259463 100644 (file)
@@ -71,7 +71,6 @@ func (p *parser) loadsys() {
        } else {
                cannedimports("runtime.Builtin", runtimeimport)
        }
-       curio.importsafe = true
 
        p.import_package()
        p.import_there()
@@ -467,9 +466,10 @@ func (p *parser) import_package() {
                p.import_error()
        }
 
+       importsafe := false
        if p.tok == LNAME {
                if p.sym_.Name == "safe" {
-                       curio.importsafe = true
+                       importsafe = true
                }
                p.next()
        }
@@ -484,9 +484,9 @@ func (p *parser) import_package() {
        if incannedimport == 0 {
                importpkg.Direct = true
        }
-       importpkg.Safe = curio.importsafe
+       importpkg.Safe = importsafe
 
-       if safemode != 0 && !curio.importsafe {
+       if safemode != 0 && !importsafe {
                Yyerror("cannot import unsafe package %q", importpkg.Path)
        }
 }