From 10d1680efb10333f1e8280b1f812dd83ca9b0eee Mon Sep 17 00:00:00 2001 From: Albert Strasheim Date: Thu, 21 Apr 2011 17:02:52 -0400 Subject: [PATCH] cgo: avoid "incompatible pointer type" warning R=rsc CC=golang-dev https://golang.org/cl/4409041 --- src/cmd/cgo/out.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index abf8c8bc203..bbc319f103c 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -312,8 +312,11 @@ func (p *Package) writeOutputFunc(fgcc *os.File, n *Name) { } fmt.Fprintf(fgcc, "\t%s *a = v;\n", ctype) fmt.Fprintf(fgcc, "\t") - if n.FuncType.Result != nil { + if t := n.FuncType.Result; t != nil { fmt.Fprintf(fgcc, "a->r = ") + if c := t.C.String(); c[len(c)-1] == '*' { + fmt.Fprintf(fgcc, "(const %s) ", t.C) + } } fmt.Fprintf(fgcc, "%s(", n.C) for i := range n.FuncType.Params {