From 9a75c748367c2ff84de355b136c33760a6b6928a Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 29 Aug 2014 16:00:31 -0400 Subject: [PATCH] runtime: include constants and defs_*_*.h types in generated Go defs I had to rename Kevent and Sigaction to avoid the functions of the same (lowercase) name. LGTM=iant, r R=golang-codereviews, r, iant, aram.h CC=dvyukov, golang-codereviews, khr https://golang.org/cl/140740043 --- src/cmd/cc/godefs.c | 4 ++-- src/cmd/dist/buildruntime.c | 21 ++++++++++++++++++--- src/pkg/runtime/defs.c | 1 + src/pkg/runtime/defs_darwin_386.h | 8 ++++---- src/pkg/runtime/defs_darwin_amd64.h | 8 ++++---- src/pkg/runtime/defs_dragonfly_386.h | 4 ++-- src/pkg/runtime/defs_dragonfly_amd64.h | 4 ++-- src/pkg/runtime/defs_freebsd_386.h | 4 ++-- src/pkg/runtime/defs_freebsd_amd64.h | 4 ++-- src/pkg/runtime/defs_freebsd_arm.h | 4 ++-- src/pkg/runtime/defs_linux_386.h | 4 ++-- src/pkg/runtime/defs_linux_amd64.h | 4 ++-- src/pkg/runtime/defs_linux_arm.h | 4 ++-- src/pkg/runtime/defs_netbsd_386.h | 4 ++-- src/pkg/runtime/defs_netbsd_amd64.h | 4 ++-- src/pkg/runtime/defs_netbsd_arm.h | 4 ++-- src/pkg/runtime/defs_openbsd_386.h | 4 ++-- src/pkg/runtime/defs_openbsd_amd64.h | 4 ++-- src/pkg/runtime/defs_solaris_amd64.h | 4 ++-- src/pkg/runtime/malloc.go | 16 +++++++--------- src/pkg/runtime/netpoll_kqueue.c | 6 +++--- src/pkg/runtime/os_darwin.c | 4 ++-- src/pkg/runtime/os_darwin.h | 4 ++-- src/pkg/runtime/os_dragonfly.c | 6 +++--- src/pkg/runtime/os_freebsd.c | 6 +++--- src/pkg/runtime/os_linux.c | 4 ++-- src/pkg/runtime/os_linux.h | 4 ++-- src/pkg/runtime/os_netbsd.c | 6 +++--- src/pkg/runtime/os_openbsd.c | 6 +++--- src/pkg/runtime/os_solaris.c | 6 +++--- src/pkg/runtime/os_solaris.h | 2 +- 31 files changed, 91 insertions(+), 77 deletions(-) diff --git a/src/cmd/cc/godefs.c b/src/cmd/cc/godefs.c index 1f2a9d7e04..d3ab52fde4 100644 --- a/src/cmd/cc/godefs.c +++ b/src/cmd/cc/godefs.c @@ -317,9 +317,9 @@ godefvar(Sym *s) switch(t->etype) { case TENUM: if(!typefd[t->etype]) - Bprint(&outbuf, "const %U = %lld\n", s->name, s->vconst); + Bprint(&outbuf, "const %s = %lld\n", s->name, s->vconst); else - Bprint(&outbuf, "const %U = %f\n;", s->name, s->fconst); + Bprint(&outbuf, "const %s = %f\n;", s->name, s->fconst); break; case TFUNC: diff --git a/src/cmd/dist/buildruntime.c b/src/cmd/dist/buildruntime.c index 5daa31494b..2396e20c56 100644 --- a/src/cmd/dist/buildruntime.c +++ b/src/cmd/dist/buildruntime.c @@ -346,6 +346,10 @@ mkzruntimedefs(char *dir, char *file) "\n" ); + // Do not emit constant definitions for these. + vadd(&seen, "true"); + vadd(&seen, "false"); + vadd(&seen, "raceenabled"); // Run 6c -D GOOS_goos -D GOARCH_goarch -I workdir -q -n -o workdir/runtimedefs // on each of the runtimedefs C files. @@ -375,15 +379,15 @@ mkzruntimedefs(char *dir, char *file) splitlines(&lines, bstr(&in)); for(i=0; i