1
0
mirror of https://github.com/golang/go synced 2024-10-04 08:31:22 -06:00
go/misc/cgo
Russ Cox 6be1cb8c7a cmd/cgo: fix handling of array of pointers when using clang
Clang does not record the "size" field for pointer types,
so we must insert the size ourselves. We were already
doing this, but only for the case of pointer types.
For an array of pointer types, the setting of the size for
the nested pointer type was happening after the computation
of the size of the array type, meaning that the array type
was always computed as 0 bytes. Delay the size computation.

This bug happens on all Clang systems, not just FreeBSD.
Our test checked that cgo wrote something, not that it was correct.
FreeBSD's default clang rejects array[0] as a C struct field,
so it noticed the incorrect sizes. But the sizes were incorrect
everywhere.

Update testcdefs to check the output has the right semantics.

Fixes #6292.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/22840043
2013-11-07 15:24:51 -05:00
..
errors cmd/cgo: fix line number in an error message 2013-10-18 16:52:44 -04:00
gmp misc/cgo/gmp: fix typo. 2013-03-30 19:02:14 +08:00
life misc/cgo: prepare for 64-bit ints 2012-09-24 14:58:45 -04:00
stdio misc/cgo/stdio: make it work on Windows and also test it 2012-09-20 00:27:23 +08:00
test cmd/cgo: stop using compiler error message text to analyze C names 2013-10-18 15:56:25 -04:00
testasan runtime: more flexible heap memory mapping on 64-bits 2013-06-12 18:47:16 +04:00
testcdefs cmd/cgo: fix handling of array of pointers when using clang 2013-11-07 15:24:51 -05:00
testso cgo: enable cgo on dragonfly 2013-09-04 15:19:21 -07:00
testtls cmd/ld: emit TLS relocations during external linking 2013-03-27 13:27:35 -07:00