From: Albert Strasheim Date: Thu, 21 Apr 2011 21:02:52 +0000 (-0400) Subject: cgo: avoid "incompatible pointer type" warning X-Git-Tag: weekly.2011-04-27~74 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=10d1680efb10333f1e8280b1f812dd83ca9b0eee;p=gostls13.git cgo: avoid "incompatible pointer type" warning R=rsc CC=golang-dev https://golang.org/cl/4409041 --- diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index abf8c8bc20..bbc319f103 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 {