From daab757a6fa77ff08a76fa1307a0c5f1f15e5c42 Mon Sep 17 00:00:00 2001 From: Eden Li Date: Tue, 17 Nov 2009 23:42:21 -0800 Subject: 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 --- src/cmd/cgo/gcc.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- cgit v1.2.3