]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo: special case C ptr types to use uintptr
authorKeith Randall <khr@golang.org>
Tue, 26 Sep 2017 22:14:50 +0000 (15:14 -0700)
committerKeith Randall <khr@golang.org>
Fri, 17 Nov 2017 22:11:03 +0000 (22:11 +0000)
commitb868616b63a82a4f5917400b2df63a19ebe041e2
treee07f6aca3643163ea9bb74053797a18f9f8e2bfe
parent644787c337f7fde20a0676f843bb12378c8f885e
cmd/cgo: special case C ptr types to use uintptr

Some C types are declared as pointers, but C code
stores non-pointers in them.  When the Go garbage
collector sees such a pointer, it gets unhappy.

Instead, for these types represent them on the Go
side with uintptr.

We need this change to handle Apple's CoreFoundation
CF*Ref types. Users of these types might need to
update their code like we do in root_cgo_darwin.go.
The only change that is required under normal
circumstances is converting some nils to 0.
A go fix module is provided to help.

Fixes #21897

RELNOTE=yes

Change-Id: I9716cfb255dc918792625f42952aa171cd31ec1b
Reviewed-on: https://go-review.googlesource.com/66332
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
misc/cgo/test/cgo_test.go
misc/cgo/test/issue21897.go [new file with mode: 0644]
misc/cgo/test/issue21897b.go [new file with mode: 0644]
src/cmd/cgo/doc.go
src/cmd/cgo/gcc.go
src/cmd/dist/test.go
src/cmd/fix/cftype.go [new file with mode: 0644]
src/cmd/fix/cftype_test.go [new file with mode: 0644]
src/cmd/fix/typecheck.go
src/crypto/x509/root_cgo_darwin.go