-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Make translate-c use intermediate AST #7479
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
Conversation
9104244
to
8ec24e1
Compare
Will this by chance address #3453? |
Still working on this? Is there perhaps a way you can start the work in such a way that it doesn't have to be 100% completed before we can start utilizing it? That way we don't have a PR sitting around bit rotting. |
Closing this old draft - the code is still available and linked from the respective issue description for anyone to reference it. When we tackle this again let's try to do it incrementally so that the whole rework/refactor does not have to get done before we can start merging into master branch. |
This currently doesn't affect |
Ah I see, I will resurrect it and merge then! |
This is going to make #7920 much easier to update translate-c because the only thing that will have change is the render() function. |
Looks like the rebase got messed up |
3908beb
to
c0a2019
Compare
259e1be
to
9a826cc
Compare
The previous iteration of translate-c used an incorrect block label in the break statement for a translated C statement expression. This adds a test to ensure the correct label is used in the new intermediate AST version of translate-c.
@Vexu whenever you feel this is ready to merge into |
There is one error happening on this branch that isn't happening with the old translate-c - duplicate non-translatable macros are getting emitted twice as #define FOO 5=2
#define FOO 5=2 produces pub const FOO = @compileError("unable to translate C expr: unexpected token .Equal"); // ddef.c:4:9
pub const FOO = @compileError("unable to translate C expr: unexpected token .Equal"); // ddef.c:5:9 Previously only one |
One thing that will be interesting to test out on this branch, once we get it compiling again, is this benchmark. Here it is on master branch, on my machine: test.c#include <windows.h> (wipe global & local zig caches)
|
Will implement #6710