RFR: 7903360: jextract does not handle function pointer return type properly
Athijegannathan Sundararajan
sundar at openjdk.org
Tue Oct 18 10:22:28 UTC 2022
On Tue, 18 Oct 2022 09:08:52 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> * generating functional interface for pointer to function return types
>> * taking care of javadoc comment by using nameAndType function uniformly
>
> src/main/java/org/openjdk/jextract/impl/OutputFactory.java line 263:
>
>> 261:
>> 262: // return type could be a function pointer type
>> 263: Type.Function returnFunc = Utils.getAsFunctionPointer(funcTree.type().returnType());
>
> Did you check the corner case of a function pointer having a function pointer as its return type?
While we recurse for pointer to function parameter types, we did recurse for return type. That's being fixed here.
For pointer to functions, we didn't recurse even for arguments (and also for return types).
For example, for
void (*func)(void (*f)(int));
we generate FI for "func" but not for "f".
The current fix case is seen in standard library (signal in signal.h). We can deal with recursing args and return types for function pointer types in a separate fix.
-------------
PR: https://git.openjdk.org/jextract/pull/90
More information about the jextract-dev
mailing list