Searching/Deleting Unused Elements

You can search and delete elements (scalar, composite, complex) not used in the C code.

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

    The Search Results view opens below the tabs and combo boxes in the Specification view. It shows all elements listed in the Outline tab, but not present in the C code of the currently selected code variant.

    An element is recognized as used if one of the Closedfollowing conditions is fulfilled.

    • The element appears in the C code – except comments – of at least one code variant.

    • The element is a method argument or return value.

    • The element is of scope exported.

      When a component is searched for unused elements, exported elements are always marked as used because they are intended to be used. An exported element that is not used in its component is detected only when the parent project is searched for unused elements.

    • A Get or Set port of the element is activated in the element's properties editor.

      When a component is searched for unused elements, elements with activated Get or Set ports are always marked as used. An element with activated Get or Set ports that is not used in its component is detected only when the parent project is searched for unused elements.

    • A parameter, constant, or system constant (normal or user-defined) is mapped to a dependent parameter in at least one dataset, regardless of whether that dataset is currently used or not.

    • A system constant (normal or user-defined) is used in the variant size definition of an array or matrix.

    • A distribution is assigned to a group characteristic line/map.

    • 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.

    • An included component contains (directly or indirectly) at least one exported element that is used.

    • An included C code component contains at least one target/arithmetic/implementation combination with an external header that is used globally (activated option Use header global; see Adding a Header File to the Source Module).

    NOTICE

    Component functionality may be damaged

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

    To avoid this damage, check the affected variants 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