Hi,

On Fri, Nov 19, 2010 at 10:43 PM, Arnaud Lacombe <lacom...@gmail.com> wrote:
> ok, this last one is a classic use of non-standard extension of GNU
> sed I should be able to fix it. It might not be clean, though.
>
Here we go, most redefinition fixed by the attached patch.

Remaining error are:

sysinfo.go:3034:6: error: invalid recursive type
sysinfo.go:3041:6: error: invalid recursive type
sysinfo.go:3042:6: error: invalid recursive type
sysinfo.go:2874:13: error: use of undefined type 'func___sighandler_t'
../../../gcc/libgo/syscalls/exec.go:52:6: error: reference to
undefined name 'libc_ptrace'
../../../gcc/libgo/syscalls/exec.go:52:18: error: reference to
undefined name '_PTRACE_TRACEME'
../../../gcc/libgo/syscalls/socket_linux.go:139:42: error: reference
to undefined name 'SO_BINDTODEVICE'
sysinfo.go:2721:27: error: use of undefined type '___va_list_tag'
sysinfo.go:2874:13: error: use of undefined type 'func___sighandler_t'
sysinfo.go:2877:23: error: struct field type is incomplete
sysinfo.go:2913:30: error: use of undefined type '_user_segment_descriptor'
sysinfo.go:2913:27: error: struct field type is incomplete
sysinfo.go:2913:30: error: use of undefined type '_user_segment_descriptor'
sysinfo.go:2914:372: error: struct field type is incomplete
sysinfo.go:2915:113: error: use of undefined type '_region_descriptor'
sysinfo.go:2915:113: error: use of undefined type '_region_descriptor'
sysinfo.go:2915:113: error: use of undefined type '_region_descriptor'
sysinfo.go:2915:104: error: struct field type is incomplete
sysinfo.go:2991:52: error: use of undefined type '_system_segment_descriptor'
sysinfo.go:2991:42: error: struct field type is incomplete
../../../gcc/libgo/syscalls/sysfile_posix.go:20:33: error: use of
undefined type 'Stat_t'
../../../gcc/libgo/syscalls/sysfile_posix.go:20:33: error: use of
undefined type 'Stat_t'
../../../gcc/libgo/syscalls/sysfile_posix.go:20:33: error: use of
undefined type 'Stat_t'
sysinfo.go:2833:16: error: use of undefined type '___timer'
sysinfo.go:2834:14: error: use of undefined type '___mq'
sysinfo.go:2879:20: error: use of undefined type '_pthread'


../../../gcc/libgo/syscalls/exec.go:52:6: error: reference to
undefined name 'libc_ptrace'
../../../gcc/libgo/syscalls/exec.go:52:18: error: reference to
undefined name '_PTRACE_TRACEME'

maybe this would need to go in exec_linux.go

../../../gcc/libgo/syscalls/socket_linux.go:139:42: error: reference
to undefined name 'SO_BINDTODEVICE'

is a Makefile's magic nits to make it use socket_bsd.go as for RTEMS

../../../gcc/libgo/syscalls/sysfile_posix.go:20:33: error: use of
undefined type 'Stat_t'
../../../gcc/libgo/syscalls/sysfile_posix.go:20:33: error: use of
undefined type 'Stat_t'
../../../gcc/libgo/syscalls/sysfile_posix.go:20:33: error: use of
undefined type 'Stat_t'

is due to gccgo unable to understand FreeBSD `struct stat', and they
use bitfields at the end of the structure for padding:

struct stat {
[...]
#if __BSD_VISIBLE
        struct timespec st_birthtimespec; /* time of file creation */
        /*
         * Explicitly pad st_birthtimespec to 16 bytes so that the size of
         * struct stat is backwards compatible.  We use bitfields instead
         * of an array of chars so that this doesn't require a C99 compiler
         * to compile if the size of the padding is 0.  We use 2 bitfields
         * to cover up to 64 bits on 32-bit machines.  We assume that
         * CHAR_BIT is 8...
         */
        unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
        unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec));
#else
        time_t    st_birthtime;         /* time of file creation */
        long      st_birthtimensec;     /* nsec of file creation */
        unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
        unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec));
#endif
};

Which result in:

% grep 'type _stat ' gen-sysinfo.go
// type _stat struct { st_dev uint32; st_ino uint32; st_mode uint16;
st_nlink uint16; st_uid uint32; st_gid uint32; st_rdev uint32;
st_atimespec _timespec; st_mtimespec _timespec; st_ctimespec
_timespec; st_size int64; st_blocks int64; st_blksize uint32; st_flags
uint32; st_gen uint32; st_lspare int32; st_birthtimespec _timespec;
_f0 INVALID-bit-field; _f1 INVALID-bit-field; }

However, gcc trunk' C fe is able to parse this definition.

continuing to dig for other errors.

 - Arnaud

Attachment: 0001-libgo-fix-non-portable-usage-of-GNU-sed.patch
Description: Binary data

Reply via email to