-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
regression: translate-c output struct depends on itself (false positive) #17227
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
Comments
to reproduce with the cimgui header: include https://github.com/cimgui/cimgui/blob/docking_inter/cimgui.h const c = @cImport({
@cDefine("CIMGUI_DEFINE_ENUMS_AND_STRUCTS", {});
@cInclude("include.h");
});
pub fn main() void
{
var cmd: c.ImVector_ImDrawCmd = undefined;
_ = cmd;
}
|
There are several open issues for false dependency loops, which might be getting triggered here. I think what I'll do is make a new PR that temporarily disables zero values for structs. Once those false dependency loop issues have been fixed, zero values for structs can be re-enabled. Thanks for the report. |
👍 can you link me to any of those issues? |
ah I see. didn't expect anything so old / before |
This is a new bug (regression). cimgui header was working fine with The regression is in @mlugg Could that be caused by your recent |
Nope, it's what @jayschwa said - default zero values causing false dependency loops. That PR wasn't me. HOWEVER! This should actually be fixed on master as of the merging of #17172 (it works according to my local tests). The issue was related to struct alignment resolution forcing full layout resolution: when For anyone who experienced this bug, try your code out now - it should be fixed! |
I see, thanks for the info! |
Confirmed that this is fixed in master after #17172 was merged. I tested with both the small reproducer and the cimgui example. It should be noted that the ziglang.org download page doesn't have a new build with the fix yet, but probably will within the next day or so. |
Zig Version
0.12.0-dev.464+a63a1c5cb
Steps to Reproduce and Observed Behavior
a project depending on several C headers previously compiled, but now throws an error inside a file generated by translate-c.
the header in question is generated by cimgui (including as a keyword in case anyone else has this specific problem) and should probably be considered 'valid' as it has many dependents in the wild.
I've pared the error down to a minimal example:
'include.h'
the error is pretty easy to reproduce with the actual cimgui header, so I can include that if necessary.
this occurs in
0.12.0-dev.464+a63a1c5cb
but not0.12.0-dev.415+5af5d87ad
, which means this occurred somewhere inside the big batch of commits in the last couple days.perhaps
f91ff9a @jayschwa
or changes by @andrewrk, @jacobly0
Expected Behavior
compilation succeeds
The text was updated successfully, but these errors were encountered: