RFR: 7903649: Field and global variables of array type should have indexed accessors [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Feb 1 13:41:14 UTC 2024


On Thu, 1 Feb 2024 12:48:30 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add missing blank lines
>
> src/main/java/org/openjdk/jextract/impl/HeaderFileBuilder.java line 470:
> 
>> 468:                 }
>> 469:                 """);
>> 470:         if (!Utils.isStructOrUnion(varType) && !Utils.isArray(varType)) {
> 
> Why is this disabled for structs and arrays?

Because for structs  and arrays, the getter is already returning the global variable segment

> src/main/java/org/openjdk/jextract/impl/StructBuilder.java line 141:
> 
>> 139:         String offsetField = emitOffsetFieldDecl(varTree, javaName);
>> 140:         if (Utils.isArray(varTree.type()) || Utils.isStructOrUnion(varTree.type())) {
>> 141:             emitDimensionsFieldDecl(varTree, javaName);
> 
> Are we always emitting DIMS field, even for structs? Should this be moved into the `dims > 0` if block?

this seems a mistake

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

PR Review Comment: https://git.openjdk.org/jextract/pull/198#discussion_r1474483055
PR Review Comment: https://git.openjdk.org/jextract/pull/198#discussion_r1474486567


More information about the jextract-dev mailing list