From: Russ Cox Date: Tue, 7 Sep 2010 13:54:20 +0000 (-0400) Subject: cgo: silence warning for C call returning const pointer X-Git-Tag: weekly.2010-09-15~105 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2eb00d57b40a7f806fd611c2303289bb11f77d15;p=gostls13.git cgo: silence warning for C call returning const pointer Fix suggested by Albert Strasheim. R=adg CC=golang-dev https://golang.org/cl/2154041 --- diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index 906b2c511f..eb39338684 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -107,7 +107,11 @@ func (p *Package) structType(n *Name) (string, int64) { fmt.Fprintf(&buf, "\t\tchar __pad%d[%d];\n", off, pad) off += pad } - fmt.Fprintf(&buf, "\t\t%s r;\n", t.C) + qual := "" + if t.C[len(t.C)-1] == '*' { + qual = "const " + } + fmt.Fprintf(&buf, "\t\t%s%s r;\n", qual, t.C) off += t.Size } if off%p.PtrSize != 0 {