Skip to content

SHARE INHERIT EXTEND duplicating functions causing compile errors in rare cases #2265

@mads-bertelsen

Description

@mads-bertelsen

Components are allowed to INHERIT sections of other components and extend on these with the INHERIT syntax. It was recently found that Union_abs_logger_nD that had:

SHARE INHERIT Monitor_nD EXTEND

Would fail to compile when both Union_abs_logger_nD and Monitor_nD was in the same instrument file, as some functions would be created twice. If this problem affect you, its possible to copy the content of SHARE instead of using the INHERIT functionality, and then renaming the functions to something unique.

In order to fix this problem we will need to find a way to avoid duplication of function definitions which is the main use of the SHARE section. I see two options:

A: The code generator could check if a component inherits SHARE from another, and then only include the extended SHARE. This would cause issues if multiple components INHERIT from the same component and add different new functions.

B: The code generator could check if a component inherits SHARE from another, and then only include the EXTENDED part if the original is in the instrument.

C: Add code generated preprocessor logic to protect the original SHARE from being double imported. Probably the simplest option.

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