Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/cgo: warning on generated code when using -Wall #28095

FlorianUekermann opened this issue Oct 9, 2018 · 2 comments


Copy link

FlorianUekermann commented Oct 9, 2018

using cgo with:

CGO_CFLAGS=-std=gnu11 -march=native -O3 -g -fPIC -Wall -pedantic -Wextra -Werror

results in the following error for me:

# runtime/cgo
gcc_libinit.c:66:38: error: unused parameter 'dummy' [-Werror,-Wunused-parameter]

This is not a major issue, but it would be nice if we didn't have to add -Wno-unused-parameter, since the warning may be desired in other C code. Looking at the code, it seems as if dummy may as well be unnamed.

@ianlancetaylor ianlancetaylor changed the title cgo: -Wunused-parameter warning cmd/cgo: warning on generated code when using -Wall Oct 9, 2018
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Oct 9, 2018

This comment has been minimized.

Copy link

ianlancetaylor commented Oct 9, 2018

You can't simply leave the parameter unnamed, because this is C and C does not permit unnamed parameters. You have to mark the parameter with __attribute__((unused)). Patches welcome.


This comment has been minimized.

Copy link

gopherbot commented Oct 9, 2018

Change mentions this issue: runtime/cgo: Annotate unused vairable with __attribute__((unused))

@gopherbot gopherbot closed this in dc2ae28 Oct 10, 2018
@golang golang locked and limited conversation to collaborators Oct 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
3 participants
You can’t perform that action at this time.