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
translate-c generates zig code with unnecessary _ = foo;
statements for unused local variables and parameters
#9205
Comments
I think the |
Sounds good to me! |
Cool, can have that to you later tonight |
@andrewrk mostly done; however It translates to: Which causes
Even when the symbol is not otherwise referred to. Seems like I could either special case that particular macro (skip it) or look for ones that have a single |
Actually, one other issue which is the removal of packed/extern enums. I have a PR for that already - #9164 - should I bring that in as well? |
The intended solution for this is to use |
_ = foo;
statements for unused local variables and parameters
Is that expected to work now? I get the same error for
|
Oops, forgot to answer this question. I believe I fixed it in abfee12. |
I'm able to declare a public symbol with that commit (eg. pub export fn main() void {
var @"_": c_int = 5;
_ = @"_";
}
|
This code translates to:
If you try to compile it with self-hosted:
Instead it should generate:
However ideally it would keep track of which variables and parameters are used and not generate unnecessary
_ = foo;
statements.This is blocking #9191.
The text was updated successfully, but these errors were encountered: