1
0
mirror of https://github.com/golang/go synced 2024-11-20 07:24:40 -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,9 +552,13 @@ 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 {
// 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;
}