|
|
Descriptioncmd/cgo: do not output empty struct for -cdefs
Patch Set 1 #Patch Set 2 : diff -r 2d4825868d95 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r 2d4825868d95 https://go.googlecode.com/hg/ #Patch Set 4 : diff -r a1fb1560e22e https://go.googlecode.com/hg/ #Patch Set 5 : diff -r e9e3359d9c84 https://go.googlecode.com/hg/ #MessagesTotal messages: 14
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
Sign in to reply to this message.
What empty struct is avoided in the regenerated output files?
Sign in to reply to this message.
These are the diffs for defs_windows_386.h (and defs_windows_amd64.h) files
generated with current cgo command and proposed changed one:
# diff defs_windows_amd64.h ~/cl9574043/src/pkg/runtime/defs_windows_amd64.h
64,65d63
< struct FloatingSaveArea {
< };
# diff defs_windows_386.h ~/cl9574043/src/pkg/runtime/defs_windows_386.h
74,75d73
< struct M128a {
< };
#
It seems FloatingSaveArea and M128a are ARCH specific. They are not used
directly by our code, but they are embeded in other structs. They are present in
defs_windows.go, because cgo doesn't do recursion to discover embeded structs.
I suppose, FloatingSaveArea and M128a can be moved into ARCH specific file like
defs_windows_386.go and defs_windows_amd64.go, but I think it just complicates
things more.
I can just abandon this CL altogether. But I need more windows C structs for net
poller, and it bothers me that auto-generation does not work.
Alex
Sign in to reply to this message.
Are the empty structs a problem?
Sign in to reply to this message.
On 2013/05/23 04:40:47, iant wrote: > Are the empty structs a problem? Yes. These fail to compile. Alex
Sign in to reply to this message.
On 2013/05/23 04:41:32, brainman wrote: > On 2013/05/23 04:40:47, iant wrote: > > Are the empty structs a problem? > > Yes. These fail to compile. GCC permits empty structs, although I don't think they are in standard C. Are they failing with a non-GCC compiler?
Sign in to reply to this message.
On a separate topic, the changes to the defs files are large and in general have nothing to do with the change to cgo. Let's separate this CL from the CL that regenerates those files.
Sign in to reply to this message.
On 2013/05/23 04:50:42, iant wrote: > > GCC permits empty structs, although I don't think they are in standard C. Are > they failing with a non-GCC compiler? Yes. They fail with 8c: C:\go\root\src\pkg\runtime>go tool cgo -cdefs defs_windows.go > defs_windows_386.h C:\go\root\src\pkg\runtime>go install -v runtime # runtime C:\DOCUME~1\brainman\LOCALS~1\Temp\go-build165623463\runtime\_obj\/defs_GOOS_GOARCH.h:75 c:\go\root\src\pkg\runtime\callback_windows_386.c:8 syntax error, lastname: M128a Alex
Sign in to reply to this message.
On 2013/05/23 04:51:19, iant wrote: > On a separate topic, the changes to the defs files are large and in general have > nothing to do with the change to cgo. Let's separate this CL from the CL that > regenerates those files. Fair enough. I will remove them. But let's decide what to do first. Alex
Sign in to reply to this message.
On 2013/05/23 04:56:05, brainman wrote: > On 2013/05/23 04:51:19, iant wrote: > > On a separate topic, the changes to the defs files are large and in general > have > > nothing to do with the change to cgo. Let's separate this CL from the CL that > > regenerates those files. > > Fair enough. I will remove them. But let's decide what to do first. I'm fine with omitting empty structs from the generated C code. They are unlikely to be useful.
Sign in to reply to this message.
Hello golang-dev@googlegroups.com, iant@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
Sign in to reply to this message.
On 2013/05/23 04:51:19, iant wrote: > ... Let's separate this CL from the CL that > regenerates those files. Done https://codereview.appspot.com/9679046/ Alex
Sign in to reply to this message.
LGTM Before submitting please change CL description to cmd/cgo: do not output empty struct for -cdefs
Sign in to reply to this message.
*** Submitted as https://code.google.com/p/go/source/detail?r=2a106010f660 *** cmd/cgo: do not output empty struct for -cdefs R=golang-dev, iant CC=golang-dev https://codereview.appspot.com/9574043
Sign in to reply to this message.
|
