mirror of
https://github.com/golang/go
synced 2024-09-29 22:34:33 -06:00
f2f17c0ff2
Update #6677 When a struct contains an anonymous union, use the type and name of the first field in the union. This should make the glibc <sys/resource.h> file work; in that file struct rusage has fields like __extension__ union { long int ru_maxrss; __syscall_slong_t __ru_maxrss_word; }; in which the field that matters is ru_maxrss and __ru_maxrss_word just exists to advance to the next field on systems where the kernel uses long long fields but userspace expects long fields. LGTM=mikioh.mikioh R=golang-codereviews, mikioh.mikioh CC=golang-codereviews https://golang.org/cl/106260044
21 lines
549 B
Bash
Executable File
21 lines
549 B
Bash
Executable File
# Copyright 2014 The Go Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style
|
|
# license that can be found in the LICENSE file.
|
|
|
|
# We are testing cgo -godefs, which translates Go files that use
|
|
# import "C" into Go files with Go definitions of types defined in the
|
|
# import "C" block. Add more tests here.
|
|
FILE_PREFIXES="anonunion"
|
|
|
|
RM=
|
|
for FP in $FILE_PREFIXES
|
|
do
|
|
go tool cgo -godefs ${FP}.go > ${FP}_defs.go
|
|
RM="${RM} ${FP}_defs.go"
|
|
done
|
|
|
|
go build . && ./testgodefs
|
|
EXIT=$?
|
|
rm -rf _obj testgodefs ${RM}
|
|
exit $EXIT
|