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

Closed
FlorianUekermann opened this issue Oct 9, 2018 · 2 comments
Closed

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

FlorianUekermann opened this issue Oct 9, 2018 · 2 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@FlorianUekermann
Copy link
Contributor

using cgo with:

CC=clang
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 help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Oct 9, 2018
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Oct 9, 2018
@ianlancetaylor
Copy link
Contributor

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.

@gopherbot
Copy link

Change https://golang.org/cl/140797 mentions this issue: runtime/cgo: Annotate unused vairable with __attribute__((unused))

@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.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants