EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers.

Static Analysis Light

Overview

The static analysis function checks the source code of a project for deviations from certain coding directives before the project is downloaded to the target system. This follows the basic idea of the lint analysis tool.

You define the desired set of rules in the Project Settings > Static Analysis Light dialog box.

NOTE: The check is automatically performed at each code generation.

Deviations from the rules are displayed as messages of category Build in the Messages view. The error numbers are displayed as SA<number>.

NOTE: The analysis is only done on the application code in the current project. Libraries are not regarded.

NOTE: For GVL variables: If there are several applications in the project, then only objects below the currently active application are checked. If there is only one application in the project, then also any objects in the POUs pool are checked.

Pragma and Attribute for Static Analysis Light

With the help of pragma instructions, you can exclude parts of the code from the check.

Precondition: The rules must be activated in the Project Settings.

NOTE: Multiple write access on output, cannot be deactivated via pragma.

Pragma {analysis ...}

You can use the pragma {analysis ...} to disable particular coding rules for the subsequent code lines. For this purpose, place it twice: In the line above the concerned code (disabling), and in the line below the concerned code (re-enabling); each the numbers of the rule or rules to be disabled must be specified preceded by a minus sign () for disabling or by a plus sign (+) for re-enabling. Depending on the rule, the pragma can be used in the declaration part or in the implementation part of a programming object.

Syntax

{analysis <sign><rule number>|,<further sign / rule number combinations separated by commas>}

Example

Rule 24 gets disabled for two lines (that means that it is not necessary here to write, for example, nTest:=DINT#99), and afterwards re-enabled:

{analysis -24}
nTest := 99;
iVar := INT#2;
{analysis +24}

Specifying multiple rules:

{analysis -10, -24, -18}

Attribute {attribute 'analysis' := '...'}

You can use the attribute {attribute 'analysis' := '<sign><rule number>'} in the declaration part for enabling or disabling particular rules for a complete programming object:

Syntax

{attribute 'analysis' := '<sign><rule number>|,<further rule numbers separated by commas>'}

Example

Rules 33 and 31 get disabled for the complete structure:

{attribute 'analysis' := '-33, -31'}
TYPE My_Structure :
STRUCT
    iLocal : INT;
    uiLocal : UINT;
    udiLocal : UDINT;
END_STRUCT
END_TYPE

Rule 100 is disabled for the array:

{attribute 'analysis' := '-100'}
big: ARRAY[1..10000] OF DWORD;