1
0
mirror of https://github.com/golang/go synced 2024-11-25 09:57:57 -07:00

cgo: silence warning for C call returning const pointer

Fix suggested by Albert Strasheim.

R=adg
CC=golang-dev
https://golang.org/cl/2154041
This commit is contained in:
Russ Cox 2010-09-07 09:54:20 -04:00
parent fa92b113b1
commit 2eb00d57b4

View File

@ -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 {