1
0
mirror of https://github.com/golang/go synced 2024-09-25 09:20:18 -06: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:
Dave Cheney 2015-09-07 11:11:14 +10:00
parent 0388d4303f
commit 8712e1867b
2 changed files with 5 additions and 4 deletions

View File

@ -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
}

View File

@ -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 {