From: Eden Li Date: Wed, 18 Nov 2009 07:42:21 +0000 (-0800) Subject: cgo no longer translates function args that are void* into X-Git-Tag: weekly.2009-12-07~225 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2115f514d047df9c0e7679e2d0df05781b4b961c;p=gostls13.git cgo no longer translates function args that are void* into unsafe.Pointer. Fixes #254. R=rsc https://golang.org/cl/157060 --- 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;