]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo: explicitly use void for functions with no parameters
authorMauri de Souza Meneguzzo <mauri870@gmail.com>
Mon, 17 Feb 2025 13:57:12 +0000 (13:57 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 18 Feb 2025 17:27:34 +0000 (09:27 -0800)
commit896de17f8069626f8e52b662c0d5a46ee9cac699
treec301beb18c99c35fafb44d083b522462b068f0de
parenta73c6545d27afaad631ba2f5c593ab3a97d11bdc
cmd/cgo: explicitly use void for functions with no parameters

Currently, exported Go functions with no parameters generate C functions
with an empty parameter list. In C, a function with an empty parameter
list can accept any number of arguments, whereas a function with a single
void parameter explicitly declares that it takes no arguments.

To align the generated C functions with their Go prototypes, update the
code generation to explicitly include a void parameter for functions
with no parameters.

Fixes #68411

Change-Id: Iab9456aa0236200bf21d1181a2e18e82869df63f
GitHub-Last-Rev: 6ff21a98dfef81df649c76221d9c0858dc0e35e1
GitHub-Pull-Request: golang/go#70981
Reviewed-on: https://go-review.googlesource.com/c/go/+/638635
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/cmd/cgo/internal/testcshared/cshared_test.go
src/cmd/cgo/internal/testcshared/testdata/issue68411/issue68411.go [new file with mode: 0644]
src/cmd/cgo/out.go