-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: can generate functions with unused variables #6883
Comments
I just ran into this issue in 1.10.
|
@cstyan Can you show us how to reproduce the problem? Thanks. |
@ianlancetaylor I'll try to reproduce but I only saw this once so far. The code is all internal where I work and the build that failed with functions that had unused variables was in a Travis CI build. Not sure if this is relevant, but the C functions that cgo generated with unused variables were all in C files, not in C code at the top of a Go file. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
To reproduce: main.go:
Run:
Output:
|
@conradoplg Do not use |
@ianlancetaylor that's the issue, isn't it? (Maybe it's not exactly the same as OP's, but seems related). It appears fixable, since it's just this warning, but I understand if zero warnings is not a goal for Go. |
Zero warnings can't be a goal. The warnings change over time, and the mechanisms required to avoid the warnings change over time. We have no idea which version of which C compiler will be used. I'm happy to accept simple fixes to avoid warnings that are guaranteed to to work with all compiler versions. It's not something I'll work on myself. And I would not accept test cases that just add |
by vbatts:
The text was updated successfully, but these errors were encountered: