Commit 9f178edf authored by Gustavo Niemeyer's avatar Gustavo Niemeyer Committed by Russ Cox

cgo: export unsafe.Pointer as void*

This will enable functions which use unsafe.Pointer as an argument
to be correctly exported by cgo.

R=rsc
CC=golang-dev
https://golang.org/cl/3849043
parent 632be894
...@@ -606,6 +606,11 @@ func (p *Package) cgoType(e ast.Expr) *Type { ...@@ -606,6 +606,11 @@ func (p *Package) cgoType(e ast.Expr) *Type {
} }
return r return r
} }
case *ast.SelectorExpr:
id, ok := t.X.(*ast.Ident)
if ok && id.Name == "unsafe" && t.Sel.Name == "Pointer" {
return &Type{Size: p.PtrSize, Align: p.PtrSize, C: "void*"}
}
} }
error(e.Pos(), "unrecognized Go type %T", e) error(e.Pos(), "unrecognized Go type %T", e)
return &Type{Size: 4, Align: 4, C: "int"} return &Type{Size: 4, Align: 4, C: "int"}
......
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