summaryrefslogtreecommitdiff
path: root/misc/cgo
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2014-08-06 10:28:19 -0700
committerMatthew Dempsky <mdempsky@google.com>2014-08-06 10:28:19 -0700
commit05c70485e187e3668b7ddc2fd59860e22dd96201 (patch)
treeebd08657dda566cb5abdcbc46b0c6828d4d1ee58 /misc/cgo
parentf82f00c2cae7801531ac66cb2096622c138c83a0 (diff)
downloadgo-05c70485e187e3668b7ddc2fd59860e22dd96201.tar.gz
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 <iant@golang.org>
Diffstat (limited to 'misc/cgo')
-rw-r--r--misc/cgo/testgodefs/issue8478.go20
-rw-r--r--misc/cgo/testgodefs/main.go3
-rwxr-xr-xmisc/cgo/testgodefs/test.bash2
3 files changed, 24 insertions, 1 deletions
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