Skip to content

Type code generation for OTHER enum creates unnecessary struct #526

@zougloub

Description

@zougloub

Consider this:

root = {
 0 => indirect,
 1 => int,
}

indirect = int

which generates

struct root {
        int32_t indirect_m;
        int32_t uint1int;
};

Now, this:

root = {
 0: indirect,
 1: ((zero: 0) / (one: 1))
}

indirect = (
 (zero: 0) / (one: 1)
)

Again, the indirect type was defined in order to give a label to a structure field.
But this time, the generated code seems to be unnecessarily more verbose, creating:

struct indirect_r {
        enum {
                indirect_zero_c = 0,
                indirect_one_c = 1,
        } indirect_choice;
};

struct root {
        struct indirect_r indirect_m;
        enum {
                root_uint1union_zero_c = 0,
                root_uint1union_one_c = 1,
        } uint1union_choice;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions