RFR: 7903777: jextract layout for enum with big constant values is wrong [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Tue Jul 16 13:59:32 UTC 2024
> 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:
Use import
-------------
Changes:
- all: https://git.openjdk.org/jextract/pull/252/files
- new: https://git.openjdk.org/jextract/pull/252/files/0cfb1241..cfc1f671
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jextract&pr=252&range=01
- incr: https://webrevs.openjdk.org/?repo=jextract&pr=252&range=00-01
Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jextract/pull/252.diff
Fetch: git fetch https://git.openjdk.org/jextract.git pull/252/head:pull/252
PR: https://git.openjdk.org/jextract/pull/252
More information about the jextract-dev
mailing list