RFR: 7903783: Jextract should tolerate more CPP constructs when running with xc++

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Aug 1 12:43:11 UTC 2024


This PR fixes a bunch of issues with trying to run jextract in CPP mode, using a `compile_flags.txt` file containing the `-xc++` flag.

I've found at least three issues:
* extern C clauses are not recursively scanned
* the first time we see a cursor with language != C, we stop with an exception (instead of skipping)
* typing of enum constant is different in C++ and causes infinite recursion 

These issues were preventing jextract to work with real world libraries (I tested OpenGL) when `-xc++` was specified.

Now jextract will try to parse as much as possible. Unrecognized constructs/languages will be skipped and a diagnostic will be reported by the log.

-------------

Commit messages:
 - Add test
 - Initial push

Changes: https://git.openjdk.org/jextract/pull/256/files
  Webrev: https://webrevs.openjdk.org/?repo=jextract&pr=256&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7903783
  Stats: 198 lines in 8 files changed: 175 ins; 13 del; 10 mod
  Patch: https://git.openjdk.org/jextract/pull/256.diff
  Fetch: git fetch https://git.openjdk.org/jextract.git pull/256/head:pull/256

PR: https://git.openjdk.org/jextract/pull/256


More information about the jextract-dev mailing list