RFR: 7903662: Javadoc generated by jextract breaks javac compilation

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Feb 14 22:18:15 UTC 2024


We have recently switched to generate the source-like description of C API elements using the clang API, which allows for better fidelity with the original C code. While this works generally well, libclang has some strange behavior around anonymous structs, where some of them (not all!) are reported together with the path in which the declaration occurs.

Since adding paths to the javadoc is generally a bad idea, which can lead to all sorts of troubles, jextract implements a basic filtering logic, which uses a regex to detect the overly verbose description strings. It turns out that, while the regex works well for libclang 13 and later, earlier versions have issues, as instead of using the term "unnamed struct" libclang uses "anonymous struct".

Anyway, the fix is to tweak the regex we use to detect bogus descriptions to include "anonymous". This should make jextract a bit more robust w.r.t. changes across different libclang versions (and, I hope that this gets fixed upstream so that we don't have to apply such nasty workarounds).

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

Commit messages:
 - Initial push

Changes: https://git.openjdk.org/jextract/pull/209/files
 Webrev: https://webrevs.openjdk.org/?repo=jextract&pr=209&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7903662
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jextract/pull/209.diff
  Fetch: git fetch https://git.openjdk.org/jextract.git pull/209/head:pull/209

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


More information about the jextract-dev mailing list