]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: avoid "incompatible pointer type" warning
authorAlbert Strasheim <fullung@gmail.com>
Thu, 21 Apr 2011 21:02:52 +0000 (17:02 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 21 Apr 2011 21:02:52 +0000 (17:02 -0400)
R=rsc
CC=golang-dev
https://golang.org/cl/4409041

src/cmd/cgo/out.go

index abf8c8bc203f975126882160cba2dda00dbd15b6..bbc319f103c1e65431d7bd8126ebfa78b91357ff 100644 (file)
@@ -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 {