1
0
mirror of https://github.com/golang/go synced 2024-11-15 06:00:30 -07:00
go/misc/cgo
Andrew Gerrand 6ec8f31510 [release-branch.go1.2] cmd/cgo: fix handling of array of pointers when using clang
««« CL 22840043 / e6794866ebeb
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
»»»

R=golang-dev
CC=golang-dev
https://golang.org/cl/25460046
2013-11-13 14:33:38 +11:00
..
errors [release-branch.go1.2] cmd/cgo: fix line number in an error message 2013-11-01 11:06:07 +11:00
gmp
life
stdio
test [release-branch.go1.2] cmd/cgo: stop using compiler error message text to analyze C names 2013-11-01 11:05:17 +11:00
testasan
testcdefs [release-branch.go1.2] cmd/cgo: fix handling of array of pointers when using clang 2013-11-13 14:33:38 +11:00
testso cgo: enable cgo on dragonfly 2013-09-04 15:19:21 -07:00
testtls