jextract throws "Invalid Cursor kind value: 602"

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon Apr 4 08:37:49 UTC 2022


Given the nature of "static_assert" it seems to me like perhaps this 
could be safely skipped by jextract? Static asserts do not have any 
impact on runtime semanticsm AFAIK - in a way it's almost like skipping 
a macro kind we do not support.

There is, of course, also a more general error recovery issue here - if 
an header is 99% C but contains a single C++ class declaration, what 
should jextract do? That is a bit harder, in the sense that, a class can 
appear in other variable and function declarations, so it is not clear 
what should happen to other members mentioning the problematic symbol 
(ideally we'd skip those).

In the case of "static assert" though, no new symbol is being 
introduced, so any fallout resulting from that is likely to be very 
limited in scope, unless I'm missing something.

Maurizio

On 04/04/2022 06:24, ahoj.41 at seznam.cz wrote:
> Thank you Sundar,
>
> The header in deed transitively contains `static_assert` [1].
>
> Previous early access build (Build 17-panama+3-167 (2021/5/18)) works ok though using the same steps to reproduce.
>
> Function that is being extracted doesn't contain the `static_assert` statement, the function is next to the `static_assert` statement so `static_assert` could likely be ignored.
>
> If "jextract only supports C headers" doesn't only mean that C++ constructs cannot be extracted but also that presence of any C++ construct should prevent jextract from working then it would be nice to adjust the exception message. For example "`static_assert` statement  encountered at <line>:<column> of file `/path/to/file.hpp`. C headers are only supported."
>
> Adam
>
> [1]: https://github.com/winfsp/winfsp/blob/0a91292e0502d6629f9a968a168c6e89eea69ea1/inc/winfsp/fsctl.h#L33
>
>
> ---------- Původní e-mail ----------
>
> Od: Sundararajan Athijegannathan <sundararajan.athijegannathan at oracle.com>
>
> Komu: ahoj.41 at seznam.cz <ahoj.41 at seznam.cz>, panama-dev at openjdk.java.net <panama-dev at openjdk.java.net>
>
> Datum: 4. 4. 2022 5:36:44
>
> Předmět: Re: jextract throws "Invalid Cursor kind value: 602"
>
>   .apply-styles P{margin-top:0;margin-bottom:0}
>
> static assert is a C++11 construct. Are you trying to extract a C++ header?
>
>
>
>
>
>
>
> Please note that jextract only supports C headers.
>
>
>
>
>
>
>
> -Sundar
>
>
>
>
> From: panama-dev <panama-dev-retn at openjdk.java.net> on behalf of ahoj.41 at seznam.cz <ahoj.41 at seznam.cz>
>
> Sent: 04 April 2022 07:06
>
> To: panama-dev at openjdk.java.net <panama-dev at openjdk.java.net>
>
> Subject: jextract throws "Invalid Cursor kind value: 602"
>   
>
>
>
>
>
>
> Hello,
>
>
>
>
>
>
>
>
>
> I'd like to report an issue of `jextract` tool and corresponding API `jdk.
>
> incubator.jextract.JextractTool#main` that throws NoSuchElementException
>
> with message "Invalid Cursor kind value: 602" when called on [winfsp.h][1].
>
>
>
>
>
>
>
>
>
> The exception is thrown from method jdk.internal.clang.CursorKind#valueOf
>
> (int) and is likely caused by missing enum item of jdk.internal.clang.
>
> CursorKind corresponding to jdk.internal.clang.libclang.Index_h#CXCursor_
>
> StaticAssert().
>
>
>
>
>
>
>
>
>
> Environment:
>
>
>
> Windows 10 64b
>
>
>
> Early access build 19-panama+1-13 (2022/1/18) SOURCE=".:git:d8c0fe5918cb"
>
>
>
>
>
>
>
>
>
> Steps to reproduce:
>
>
>
>
>
>
>
>
>
> 1. Download directory
> https://github.com/winfsp/winfsp/tree/7527155cb87c382
>
> cab1848b5bf65910c2dead291/inc/winfsp. E.g. into `C:\tmp`.
>
>
>
>
>
> 2. Run snippet
>
>
>
>
>
>
>
>
>
> ```
>
>
>
> JextractTool.main(new String[] {
>
>          "--source",
>
>          "-d", "jextract-demo",
>
>          "-t", "jextract.demo",
>
>          "-I", "C:\\tmp",
>
>          "--include-function", "FspWin32FromNtStatus",
>
>          "C:\\tmp\\winfsp\\winfsp.h"
>
> });
>
>
>
>
>
> ```
>
>
>
>
>
>
>
>
>
> Expected result: no exception is thrown
>
>
>
>
>
>
>
>
>
> Actual result:
>
>
>
>
>
>
>
>
>
> NoSuchElementException is thrown.
>
>
>
>
>
>
>
>
>
> Adam
>
>
>
>
>
>
>
>
>
>
>
> [1]:
> https://github.com/winfsp/winfsp/blob/7527155cb87c382cab1848b5bf65910c2
>
> dead291/inc/winfsp/winfsp.h
>
>
>
>
>
>
>
>
>
>
>
>
>


More information about the panama-dev mailing list