Searching/Deleting Unused Elements

You can search or delete unused elements (scalar, composite, complex) in the entire project.

  1. In the Extras menu, select Show Unused Elements.

    The Search Results view opens below the tabs in the Specification view. It shows all unused elements in the project and in the included components.

    The project configuration (i.e. target, code generator, implementation, dataset) is used to determine the relevant variants of included components. An element is used in the project context if at least one of the Closedfollowing conditions is fulfilled.

    • An element at project level has the scope exported AND an imported counterpart is available in the project context.
    • An element in an included component is used in the Closedcurrent variant of that component.

      A variant is specified by the following:

      • a particular dataset
      • a particular combination of target, code generator and compiler
      • for C code components: a particular combination of target, arithmetic, and implementation

      See the Closedinformation given for the various editors for details on an element being used in a component.

      Being mapped in the Message Mapping, NV-Data Mapping, or Parameter Mapping view of the SWC editor does not constitute usage of a message, a non-volatile variable, or an imported parameter.

    • A composite or complex element is mapped to an explicit reference in at least one dataset, regardless of whether that dataset is currently used or not.

    • The included component appears in the Graphics tab of the project editor.
    • The included component is a CT block.
    • The included component is an SWC.
    • The included C code component contains an external header that is used globally (activated option Use header global; see Adding a Header File to the Source Module).
    • At least one process of the included module is assigned to a task in the OS tab.
    • At least one process of the included module is mapped to an EHOOKS bypass function.

    NOTICE

    Component functionality may be damaged

    You cannot determine, from the project editor, whether the element of an included component is potentially used in another variant of its parent component.

    Deleting an element that is unused in the component variant included in the project, but used in other variants, will probably damage the functionality of the other variants.

    To avoid this damage, check the variants of the affected included component before you delete the element.

  2. In the Elements tab of the Search Results view, select one, several, or all (<Ctrl> + <a>) elements.
  3. Do one of the following:

    • Open the context menu and select Delete.

    • Press <Delete>.

    The selected unused elements are deleted.

See also

Search Results View

Searching/Deleting Unused Processes/Methods/Runnables