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

Proposal: allow setting cflags with @cImport #8676

Closed
ehaas opened this issue May 3, 2021 · 1 comment
Closed

Proposal: allow setting cflags with @cImport #8676

ehaas opened this issue May 3, 2021 · 1 comment
Labels
proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. translate-c C to Zig source translation feature (@cImport)
Milestone

Comments

@ehaas
Copy link
Contributor

ehaas commented May 3, 2021

Some clang code-generation options can affect the behavior of translate-c by changing the sizes of types. Two notable examples are -fshort-enums (common in embedded systems) and -fshort-wchar (for building programs to run under WINE). With #8664 these flags can be passed to zig translate-c using -cflags but there is currently no way to pass them when using @cImport.

I propose adding a builtin @cFlags(flags: []const []const u8) void. Like cDefine/cInclude/etc it would only be valid within a cImport block. This function would append flags to the array of flags to be passed to clang for the current cImport instance.

These flags will also need to be included in the cache manifest since they can change the output translated code.

@andrewrk andrewrk added proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. translate-c C to Zig source translation feature (@cImport) labels May 3, 2021
@andrewrk andrewrk added this to the 0.9.0 milestone May 3, 2021
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 May 19, 2021
@andrewrk
Copy link
Member

Will be solved instead by #20630.

@andrewrk andrewrk closed this as not planned Won't fix, can't repro, duplicate, stale Jul 14, 2024
@andrewrk andrewrk modified the milestones: 0.16.0, 0.14.0 Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. translate-c C to Zig source translation feature (@cImport)
Projects
None yet
Development

No branches or pull requests

2 participants