]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: always produce a parameter name for C code
authorIan Lance Taylor <iant@golang.org>
Tue, 10 Mar 2020 04:33:35 +0000 (21:33 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 10 Mar 2020 04:53:34 +0000 (04:53 +0000)
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>

src/cmd/cgo/out.go

index 1518e5fab8550c7319b22194cb7f6e299eefba0a..6b40a255d505f1693152eded090611ff704998a0 100644 (file)
@@ -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++ {