mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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:
parent
1ef0e0ed2c
commit
2115f514d0
1 changed files with 5 additions and 1 deletions
|
|
@ -552,7 +552,11 @@ func (c *typeConv) FuncArg(dtype dwarf.Type) *Type {
|
||||||
// is type T defined as *X, simulate a little of the
|
// is type T defined as *X, simulate a little of the
|
||||||
// laxness of C by making the argument *X instead of T.
|
// laxness of C by making the argument *X instead of T.
|
||||||
if ptr, ok := base(dt.Type).(*dwarf.PtrType); ok {
|
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;
|
return t;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue