aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorEden Li <eden.li@gmail.com>2009-11-17 23:42:21 -0800
committerRuss Cox <rsc@golang.org>2009-11-17 23:42:21 -0800
commit2115f514d047df9c0e7679e2d0df05781b4b961c (patch)
tree6e5c795a4b37f6c423709bf95e86dd891474c6aa /src/cmd
parent1ef0e0ed2c0402fb5b1f5122bfa4f9e77c0a91ce (diff)
downloadgo-2115f514d047df9c0e7679e2d0df05781b4b961c.tar.xz
cgo no longer translates function args that are void* into
unsafe.Pointer. Fixes #254. R=rsc https://golang.org/cl/157060
Diffstat (limited to 'src/cmd')
-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 d6b5c6bc85..79dcd29a96 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;