RFR: 7903777: jextract layout for enum with big constant values is wrong [v3]

Jorn Vernee jvernee at openjdk.org
Tue Jul 16 16:55:07 UTC 2024


On Tue, 16 Jul 2024 14:12:33 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This PR fixes the code that generates enum layouts. Currently, the layout of an enum type is determined by looking at the type of the first enum constant.
>> In some platforms, this strategy does not work, as an enum can have constants of **different** types.
>> 
>> The solution is to ask clang what the integral type of the enum declaration is, and store that as an attribute in the enum declaration. Then, we should simply retrieve that type when generating layouts that depend on the enum.
>> 
>> I've added a platform-dependent test, since this functionality is only really available on Linux/gcc (on Windows, enum constants are all truncated to 32 bits, it seems).
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add copyright header in test file

Marked as reviewed by jvernee (Committer).

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

PR Review: https://git.openjdk.org/jextract/pull/252#pullrequestreview-2180810004


More information about the jextract-dev mailing list