From: Ian Lance Taylor Date: Tue, 10 Mar 2020 04:33:35 +0000 (-0700) Subject: cmd/cgo: always produce a parameter name for C code X-Git-Tag: go1.15beta1~910 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=38ad3baf0054e926136d8a2cfe6458f41b544841;p=gostls13.git 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 Reviewed-by: Keith Randall TryBot-Result: Gobot Gobot --- diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go index 1518e5fab8..6b40a255d5 100644 --- a/src/cmd/cgo/out.go +++ b/src/cmd/cgo/out.go @@ -809,6 +809,10 @@ func (p *Package) packedAttribute() string { // the value of position; otherwise, this function will return the // value of param. func exportParamName(param string, position int) string { + if param == "" { + return fmt.Sprintf("p%d", position) + } + pname := param for i := 0; i < len(param); i++ {