jextract icon indicating copy to clipboard operation
jextract copied to clipboard

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

Open mcimadamore opened this issue 6 months ago • 4 comments

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.


Progress

  • [x] Change must not contain extraneous whitespace
  • [x] Change must be properly reviewed (no review required)

Issue

  • CODETOOLS-7903783: Jextract should tolerate more CPP constructs when running with xc++ (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jextract.git pull/256/head:pull/256
$ git checkout pull/256

Update a local copy of the PR:
$ git checkout pull/256
$ git pull https://git.openjdk.org/jextract.git pull/256/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 256

View PR using the GUI difftool:
$ git pr show -t 256

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jextract/pull/256.diff

Webrev

Link to Webrev Comment

mcimadamore avatar Aug 01 '24 12:08 mcimadamore