1
0
mirror of https://github.com/golang/go synced 2024-11-17 12:54:47 -07:00

cmd/cgo: always produce a parameter name for C code

Updates #37746

Change-Id: Ib64abe3995f310cd50ede47b0d3d159572901000
Reviewed-on: https://go-review.googlesource.com/c/go/+/222622
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2020-03-09 21:33:35 -07:00
parent 92d1fb7cb4
commit 38ad3baf00

View File

@ -809,6 +809,10 @@ func (p *Package) packedAttribute() string {
// the value of position; otherwise, this function will return the // the value of position; otherwise, this function will return the
// value of param. // value of param.
func exportParamName(param string, position int) string { func exportParamName(param string, position int) string {
if param == "" {
return fmt.Sprintf("p%d", position)
}
pname := param pname := param
for i := 0; i < len(param); i++ { for i := 0; i < len(param); i++ {