Integrated: 7903777: jextract layout for enum with big constant values is wrong

Maurizio Cimadamore mcimadamore at openjdk.org
Tue Jul 16 17:54:06 UTC 2024


On Tue, 16 Jul 2024 13:19:52 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).

This pull request has now been integrated.

Changeset: 9f0eacf3
Author:    Maurizio Cimadamore <mcimadamore at openjdk.org>
URL:       https://git.openjdk.org/jextract/commit/9f0eacf381ec46941f64a28470f5811a50be4960
Stats:     118 lines in 6 files changed: 105 ins; 6 del; 7 mod

7903777: jextract layout for enum with big constant values is wrong

Reviewed-by: jvernee

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

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


More information about the jextract-dev mailing list