prototypeless function representation

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Jul 31 18:05:20 UTC 2024


On 31/07/2024 16:09, Maurizio Cimadamore wrote:

> This is not helpful I agree - seems to be coming somewhere deep in 
> libclang. I wonder if it's related to the parsing of the 
> compile_flags.txt itself...

I’ve tried adding a compile_flags.txt as follows:

|-xc++ |

And this seems to work as expected for simple files containing a single 
prototype-less function declaration (e.g. jextract generates binding for 
a 0-arity function).

I’ve tried extracting OpenGL with this flag, and I started running into 
issues, as jextract started to see unsupported C++ constructs (such as 
“using”). Not sure where these came from (probably from standard library 
headers, as the headers for OpenGL don’t seem to have any “using” 
directive inside them).

But the error I got was something more specific (not just ASTReadError). 
Adding some hacks and workaround to jextract eventually allowed me to 
get to a full extraction.

I then tried tweaking the compile_flags.txt as follows:

|-x c++ |

(note the extra space).

And bam, even for simple examples it fails like this:

|fatal: Unexpected exception 
org.openjdk.jextract.clang.Index$ParsingFailedException: Failed to parse 
jextract$tmp.h: ASTReadError occurred |

Which is, I think, what you saw. If that’s your issue you could try 
dropping the extra space. My (failed) attempts with OpenGL leave me 
somewhat skeptical that this solution truly works.

Maurizio

​
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jextract-dev/attachments/20240731/9fd99e61/attachment-0001.htm>


More information about the jextract-dev mailing list