-
Bug
-
Resolution: Fixed
-
P4
-
repo-panama
The function declaration `f` in the following example compiles on both MSVC 19.16 and GCC 8.2 [1]:
test.h:
```
typedef void CB(int i);
void f(CB x);
```
But jextract rejects it with the following error:
```
> jextract -J-D"jextract.debug=true" test.h
Unsupported type kind: FunctionProto
java.lang.IllegalArgumentException: Unsupported type kind: FunctionProto
at jdk.jextract/com.sun.tools.jextract.tree.LayoutUtils.getLayout(LayoutUtils.java:181)
at jdk.jextract/com.sun.tools.jextract.tree.LayoutUtils.getLayout(LayoutUtils.java:163)
at jdk.jextract/com.sun.tools.jextract.tree.LayoutUtils.parseFunctionInternal(LayoutUtils.java:120)
at jdk.jextract/com.sun.tools.jextract.tree.LayoutUtils.getFunction(LayoutUtils.java:109)
at jdk.jextract/com.sun.tools.jextract.Utils.getFunction(Utils.java:129)
at jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:145)
at jdk.jextract/com.sun.tools.jextract.TypeDictionary.enterIfAbsent(TypeDictionary.java:201)
at jdk.jextract/com.sun.tools.jextract.TypeEnter.visitFunction(TypeEnter.java:92)
at jdk.jextract/com.sun.tools.jextract.TypeEnter.visitFunction(TypeEnter.java:33)
at jdk.jextract/com.sun.tools.jextract.tree.FunctionTree.accept(FunctionTree.java:48)
at jdk.jextract/com.sun.tools.jextract.JextractTool.lambda$generateHeader$4(JextractTool.java:75)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at jdk.jextract/com.sun.tools.jextract.JextractTool.generateHeader(JextractTool.java:75)
at jdk.jextract/com.sun.tools.jextract.JextractTool.lambda$processHeaders$3(JextractTool.java:69)
at java.base/java.util.HashMap.forEach(HashMap.java:1333)
at jdk.jextract/com.sun.tools.jextract.JextractTool.processHeaders(JextractTool.java:69)
at jdk.jextract/com.sun.tools.jextract.Main.run(Main.java:264)
at jdk.jextract/com.sun.tools.jextract.Main.main(Main.java:334)
```
[1]: https://godbolt.org/z/PJIofg
test.h:
```
typedef void CB(int i);
void f(CB x);
```
But jextract rejects it with the following error:
```
> jextract -J-D"jextract.debug=true" test.h
Unsupported type kind: FunctionProto
java.lang.IllegalArgumentException: Unsupported type kind: FunctionProto
at jdk.jextract/com.sun.tools.jextract.tree.LayoutUtils.getLayout(LayoutUtils.java:181)
at jdk.jextract/com.sun.tools.jextract.tree.LayoutUtils.getLayout(LayoutUtils.java:163)
at jdk.jextract/com.sun.tools.jextract.tree.LayoutUtils.parseFunctionInternal(LayoutUtils.java:120)
at jdk.jextract/com.sun.tools.jextract.tree.LayoutUtils.getFunction(LayoutUtils.java:109)
at jdk.jextract/com.sun.tools.jextract.Utils.getFunction(Utils.java:129)
at jdk.jextract/com.sun.tools.jextract.TypeDictionary.getInternal(TypeDictionary.java:145)
at jdk.jextract/com.sun.tools.jextract.TypeDictionary.enterIfAbsent(TypeDictionary.java:201)
at jdk.jextract/com.sun.tools.jextract.TypeEnter.visitFunction(TypeEnter.java:92)
at jdk.jextract/com.sun.tools.jextract.TypeEnter.visitFunction(TypeEnter.java:33)
at jdk.jextract/com.sun.tools.jextract.tree.FunctionTree.accept(FunctionTree.java:48)
at jdk.jextract/com.sun.tools.jextract.JextractTool.lambda$generateHeader$4(JextractTool.java:75)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at jdk.jextract/com.sun.tools.jextract.JextractTool.generateHeader(JextractTool.java:75)
at jdk.jextract/com.sun.tools.jextract.JextractTool.lambda$processHeaders$3(JextractTool.java:69)
at java.base/java.util.HashMap.forEach(HashMap.java:1333)
at jdk.jextract/com.sun.tools.jextract.JextractTool.processHeaders(JextractTool.java:69)
at jdk.jextract/com.sun.tools.jextract.Main.run(Main.java:264)
at jdk.jextract/com.sun.tools.jextract.Main.main(Main.java:334)
```
[1]: https://godbolt.org/z/PJIofg
- relates to
-
JDK-8258605 regression: jextract can not handle function prototypes as function arguments
-
- Resolved
-