Skip to content

Commit

Permalink
cmd/cgo: remove unnecessary space in cgo export header
Browse files Browse the repository at this point in the history
The cgo header has an unnecessary space in the exported function
definition on non-windows goos.

This was introduced in go1.16 so it would be good to fix it before
release.

Example:

// Current behavior, notice there is an unecessary space
// between extern and void
extern  void Foo();

// With this CL
extern void Foo();

Change-Id: Ic2c21f8d806fe35a7be7183dbfe35ac605b6e4f6
Reviewed-on: https://go-review.googlesource.com/c/go/+/283892
Reviewed-by: Ian Lance Taylor <[email protected]>
Trust: Katie Hockman <[email protected]>
  • Loading branch information
qmuntal authored and ianlancetaylor committed Jan 14, 2021
1 parent 0c86b99 commit 84e8a06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cmd/cgo/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -953,9 +953,9 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
// Build the wrapper function compiled by gcc.
gccExport := ""
if goos == "windows" {
gccExport = "__declspec(dllexport)"
gccExport = "__declspec(dllexport) "
}
s := fmt.Sprintf("%s %s %s(", gccExport, gccResult, exp.ExpName)
s := fmt.Sprintf("%s%s %s(", gccExport, gccResult, exp.ExpName)
if fn.Recv != nil {
s += p.cgoType(fn.Recv.List[0].Type).C.String()
s += " recv"
Expand Down

0 comments on commit 84e8a06

Please sign in to comment.