1
0
mirror of https://github.com/golang/go synced 2024-09-23 15:30:17 -06:00
go/misc
Austin Clements f423d616b1 cmd/cgo: fix initialization of empty argument types
CL 258938 changed the way C to Go calls work such that they now
construct a C struct on the C side for the arguments and space for the
results. Any pointers in the result space must be zeroed, so we just
zero the whole struct.

However, C makes it surprisingly hard to robustly zero any struct
type. We had used a "{0}" initializer, which works in the vast
majority of cases, but fails if the type is empty or effectively
empty.

This CL fixes this by changing how the cgo tool zero-initializes the
argument struct to be more robust.

Fixes #42495.

Change-Id: Id1749b9d751e59eb7a02a9d44fec0698a2bf63cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/269337
Trust: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-11-13 15:15:15 +00:00
..
android misc/android: fix a typo in README 2019-05-17 06:01:17 +00:00
arm all: make copyright headers consistent with one space after period 2016-05-02 13:43:18 +00:00
cgo cmd/cgo: fix initialization of empty argument types 2020-11-13 15:15:15 +00:00
chrome/gophertool misc/chrome/gophertool: replace deprecated tabs.getSelected method 2019-11-18 18:14:37 +00:00
ios misc/ios: fixup review comments from CL 255257 2020-10-05 16:04:18 +00:00
linkcheck
reboot misc: remove use of relative directories in overlayDir functions 2019-11-25 16:26:15 +00:00
swig cmd/go: fix swig support and run swig tests during run.bash 2017-11-16 17:19:19 +00:00
trace cmd/trace: update to use WebComponents V0 polyfill 2020-02-20 19:12:11 +00:00
wasm misc/wasm: check type of argument to Go.run 2020-11-02 13:02:40 +00:00
editors
go.mod misc: add go.mod file 2019-02-27 17:47:31 +00:00