RFR: 7903616: Bad formatting of layout string for structs with nested anon structs/unions [v3]
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Dec 22 14:48:19 UTC 2023
> This PR fixes an indentation issue when generating a struct layout string.
>
> Example:
>
>
> struct Foo {
> struct {
> int x;
> union {
> int y;
> int z;
> };
> };
> };
>
>
> For this, jextract generates:
>
>
> private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
> MemoryLayout.structLayout(
> foo_h.C_INT.withName("x"),
> MemoryLayout.unionLayout(
> foo_h.C_INT.withName("y"),
> foo_h.C_INT.withName("z")
> ).withName("$anon$7:9")
> ).withName("$anon$5:5")
> ).withName("Foo");
>
>
> With the fix in this PR, the generated string is:
>
>
> private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
> MemoryLayout.structLayout(
> foo_h.C_INT.withName("x"),
> MemoryLayout.unionLayout(
> foo_h.C_INT.withName("y"),
> foo_h.C_INT.withName("z")
> ).withName("$anon$7:9")
> ).withName("$anon$5:5")
> ).withName("Foo");
>
>
> The fix is to correctly track required indentation when descending into a scoped declaration.
Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
Remove redundant trailing semi
-------------
Changes:
- all: https://git.openjdk.org/jextract/pull/170/files
- new: https://git.openjdk.org/jextract/pull/170/files/1e6bf58a..a0c2398c
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jextract&pr=170&range=02
- incr: https://webrevs.openjdk.org/?repo=jextract&pr=170&range=01-02
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jextract/pull/170.diff
Fetch: git fetch https://git.openjdk.org/jextract.git pull/170/head:pull/170
PR: https://git.openjdk.org/jextract/pull/170
More information about the jextract-dev
mailing list