From 05c70485e187e3668b7ddc2fd59860e22dd96201 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Wed, 6 Aug 2014 10:28:19 -0700 Subject: cmd/cgo: consistently map void* to *byte under -{c,go}defs Fixes issue 8478. LGTM=iant R=iant CC=golang-codereviews https://codereview.appspot.com/122150043 Committer: Ian Lance Taylor --- misc/cgo/testgodefs/issue8478.go | 20 ++++++++++++++++++++ misc/cgo/testgodefs/main.go | 3 +++ misc/cgo/testgodefs/test.bash | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 misc/cgo/testgodefs/issue8478.go (limited to 'misc') diff --git a/misc/cgo/testgodefs/issue8478.go b/misc/cgo/testgodefs/issue8478.go new file mode 100644 index 000000000..92258fde7 --- /dev/null +++ b/misc/cgo/testgodefs/issue8478.go @@ -0,0 +1,20 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// +// +build ignore + +package main + +// Issue 8478. Test that void* is consistently mapped to *byte. + +/* +typedef struct { + void *p; + void **q; + void ***r; +} s; +*/ +import "C" + +type Issue8478 C.s diff --git a/misc/cgo/testgodefs/main.go b/misc/cgo/testgodefs/main.go index eaf91bc11..7faccf265 100644 --- a/misc/cgo/testgodefs/main.go +++ b/misc/cgo/testgodefs/main.go @@ -8,5 +8,8 @@ package main var v1 T var v2 = v1.L +// Test that P, Q, and R all point to byte. +var v3 = Issue8478{P: (*byte)(nil), Q: (**byte)(nil), R: (***byte)(nil)} + func main() { } diff --git a/misc/cgo/testgodefs/test.bash b/misc/cgo/testgodefs/test.bash index cfbeae7dc..5281b1056 100755 --- a/misc/cgo/testgodefs/test.bash +++ b/misc/cgo/testgodefs/test.bash @@ -5,7 +5,7 @@ # We are testing cgo -godefs, which translates Go files that use # import "C" into Go files with Go definitions of types defined in the # import "C" block. Add more tests here. -FILE_PREFIXES="anonunion" +FILE_PREFIXES="anonunion issue8478" RM= for FP in $FILE_PREFIXES -- cgit v1.2.1