summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEden Li <eden.li@gmail.com>2009-11-17 23:42:21 -0800
committerEden Li <eden.li@gmail.com>2009-11-17 23:42:21 -0800
commitdaab757a6fa77ff08a76fa1307a0c5f1f15e5c42 (patch)
tree83aee58e8e85d137abe9f4d99757efecb5eb1d2f
parent6b8680a9827487a89fa737297260643b7bcdb001 (diff)
downloadgolang-daab757a6fa77ff08a76fa1307a0c5f1f15e5c42.tar.gz
cgo no longer translates function args that are void* into
unsafe.Pointer. Fixes issue 254. R=rsc http://codereview.appspot.com/157060 Committer: Russ Cox <rsc@golang.org>
-rw-r--r--src/cmd/cgo/gcc.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index d6b5c6bc8..79dcd29a9 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -552,7 +552,11 @@ func (c *typeConv) FuncArg(dtype dwarf.Type) *Type {
// is type T defined as *X, simulate a little of the
// laxness of C by making the argument *X instead of T.
if ptr, ok := base(dt.Type).(*dwarf.PtrType); ok {
- return c.Type(ptr)
+ // Unless the typedef happens to point to void* since
+ // Go has special rules around using unsafe.Pointer.
+ if _, void := base(ptr.Type).(*dwarf.VoidType); !void {
+ return c.Type(ptr)
+ }
}
}
return t;