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

translate-c incorrectly translates c_void ptr cast #4071

Closed
momumi opened this issue Jan 4, 2020 · 0 comments · Fixed by #9092
Closed

translate-c incorrectly translates c_void ptr cast #4071

momumi opened this issue Jan 4, 2020 · 0 comments · Fixed by #9092
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. frontend Tokenization, parsing, AstGen, Sema, and Liveness. translate-c C to Zig source translation feature (@cImport)
Milestone

Comments

@momumi
Copy link
Contributor

momumi commented Jan 4, 2020

#define MAP_FAILED	((void *) -1)

gets translated to

pub const MAP_FAILED = [*c]void - 1;
@daurnimator daurnimator added the translate-c C to Zig source translation feature (@cImport) label Jan 4, 2020
@andrewrk andrewrk added contributor friendly This issue is limited in scope and/or knowledge of Zig internals. frontend Tokenization, parsing, AstGen, Sema, and Liveness. labels Jan 5, 2020
@andrewrk andrewrk added this to the 0.7.0 milestone Jan 5, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Aug 13, 2020
jmc-88 added a commit to jmc-88/zig that referenced this issue Apr 18, 2021
Fixes ziglang#4071.

Previously, this code would treat unary operators immediately following
the `(type)` cast as part of a binary expression, producing nonsensical
Zig code as output. This change allows translate-c to parse such
operator as part of a unary expression following the type cast instead.
@andrewrk andrewrk modified the milestones: 0.8.0, 0.10.0 May 19, 2021
@Vexu Vexu modified the milestones: 0.10.0, 0.9.0 Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. frontend Tokenization, parsing, AstGen, Sema, and Liveness. translate-c C to Zig source translation feature (@cImport)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants