[foreign-jextract] RFR: 8252634: jextract should generate type annotations for C types
Jorn Vernee
jvernee at openjdk.java.net
Wed Sep 2 08:56:58 UTC 2020
On Wed, 2 Sep 2020 08:20:37 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> @C annotation generated for C types
>
> src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/AnnotationWriter.java line 73:
>
>> 72: if (t.type() instanceof Type.Function) {
>> 73: return typeStr.replace("(", "(*)(");
>> 74: } else {
>
> This might be problematic for multiple nested function types, e.g.
>
> void (int, void (*)(void)) -> void (*)(int, void (*)(*)(*)(void))
>
> The return type could also be a function pointer, so it's not always the first occurrence that needs to be replaced
> either.
Might just want to revisit the return type and argumentTypes, similar to what you do in visitFunction, but use `(*)(`
as a joiner instead of `(`.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/300
More information about the panama-dev
mailing list