diff options
| author | Russ Cox <rsc@golang.org> | 2014-09-16 10:22:15 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-09-16 10:22:15 -0400 |
| commit | d2574e2adb658b46ea2d8e22b3195cc14da1affe (patch) | |
| tree | 58810c5dfaf8842fa3584530cc0c8ccfa1be6b62 /src/cmd | |
| parent | 8d61334dd5b08c8076e343aa33197bd219cdf922 (diff) | |
| download | go-d2574e2adb658b46ea2d8e22b3195cc14da1affe.tar.xz | |
runtime: remove duplicated Go constants
The C header files are the single point of truth:
every C enum constant Foo is available to Go as _Foo.
Remove or redirect duplicate Go declarations so they
cannot be out of sync.
Eventually we will need to put constants in Go, but for now having
them be out of sync with C is too risky. These predate the build
support for auto-generating Go constants from the C definitions.
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/141510043
Diffstat (limited to 'src/cmd')
| -rw-r--r-- | src/cmd/api/goapi.go | 46 | ||||
| -rw-r--r-- | src/cmd/dist/buildruntime.c | 6 |
2 files changed, 50 insertions, 2 deletions
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go index 8494a3f61b..78b7d6edf1 100644 --- a/src/cmd/api/goapi.go +++ b/src/cmd/api/goapi.go @@ -423,6 +423,52 @@ func (w *Walker) parseFile(dir, file string) (*ast.File, error) { " _Genqueue = 7;" + " _Gcopystack = 8;" + " _NSIG = 32;" + + " _FlagNoScan = iota;" + + " _FlagNoZero;" + + " _TinySize;" + + " _TinySizeClass;" + + " _MaxSmallSize;" + + " _PageShift;" + + " _PageSize;" + + " _PageMask;" + + " _BitsPerPointer;" + + " _BitsMask;" + + " _PointersPerByte;" + + " _MaxGCMask;" + + " _BitsDead;" + + " _BitsPointer;" + + " _MSpanInUse;" + + " _ConcurrentSweep;" + + " _KindBool;" + + " _KindInt;" + + " _KindInt8;" + + " _KindInt16;" + + " _KindInt32;" + + " _KindInt64;" + + " _KindUint;" + + " _KindUint8;" + + " _KindUint16;" + + " _KindUint32;" + + " _KindUint64;" + + " _KindUintptr;" + + " _KindFloat32;" + + " _KindFloat64;" + + " _KindComplex64;" + + " _KindComplex128;" + + " _KindArray;" + + " _KindChan;" + + " _KindFunc;" + + " _KindInterface;" + + " _KindMap;" + + " _KindPtr;" + + " _KindSlice;" + + " _KindString;" + + " _KindStruct;" + + " _KindUnsafePointer;" + + " _KindDirectIface;" + + " _KindGCProg;" + + " _KindNoPointers;" + + " _KindMask;" + ")" f, err = parser.ParseFile(fset, filename, src, 0) if err != nil { diff --git a/src/cmd/dist/buildruntime.c b/src/cmd/dist/buildruntime.c index 36efb5711c..1257d5b811 100644 --- a/src/cmd/dist/buildruntime.c +++ b/src/cmd/dist/buildruntime.c @@ -329,6 +329,8 @@ mkzsys(char *dir, char *file) static char *runtimedefs[] = { "defs.c", + "malloc.c", + "mgc0.c", "proc.c", "parfor.c", }; @@ -337,8 +339,8 @@ static char *runtimedefs[] = { // which contains Go struct definitions equivalent to the C ones. // Mostly we just write the output of 6c -q to the file. // However, we run it on multiple files, so we have to delete -// the duplicated definitions, and we don't care about the funcs -// and consts, so we delete those too. +// the duplicated definitions, and we don't care about the funcs, +// so we delete those too. // void mkzruntimedefs(char *dir, char *file) |
