diff options
author | Russ Cox <rsc@golang.org> | 2009-08-24 11:03:23 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-08-24 11:03:23 -0700 |
commit | bc703dd1afac3c8f5d326fde0024f6355f1baf9b (patch) | |
tree | a507c4e71d79979868231db835d8106a186ed55a | |
parent | 4ead6a4a87b849c928e29195cbfebd21bf93e24d (diff) | |
download | golang-bc703dd1afac3c8f5d326fde0024f6355f1baf9b.tar.gz |
avoid duplicate field names, so that bug132 can be fixed
also fix echo bug that just surfaced in mkerrors.sh
R=r
DELTA=67 (11 added, 19 deleted, 37 changed)
OCL=33743
CL=33757
-rw-r--r-- | src/cmd/godefs/main.c | 9 | ||||
-rw-r--r-- | src/pkg/syscall/Makefile | 1 | ||||
-rwxr-xr-x | src/pkg/syscall/PORT.sh | 12 | ||||
-rwxr-xr-x | src/pkg/syscall/mkerrors.sh | 11 | ||||
-rwxr-xr-x | src/pkg/syscall/mksyscall.sh | 5 | ||||
-rw-r--r-- | src/pkg/syscall/types_darwin.c | 2 | ||||
-rw-r--r-- | src/pkg/syscall/types_darwin_386.c | 1 | ||||
-rw-r--r-- | src/pkg/syscall/types_darwin_amd64.c | 1 | ||||
-rw-r--r-- | src/pkg/syscall/types_linux.c | 2 | ||||
-rw-r--r-- | src/pkg/syscall/types_linux_386.c | 1 | ||||
-rw-r--r-- | src/pkg/syscall/types_linux_amd64.c | 1 | ||||
-rw-r--r-- | src/pkg/syscall/ztypes_darwin_386.go | 2 | ||||
-rw-r--r-- | src/pkg/syscall/ztypes_darwin_amd64.go | 2 | ||||
-rw-r--r-- | src/pkg/syscall/ztypes_linux_386.go | 28 | ||||
-rw-r--r-- | src/pkg/syscall/ztypes_linux_amd64.go | 26 |
15 files changed, 48 insertions, 56 deletions
diff --git a/src/cmd/godefs/main.c b/src/cmd/godefs/main.c index 02912f200..f6531ad8e 100644 --- a/src/cmd/godefs/main.c +++ b/src/cmd/godefs/main.c @@ -149,6 +149,7 @@ main(int argc, char **argv) { int p[2], pid, i, j, n, off, npad, prefix; char **av, *q, *r, *tofree, *name; + char nambuf[100]; Biobuf *bin, *bout; Type *t; Field *f; @@ -371,6 +372,10 @@ main(int argc, char **argv) name = f->name; if(cutprefix(name)) name += prefix; + if(strcmp(name, "") == 0) { + snprint(nambuf, sizeof nambuf, "Pad%d", npad++); + name = nambuf; + } Bprint(bout, "\t%lT;\n", name, f->type); if(t->kind == Union && lang == &go) break; @@ -531,6 +536,10 @@ cutprefix(char *name) { char *p; + // special case: orig_ in register struct + if(strncmp(name, "orig_", 5) == 0) + return 0; + for(p=name; *p; p++) { if(*p == '_') return p-name > 0; diff --git a/src/pkg/syscall/Makefile b/src/pkg/syscall/Makefile index 2800a8470..969cd0def 100644 --- a/src/pkg/syscall/Makefile +++ b/src/pkg/syscall/Makefile @@ -18,6 +18,5 @@ GOFILES=\ OFILES=\ asm_$(GOOS)_$(GOARCH).$O\ - types_$(GOOS)_$(GOARCH).$O\ include $(GOROOT)/src/Make.pkg diff --git a/src/pkg/syscall/PORT.sh b/src/pkg/syscall/PORT.sh index e7121c45b..3e165f87b 100755 --- a/src/pkg/syscall/PORT.sh +++ b/src/pkg/syscall/PORT.sh @@ -54,11 +54,6 @@ # there is almost always a #define that can get the real ones. # See types_darwin.c and types_linux.c for examples. # -# * types_${GOOS}_${GOARCH}.c -# -# Same as types_${GOOS}_${GOARCH}.go except that it contains -# definitions specific to ${GOOS} one one particular architecture. -# # * zerror_${GOOS}_${GOARCH}.go # # This machine-generated file defines the system's error numbers, @@ -117,9 +112,4 @@ esac echo "$mkerrors >zerrors_$GOOSARCH.go" echo "$mksyscall syscall_$GOOS.go syscall_$GOOSARCH.go >zsyscall_$GOOSARCH.go" echo "$mksysnum >zsysnum_$GOOSARCH.go" -echo "$mktypes types_$GOOS.c types_$GOOSARCH.c >ztypes_$GOOSARCH.go" - -port=$(ls *.go | grep -v _) -arch=$(ls *_$GOOSARCH.s *_$GOOSARCH.go *_$GOOS.go) -all=$(ls $port $arch) # sort them -echo gobuild $all +echo "$mktypes types_$GOOS.c >ztypes_$GOOSARCH.go" diff --git a/src/pkg/syscall/mkerrors.sh b/src/pkg/syscall/mkerrors.sh index 15835bdd6..661cd377d 100755 --- a/src/pkg/syscall/mkerrors.sh +++ b/src/pkg/syscall/mkerrors.sh @@ -43,7 +43,7 @@ godefs -gsyscall "$@" _errors.c # Run C program to print error strings. ( - echo " + /bin/echo " #include <stdio.h> #include <errno.h> #include <ctype.h> @@ -57,10 +57,12 @@ int errors[] = { " for i in $errors do - echo ' '$i, + /bin/echo ' '$i, done - echo ' + # Use /bin/echo to avoid builtin echo, + # which interprets \n itself + /bin/echo ' }; int @@ -89,5 +91,4 @@ main(void) ' ) >_errors.c -gcc -o _errors _errors.c && ./_errors -rm -f _errors.c _errors +gcc -o _errors _errors.c && ./_errors && rm -f _errors.c _errors diff --git a/src/pkg/syscall/mksyscall.sh b/src/pkg/syscall/mksyscall.sh index 0a2fb2055..07a28757d 100755 --- a/src/pkg/syscall/mksyscall.sh +++ b/src/pkg/syscall/mksyscall.sh @@ -171,10 +171,7 @@ print <<EOF; package syscall -import ( - "syscall"; - "unsafe"; -) +import "unsafe" $text diff --git a/src/pkg/syscall/types_darwin.c b/src/pkg/syscall/types_darwin.c index e205db155..4e9bf5b2e 100644 --- a/src/pkg/syscall/types_darwin.c +++ b/src/pkg/syscall/types_darwin.c @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. /* -Input to godefs. See PORT. +Input to godefs. See PORT.sh */ #define __DARWIN_UNIX03 0 diff --git a/src/pkg/syscall/types_darwin_386.c b/src/pkg/syscall/types_darwin_386.c deleted file mode 100644 index dd5356944..000000000 --- a/src/pkg/syscall/types_darwin_386.c +++ /dev/null @@ -1 +0,0 @@ -// Nothing to see here. diff --git a/src/pkg/syscall/types_darwin_amd64.c b/src/pkg/syscall/types_darwin_amd64.c deleted file mode 100644 index dd5356944..000000000 --- a/src/pkg/syscall/types_darwin_amd64.c +++ /dev/null @@ -1 +0,0 @@ -// Nothing to see here. diff --git a/src/pkg/syscall/types_linux.c b/src/pkg/syscall/types_linux.c index 234e5dd1e..d63e9983e 100644 --- a/src/pkg/syscall/types_linux.c +++ b/src/pkg/syscall/types_linux.c @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. /* -Input to godefs. See PORT. +Input to godefs. See PORT.sh */ #define _LARGEFILE_SOURCE diff --git a/src/pkg/syscall/types_linux_386.c b/src/pkg/syscall/types_linux_386.c deleted file mode 100644 index 3b5481af4..000000000 --- a/src/pkg/syscall/types_linux_386.c +++ /dev/null @@ -1 +0,0 @@ -// Nothing to see here diff --git a/src/pkg/syscall/types_linux_amd64.c b/src/pkg/syscall/types_linux_amd64.c deleted file mode 100644 index 3b5481af4..000000000 --- a/src/pkg/syscall/types_linux_amd64.c +++ /dev/null @@ -1 +0,0 @@ -// Nothing to see here diff --git a/src/pkg/syscall/ztypes_darwin_386.go b/src/pkg/syscall/ztypes_darwin_386.go index 87bca145f..a3fad0da7 100644 --- a/src/pkg/syscall/ztypes_darwin_386.go +++ b/src/pkg/syscall/ztypes_darwin_386.go @@ -1,4 +1,4 @@ -// godefs -gsyscall -f-m32 types_darwin.c types_darwin_386.c +// godefs -gsyscall -f-m32 types_darwin.c // MACHINE GENERATED - DO NOT EDIT. diff --git a/src/pkg/syscall/ztypes_darwin_amd64.go b/src/pkg/syscall/ztypes_darwin_amd64.go index 81a556c82..2c888718c 100644 --- a/src/pkg/syscall/ztypes_darwin_amd64.go +++ b/src/pkg/syscall/ztypes_darwin_amd64.go @@ -1,4 +1,4 @@ -// godefs -gsyscall -f-m64 types_darwin.c types_darwin_amd64.c +// godefs -gsyscall -f-m64 types_darwin.c // MACHINE GENERATED - DO NOT EDIT. diff --git a/src/pkg/syscall/ztypes_linux_386.go b/src/pkg/syscall/ztypes_linux_386.go index a3b1e6b79..c038e0243 100644 --- a/src/pkg/syscall/ztypes_linux_386.go +++ b/src/pkg/syscall/ztypes_linux_386.go @@ -1,4 +1,4 @@ -// godefs -gsyscall -f-m32 types_linux.c types_linux_386.c +// godefs -gsyscall -f-m32 types_linux.c // MACHINE GENERATED - DO NOT EDIT. @@ -163,18 +163,18 @@ type Timex struct { Calcnt int32; Errcnt int32; Stbcnt int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; + Pad0 int32; + Pad1 int32; + Pad2 int32; + Pad3 int32; + Pad4 int32; + Pad5 int32; + Pad6 int32; + Pad7 int32; + Pad8 int32; + Pad9 int32; + Pad10 int32; + Pad11 int32; } type Time_t int32 @@ -314,7 +314,7 @@ type PtraceRegs struct { __fs uint16; Gs uint16; __gs uint16; - Eax int32; + Orig_eax int32; Eip int32; Cs uint16; __cs uint16; diff --git a/src/pkg/syscall/ztypes_linux_amd64.go b/src/pkg/syscall/ztypes_linux_amd64.go index 56211b4b9..cdf251fa8 100644 --- a/src/pkg/syscall/ztypes_linux_amd64.go +++ b/src/pkg/syscall/ztypes_linux_amd64.go @@ -1,4 +1,4 @@ -// godefs -gsyscall -f-m64 types_linux.c types_linux_amd64.c +// godefs -gsyscall -f-m64 types_linux.c // MACHINE GENERATED - DO NOT EDIT. @@ -166,18 +166,18 @@ type Timex struct { Calcnt int64; Errcnt int64; Stbcnt int64; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; - int32; + Pad3 int32; + Pad4 int32; + Pad5 int32; + Pad6 int32; + Pad7 int32; + Pad8 int32; + Pad9 int32; + Pad10 int32; + Pad11 int32; + Pad12 int32; + Pad13 int32; + Pad14 int32; } type Time_t int64 |