[foreign-jextract] RFR: 8251256: jextrac code generated for nested structs, unions is incorrect
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Fri Aug 7 09:18:48 UTC 2020
On Fri, 7 Aug 2020 08:53:34 GMT, Athijegannathan Sundararajan <sundar at openjdk.org> wrote:
>> Marked as reviewed by sundar (Committer).
>
> I tested the patch on Mac and ran all samples as well. All fine.
> Overall looks good, I tested it on MacOS and seems like we get pretty good coverage. Some minor issue with indentation
> of generated code, but that's minor and can be fixed later.
Very good point - I knew about that and meaning to fix that (esp. after introducing the delegation scheme) - but for
some reason I forgot - I will upload another iteration which fixes that.
The only case missed seems to be when an anonymous type in a function argument like following,
>
> ```
> void foo(struct {int x; int y; } *p);
> ```
>
> I doubt that's important as while it's legal, sane programmer should not code like that as the struct type is not
> exposed. So it seems fit jextract not expose the layout either.
Yeah - this seems a bit odd. To be clear, this patch doesn't have any aspiration to be a "full solution" - it merely
allow jextract to look a bit deeper into anonymous struct/unions in field decls. We might need more tweaking - either
in code generation, or in the how the declaration API represents this stuff.
>
> FWIW, there is a header file I used for testing anonymous types and dependency, the result from jextract did cover all
> anonymous types. There are still something both jbind/jextract cannot handle, but that's beyond this issue.
> [](https://github.com/slowhog/panama-foreign/blob/jbind/test/jdk/java/jextract/anonymousDecl.h)
Thanks - yes, it would be good to go over it and see what's missing.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/280
More information about the panama-dev
mailing list