Revert "cmd/internal/gc: ignore declarations of types for goto validation"

This reverts commit 5726af54eb.

It broke all the builds.

Change-Id: I4b1dde86f9433717d303c1dabd6aa1a2bf97fab2
Reviewed-on: https://go-review.googlesource.com/10143
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Brad Fitzpatrick 2015-05-15 16:35:43 +00:00
parent 4302fd0409
commit 97494a45e2
4 changed files with 3 additions and 38 deletions

View file

@ -65,9 +65,6 @@ func popdcl() {
} }
s = Pkglookup(d.Name, d.Pkg) s = Pkglookup(d.Name, d.Pkg)
lno = int(s.Lastlineno) lno = int(s.Lastlineno)
if s.Def != nil {
d.whyPushed = s.Def.Op
}
dcopy(s, d) dcopy(s, d)
d.Lastlineno = int32(lno) d.Lastlineno = int32(lno)
if dflag() { if dflag() {

View file

@ -159,21 +159,6 @@ func checkgoto(from *Node, to *Node) {
fs = fs.Link fs = fs.Link
} }
if fs != to.Sym { if fs != to.Sym {
// more declarations at label than at goto.
// figure out if they are all types.
ts := to.Sym
ntt := nt
for ; ntt > nf; ntt-- {
if ts.whyPushed != OTYPE {
break
}
ts = ts.Link
}
// all types, nothing to see here.
if ntt == nf {
return
}
lno := int(lineno) lno := int(lineno)
setlineno(from) setlineno(from)
@ -183,11 +168,11 @@ func checkgoto(from *Node, to *Node) {
var block *Sym var block *Sym
var dcl *Sym var dcl *Sym
ts = to.Sym ts := to.Sym
for ; nt > nf; nt-- { for ; nt > nf; nt-- {
if ts.Pkg == nil { if ts.Pkg == nil {
block = ts block = ts
} else if ts.whyPushed != OTYPE { } else {
dcl = ts dcl = ts
} }
ts = ts.Link ts = ts.Link
@ -196,7 +181,7 @@ func checkgoto(from *Node, to *Node) {
for ts != fs { for ts != fs {
if ts.Pkg == nil { if ts.Pkg == nil {
block = ts block = ts
} else if ts.whyPushed != OTYPE { } else {
dcl = ts dcl = ts
} }
ts = ts.Link ts = ts.Link

View file

@ -111,7 +111,6 @@ type Sym struct {
Uniqgen uint32 Uniqgen uint32
Importdef *Pkg // where imported definition was found Importdef *Pkg // where imported definition was found
Linkname string // link name Linkname string // link name
whyPushed uint8 // why this symbol pushed onto dclstack. Same as Node.Op. Used by goto validation
// saved and restored by dcopy // saved and restored by dcopy
Pkg *Pkg Pkg *Pkg

View file

@ -536,19 +536,3 @@ func _() {
goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block" goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block"
} }
} }
// issue 8042
func _() {
goto L
type a int
L:
}
// make sure we only complain about variable declarations.
func _() {
goto L // ERROR "goto L jumps over declaration of x at LINE+2|goto jumps over declaration"
type a int
x := 1 // GCCGO_ERROR "defined here"
_ = x
L:
}