Pragmas and attributes 7 Pragmas and attributes | Pragmas and attributes A pragma and various attributes are available to temporarily disable individual rules or naming conventions for the static analysis, i.e. to exclude certain code lines or program units from the evaluation. Prerequisite: You have enabled or defined the rules or conventions in the PLC project properties. See also: Rules [ } 15] Naming conventions [ } 80] Attributes are inserted in the declaration part of a programming block in order to deactivate certain rules for a complete programming object.
Pragmas are used in the implementation part of a programming block in order to deactivate certain rules for individual code lines. The exception to this is rule SA0164, which can also be deactivated in the declaration part by a pragma. Rules that are disabled in the project properties cannot be activated by a pragma or attribute. Rule SA0004: Multiple write access on output [ } 21] cannot be disabled by a pragma or an attribute. Pragmas in the implementation editor If you want to use a pragma in the implementation editor, this is currently possible in the ST and FBD/LD/IL editors. In FBD/LD/IL, the desired pragma must be entered in a label.
The following section provides an overview and a detailed description of the available pragmas and attributes. Overview Pragma {analysis ...} [ } 122] ◦for disabling coding rules in the implementation part Attribute {attribute 'no-analysis'} [ } 122] ◦can be used for individual code lines ◦for excluding programming objects (e.g.
POU, GVL, DUT) from the static analysis (coding rules, naming conventions, forbidden symbols) Attribute {attribute 'analysis' := '...'} [ } 123] ◦can only be used for whole programming objects ◦for disabling coding rules in the declaration part ◦can be used for individual declarations or for whole programming objects Attribute {attribute 'naming' := '...'} [ } 123] ◦for disabling naming conventions in the declaration part ◦can be used for individual declarations or for whole programming objects Attribute {attribute 'nameprefix' := '...'} [ } 124] ◦for defining prefixes for instances of a structured data type ◦can be used in the declaration part of a structured data type Attribute {attribute 'analysis:report-multiple-instance-calls'} [ } 125] ◦for specifying that a function block instance should only be called once TE1200 121 Version:
2.11.1