1
0
mirror of https://github.com/golang/go synced 2024-11-20 04:54:44 -07:00

cgo no longer translates function args that are void* into

unsafe.Pointer.
Fixes #254.

R=rsc
https://golang.org/cl/157060
This commit is contained in:
Eden Li 2009-11-17 23:42:21 -08:00 committed by Russ Cox
parent 1ef0e0ed2c
commit 2115f514d0

View File

@ -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;