mirror of
https://github.com/golang/go.git
synced 2025-05-21 15:24:21 +00: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:
parent
1f177cd8b2
commit
9feee91d79
@ -149,6 +149,7 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int p[2], pid, i, j, n, off, npad, prefix;
|
int p[2], pid, i, j, n, off, npad, prefix;
|
||||||
char **av, *q, *r, *tofree, *name;
|
char **av, *q, *r, *tofree, *name;
|
||||||
|
char nambuf[100];
|
||||||
Biobuf *bin, *bout;
|
Biobuf *bin, *bout;
|
||||||
Type *t;
|
Type *t;
|
||||||
Field *f;
|
Field *f;
|
||||||
@ -371,6 +372,10 @@ main(int argc, char **argv)
|
|||||||
name = f->name;
|
name = f->name;
|
||||||
if(cutprefix(name))
|
if(cutprefix(name))
|
||||||
name += prefix;
|
name += prefix;
|
||||||
|
if(strcmp(name, "") == 0) {
|
||||||
|
snprint(nambuf, sizeof nambuf, "Pad%d", npad++);
|
||||||
|
name = nambuf;
|
||||||
|
}
|
||||||
Bprint(bout, "\t%lT;\n", name, f->type);
|
Bprint(bout, "\t%lT;\n", name, f->type);
|
||||||
if(t->kind == Union && lang == &go)
|
if(t->kind == Union && lang == &go)
|
||||||
break;
|
break;
|
||||||
@ -531,6 +536,10 @@ cutprefix(char *name)
|
|||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
// special case: orig_ in register struct
|
||||||
|
if(strncmp(name, "orig_", 5) == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
for(p=name; *p; p++) {
|
for(p=name; *p; p++) {
|
||||||
if(*p == '_')
|
if(*p == '_')
|
||||||
return p-name > 0;
|
return p-name > 0;
|
||||||
|
@ -18,6 +18,5 @@ GOFILES=\
|
|||||||
|
|
||||||
OFILES=\
|
OFILES=\
|
||||||
asm_$(GOOS)_$(GOARCH).$O\
|
asm_$(GOOS)_$(GOARCH).$O\
|
||||||
types_$(GOOS)_$(GOARCH).$O\
|
|
||||||
|
|
||||||
include $(GOROOT)/src/Make.pkg
|
include $(GOROOT)/src/Make.pkg
|
||||||
|
@ -54,11 +54,6 @@
|
|||||||
# there is almost always a #define that can get the real ones.
|
# there is almost always a #define that can get the real ones.
|
||||||
# See types_darwin.c and types_linux.c for examples.
|
# 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
|
# * zerror_${GOOS}_${GOARCH}.go
|
||||||
#
|
#
|
||||||
# This machine-generated file defines the system's error numbers,
|
# This machine-generated file defines the system's error numbers,
|
||||||
@ -117,9 +112,4 @@ esac
|
|||||||
echo "$mkerrors >zerrors_$GOOSARCH.go"
|
echo "$mkerrors >zerrors_$GOOSARCH.go"
|
||||||
echo "$mksyscall syscall_$GOOS.go syscall_$GOOSARCH.go >zsyscall_$GOOSARCH.go"
|
echo "$mksyscall syscall_$GOOS.go syscall_$GOOSARCH.go >zsyscall_$GOOSARCH.go"
|
||||||
echo "$mksysnum >zsysnum_$GOOSARCH.go"
|
echo "$mksysnum >zsysnum_$GOOSARCH.go"
|
||||||
echo "$mktypes types_$GOOS.c types_$GOOSARCH.c >ztypes_$GOOSARCH.go"
|
echo "$mktypes types_$GOOS.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
|
|
||||||
|
@ -43,7 +43,7 @@ godefs -gsyscall "$@" _errors.c
|
|||||||
|
|
||||||
# Run C program to print error strings.
|
# Run C program to print error strings.
|
||||||
(
|
(
|
||||||
echo "
|
/bin/echo "
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -57,10 +57,12 @@ int errors[] = {
|
|||||||
"
|
"
|
||||||
for i in $errors
|
for i in $errors
|
||||||
do
|
do
|
||||||
echo ' '$i,
|
/bin/echo ' '$i,
|
||||||
done
|
done
|
||||||
|
|
||||||
echo '
|
# Use /bin/echo to avoid builtin echo,
|
||||||
|
# which interprets \n itself
|
||||||
|
/bin/echo '
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -89,5 +91,4 @@ main(void)
|
|||||||
'
|
'
|
||||||
) >_errors.c
|
) >_errors.c
|
||||||
|
|
||||||
gcc -o _errors _errors.c && ./_errors
|
gcc -o _errors _errors.c && ./_errors && rm -f _errors.c _errors
|
||||||
rm -f _errors.c _errors
|
|
||||||
|
@ -171,10 +171,7 @@ print <<EOF;
|
|||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
import (
|
import "unsafe"
|
||||||
"syscall";
|
|
||||||
"unsafe";
|
|
||||||
)
|
|
||||||
|
|
||||||
$text
|
$text
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to godefs. See PORT.
|
Input to godefs. See PORT.sh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define __DARWIN_UNIX03 0
|
#define __DARWIN_UNIX03 0
|
||||||
|
@ -1 +0,0 @@
|
|||||||
// Nothing to see here.
|
|
@ -1 +0,0 @@
|
|||||||
// Nothing to see here.
|
|
@ -3,7 +3,7 @@
|
|||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Input to godefs. See PORT.
|
Input to godefs. See PORT.sh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _LARGEFILE_SOURCE
|
#define _LARGEFILE_SOURCE
|
||||||
|
@ -1 +0,0 @@
|
|||||||
// Nothing to see here
|
|
@ -1 +0,0 @@
|
|||||||
// Nothing to see here
|
|
@ -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.
|
// MACHINE GENERATED - DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -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.
|
// MACHINE GENERATED - DO NOT EDIT.
|
||||||
|
|
||||||
|
@ -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.
|
// MACHINE GENERATED - DO NOT EDIT.
|
||||||
|
|
||||||
@ -163,18 +163,18 @@ type Timex struct {
|
|||||||
Calcnt int32;
|
Calcnt int32;
|
||||||
Errcnt int32;
|
Errcnt int32;
|
||||||
Stbcnt int32;
|
Stbcnt int32;
|
||||||
int32;
|
Pad0 int32;
|
||||||
int32;
|
Pad1 int32;
|
||||||
int32;
|
Pad2 int32;
|
||||||
int32;
|
Pad3 int32;
|
||||||
int32;
|
Pad4 int32;
|
||||||
int32;
|
Pad5 int32;
|
||||||
int32;
|
Pad6 int32;
|
||||||
int32;
|
Pad7 int32;
|
||||||
int32;
|
Pad8 int32;
|
||||||
int32;
|
Pad9 int32;
|
||||||
int32;
|
Pad10 int32;
|
||||||
int32;
|
Pad11 int32;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Time_t int32
|
type Time_t int32
|
||||||
@ -314,7 +314,7 @@ type PtraceRegs struct {
|
|||||||
__fs uint16;
|
__fs uint16;
|
||||||
Gs uint16;
|
Gs uint16;
|
||||||
__gs uint16;
|
__gs uint16;
|
||||||
Eax int32;
|
Orig_eax int32;
|
||||||
Eip int32;
|
Eip int32;
|
||||||
Cs uint16;
|
Cs uint16;
|
||||||
__cs uint16;
|
__cs uint16;
|
||||||
|
@ -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.
|
// MACHINE GENERATED - DO NOT EDIT.
|
||||||
|
|
||||||
@ -166,18 +166,18 @@ type Timex struct {
|
|||||||
Calcnt int64;
|
Calcnt int64;
|
||||||
Errcnt int64;
|
Errcnt int64;
|
||||||
Stbcnt int64;
|
Stbcnt int64;
|
||||||
int32;
|
Pad3 int32;
|
||||||
int32;
|
Pad4 int32;
|
||||||
int32;
|
Pad5 int32;
|
||||||
int32;
|
Pad6 int32;
|
||||||
int32;
|
Pad7 int32;
|
||||||
int32;
|
Pad8 int32;
|
||||||
int32;
|
Pad9 int32;
|
||||||
int32;
|
Pad10 int32;
|
||||||
int32;
|
Pad11 int32;
|
||||||
int32;
|
Pad12 int32;
|
||||||
int32;
|
Pad13 int32;
|
||||||
int32;
|
Pad14 int32;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Time_t int64
|
type Time_t int64
|
||||||
|
Loading…
x
Reference in New Issue
Block a user