From 8712e1867b47e3b741f399c9be0f1e32252a792c Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Mon, 7 Sep 2015 11:11:14 +1000 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/cmd/compile/internal/gc/gen.go | 6 +++--- src/cmd/compile/internal/gc/go.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cmd/compile/internal/gc/gen.go b/src/cmd/compile/internal/gc/gen.go index 355210b87a..22d8a1ebae 100644 --- a/src/cmd/compile/internal/gc/gen.go +++ b/src/cmd/compile/internal/gc/gen.go @@ -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 } diff --git a/src/cmd/compile/internal/gc/go.go b/src/cmd/compile/internal/gc/go.go index 8c7328fa4b..91838ffdda 100644 --- a/src/cmd/compile/internal/gc/go.go +++ b/src/cmd/compile/internal/gc/go.go @@ -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 {