mirror of
https://github.com/golang/go
synced 2024-11-12 09:30:25 -07:00
cmd/compile/internal/gc: convert Label.Used to bool
Convert Label.Used to a boolean. Also move the field to the bottom of the struct to avoid padding. This change passes go build -toolexec 'toolstash -cmp' -a std. Change-Id: If09ee92f9d54dce807e7b862cf771005daed810d Reviewed-on: https://go-review.googlesource.com/14308 Run-TryBot: Dave Cheney <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
0388d4303f
commit
8712e1867b
@ -729,7 +729,7 @@ func gen(n *Node) {
|
||||
break
|
||||
}
|
||||
|
||||
lab.Used = 1
|
||||
lab.Used = true
|
||||
if lab.Breakpc == nil {
|
||||
Yyerror("invalid break label %v", n.Left.Sym)
|
||||
break
|
||||
@ -754,7 +754,7 @@ func gen(n *Node) {
|
||||
break
|
||||
}
|
||||
|
||||
lab.Used = 1
|
||||
lab.Used = true
|
||||
if lab.Continpc == nil {
|
||||
Yyerror("invalid continue label %v", n.Left.Sym)
|
||||
break
|
||||
@ -994,7 +994,7 @@ func checklabels() {
|
||||
continue
|
||||
}
|
||||
|
||||
if lab.Use == nil && lab.Used == 0 {
|
||||
if lab.Use == nil && !lab.Used {
|
||||
yyerrorl(int(lab.Def.Lineno), "label %v defined and not used", lab.Sym)
|
||||
continue
|
||||
}
|
||||
|
@ -217,7 +217,6 @@ type Type struct {
|
||||
}
|
||||
|
||||
type Label struct {
|
||||
Used uint8
|
||||
Sym *Sym
|
||||
Def *Node
|
||||
Use []*Node
|
||||
@ -228,6 +227,8 @@ type Label struct {
|
||||
Labelpc *obj.Prog // pointer to code
|
||||
Breakpc *obj.Prog // pointer to code
|
||||
Continpc *obj.Prog // pointer to code
|
||||
|
||||
Used bool
|
||||
}
|
||||
|
||||
type InitEntry struct {
|
||||
|
Loading…
Reference in New Issue
Block a user