Contenido principal

Use generated code requirements (-misra3-agc-mode)

Check for violations of MISRA C:2012 rules and directives that apply to generated code

Description

Specify whether to use the MISRA C™:2012 categories for automatically generated code. This option changes which rules are mandatory, required, or advisory.

Set Option

Set the option using one of these methods:

  • Polyspace Platform user interface (desktop products only): In your project configuration, on the Static Analysis tab, select Defects and Coding Standards and then select this option. See Dependencies for other options you must enable first.

  • Command line and options file: Use the option -misra3-agc-mode. See Command-Line Information.

Why Use This Option

Use this option to specify that you are checking for MISRA C:2012 rules in generated code. The option modifies the MISRA C:2012 subsets so that they are tailored for generated code.

The option does not add or remove rules from the MISRA C:2012 rule set specified using the option Check MISRA C:2012 (-misra3). Instead, it changes the categorization of the rules as follows:

  •  Category changed to Advisory

  •  Category changed to Readability

Settings

Off (default)

Use the normal categories (mandatory, required, advisory) for MISRA C:2012 coding guideline checking.

On (default for analyses from Simulink®)

Use the generated code categories (mandatory, required, advisory, readability) for MISRA C:2012 coding guideline checking.

For analyses started from the Simulink plug-in, this option is the default value.

Dependencies

In the Polyspace Platform user interface, this option is shown only when you select Use custom checkers file.

You can also activate the MISRA C:2012 rules in the command line using either of these options:

When using an XML file to specify a custom selection, select at least one MISRA C:2012 rule in the file.

Command-Line Information

Use the command -misra3-agc-mode in the command line to check for violations of MISRA C:2012 rules and directives that apply to generated code.

Parameter: -misra3-agc-mode
Default: Off
Example (Bug Finder): polyspace-bug-finder -sources file_name -misra3 all -misra3-agc-mode
Example (Bug Finder Server): polyspace-bug-finder-server -sources file_name -misra3 all -misra3-agc-mode

Alternatively, activate the rules and directives in an activation XML file. See Checkers activation file (-checkers-activation-file).