1
0
mirror of https://github.com/golang/go synced 2024-11-20 09:44:45 -07:00

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
This commit is contained in:
Russ Cox 2009-08-24 11:03:23 -07:00
parent 1f177cd8b2
commit 9feee91d79
15 changed files with 48 additions and 56 deletions

View File

@ -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;

View File

@ -18,6 +18,5 @@ GOFILES=\
OFILES=\
asm_$(GOOS)_$(GOARCH).$O\
types_$(GOOS)_$(GOARCH).$O\
include $(GOROOT)/src/Make.pkg

View File

@ -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"

View File

@ -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

View File

@ -171,10 +171,7 @@ print <<EOF;
package syscall
import (
"syscall";
"unsafe";
)
import "unsafe"
$text

View File

@ -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

View File

@ -1 +0,0 @@
// Nothing to see here.

View File

@ -1 +0,0 @@
// Nothing to see here.

View File

@ -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

View File

@ -1 +0,0 @@
// Nothing to see here

View File

@ -1 +0,0 @@
// Nothing to see here

View File

@ -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.

View File

@ -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.

View File

@ -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;

View File

@ -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