[dev.cc] runtime: generate GOOS- and GOARCH-specific files with go generate

Eventually I'd like almost everything cmd/dist generates
to be done with 'go generate' and checked in, to simplify
the bootstrap process. The only thing cmd/dist really needs
to do is write things like the current experiment info and
the current version.

This is a first step toward that. It replaces the _NaCl etc
constants with generated ones goos_nacl, goos_darwin,
goarch_386, and so on.

LGTM=dave, austin
R=austin, dave, bradfitz
CC=golang-codereviews, iant, r
https://golang.org/cl/174290043
This commit is contained in:
Russ Cox 2014-11-18 12:07:50 -05:00
parent 312a64ec4e
commit 0fe444d3e8
27 changed files with 379 additions and 79 deletions

View file

@ -45,7 +45,13 @@ const (
_Pdead
)
// XXX inserting below here
// The next line makes 'go generate' write the zgen_*.go files with
// per-OS and per-arch information, including constants
// named goos_$GOOS and goarch_$GOARCH for every
// known GOOS and GOARCH. The constant is 1 on the
// current system, 0 otherwise; multiplying by them is
// useful for defining GOOS- or GOARCH-specific constants.
//go:generate go run gengoos.go
type mutex struct {
// Futex-based impl treats it as uint32 key,
@ -395,14 +401,6 @@ type itab struct {
fun [0]uintptr
}
const (
// TODO: Generate in cmd/dist.
_NaCl = 0
_Windows = 0
_Solaris = 0
_Plan9 = 0
)
// Lock-free stack node.
type lfnode struct {
next *lfnode