Skip to content

Add flag to parse matching #define * into enums instead of constants #2174

Open
@Emilgardis

Description

@Emilgardis

Hi! I have a header file I'd rather not touch, and I want to convert some #define directives that are integers into enums, such that --constified-enum-module, --bitfield-enum etc would work as expected

#define FOO_BAR_A_BAZ 0
#define FOO_BAR_BOB 1
#define FOO_BAR_C 2
#define FOO_BAR_D 3

Given above header, generate the equivalent code as for when parsing

enum FOO_BAR {
    A_BAZ=0,
    BOB=1,
    C=2,
    D=3,
};

This should also keep comments intact.

Is this possible to implement?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions