cmd/compile: minor cleanup

Follow-up to review comments on CL 41797.

Mask the input to set2 and set3, so that at the very least,
we won't corrupt the rest of the flags in case of a bad input.
It also seems more semantically appropriate.

Do minor cleanup in addrescapes. I started on larger cleanup,
but it wasn't clear that it was an improvement.

Add warning comments and sanity checks to Initorder and Class constants,
to attempt to prevent them from overflowing their allotted flag bits.

Passes toolstash-check.

Change-Id: I57b9661ba36f56406aa7a1d8da9b7c70338f9119
Reviewed-on: https://go-review.googlesource.com/41817
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2017-04-26 10:18:41 -07:00
parent 6910e1085b
commit e1a7db7f3b
4 changed files with 28 additions and 19 deletions

View file

@ -9,11 +9,12 @@ import (
"fmt"
)
// static initialization
// Static initialization ordering state.
// These values are stored in two bits in Node.flags.
const (
InitNotStarted = 0
InitDone = 1
InitPending = 2
InitNotStarted = iota
InitDone
InitPending
)
type InitEntry struct {