aboutsummaryrefslogtreecommitdiff
path: root/src/encoding
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2015-07-29 22:04:09 -0700
committerIan Lance Taylor <iant@golang.org>2015-07-30 15:55:25 +0000
commit7904946eeb35faece61bbf6f5b3cc8be2f519c17 (patch)
tree25a3d8c38ca385f79943d5b6bbc57fffd47992af /src/encoding
parentc9d2c7f0d26a9619069a3cb2291333174b6db63f (diff)
downloadgo-7904946eeb35faece61bbf6f5b3cc8be2f519c17.tar.xz
cmd/cgo: discard trailing zero-sized fields in a non-empty C struct
In order to fix issue #9401 the compiler was changed to add a padding byte to any non-empty Go struct that ends in a zero-sized field. That causes the Go version of such a C struct to have a different size than the C struct, which can considerable confusion. Change cgo so that it discards any such zero-sized fields, so that the Go and C structs are the same size. This is a change from previous releases, in that it used to be possible to refer to a zero-sized trailing field (by taking its address), and with this change it no longer is. That is unfortunate, but something has to change. It seems better to visibly break programs that do this rather than to silently break programs that rely on the struct sizes being the same. Update #9401. Fixes #11925. Change-Id: I3fba3f02f11265b3c41d68616f79dedb05b81225 Reviewed-on: https://go-review.googlesource.com/12864 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/encoding')
0 files changed, 0 insertions, 0 deletions