Skip to content

Enums generate cumbersome names #1624

@Angus-Bethke-Bachmann

Description

@Angus-Bethke-Bachmann

Describe the bug
Enums generate cumbersome names as they append their type to the definition which we already do by convention when working with PLC.

To Reproduce
Example in PLC:

TYPE FILE_AccessMode :
(
        FILE_AccessMode_Read, (**< Open a existing file for reading. *)
        FILE_AccessMode_Write, (**< Create a file for writing. Discards existing file content. *)
        FILE_AccessMode_Append, (**< Append to a file. Preserves existing file content. *)
        FILE_AccessMode_ReadPlus, (**< Open a file for read/write. Read from the start. Fails if the file does not exist. *)
        FILE_AccessMode_WritePlus, (**< Create a file for read/write. Discards existing file content. *)
        FILE_AccessMode_AppendPlus (**< Open a file for read/write. Preserves existing file content or create a new one if it does not exist. *)
    ) ;
END_TYPE

Becomes:

typedef int32_t FILE_AccessMode;
#define FILE_AccessMode_FILE_AccessMode_Read       ((FILE_AccessMode)0)
#define FILE_AccessMode_FILE_AccessMode_Write      ((FILE_AccessMode)1)
#define FILE_AccessMode_FILE_AccessMode_Append     ((FILE_AccessMode)2)
#define FILE_AccessMode_FILE_AccessMode_ReadPlus   ((FILE_AccessMode)3)

Expected behavior
If the enum has already been fully qualified by the definition, I would expect it to not be qualified again by the header generator.

Additional context
Originally reported by Guillaume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingheader-generatorThis label is for issues that specifically affect the header generator sub process of the compiler.low-priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions