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

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Sep 10 18:00:24 UTC 2024


On Tue, 10 Sep 2024 16:25:32 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/main/java/org/openjdk/jextract/impl/TreeMaker.java line 131:
>> 
>>> 129:     private boolean isAllowedCXXDecl(Cursor cursor) {
>>> 130:         return switch (cursor.kind()) {
>>> 131:             case StaticAssert, StructDecl, UnionDecl -> true;
>> 
>> When in C++ mode, both structs and unions are reported to have language C++ (understandable, since they can also contain more members, such as methods). So we need to add a list of the constructs we like, regardless of the language.
>
> Why is `StaticAssert` here as well?

`StaticAssert` came from the code that was there before. The comment in the jextract code says:

But libclang maps both C11's _Static_assert
         * and C++11's static_assert to same CursorKind


So I just preserved what the code was already doing here.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/256#discussion_r1752433166


More information about the jextract-dev mailing list