Commit 2115f514 authored by Eden Li's avatar Eden Li Committed by Russ Cox

cgo no longer translates function args that are void* into

unsafe.Pointer.
Fixes #254.

R=rsc
https://golang.org/cl/157060
parent 1ef0e0ed
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment