RFR: 7903630: jextract emits duplicate symbols for macro clashing with enum constants

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Jan 16 12:03:00 UTC 2024


On Tue, 16 Jan 2024 11:56:40 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> The removal of `EnumConstantLifter` caused certain name conflicts to go undetected by `DuplicateFilter`. More specifically, if a macro constant has same name as that of an enum constant, given the enum constant is no longer lifted to toplevel, `DuplicateFilter` will not see the clash. The fix is to tweak `DuplicateFilter` to recurse into enums.

src/main/java/org/openjdk/jextract/impl/DuplicateFilter.java line 116:

> 114:         if (Utils.isEnum(d)) {
> 115:             // enum constants might clash with macro constants with same name
> 116:             d.members().forEach(m -> m.accept(this, null));

Note: this will probably prefer the macro to the enum constant. While this is not ideal, this is also what happened in the old code - perhaps we can address that issue separately (it will only affect the javadoc being generated).

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

PR Review Comment: https://git.openjdk.org/jextract/pull/177#discussion_r1453329918


More information about the jextract-dev mailing list