Main Content

Check MISRA C++:2008 (-misra-cpp)

Check for violations of MISRA C++ rules

Description

Specify whether to check for violation of MISRA™ C++:2008 rules 1 . Each value of the option corresponds to a subset of rules to check.

Set Option

Set the option using one of these methods:

Why Use This Option

Use this option to specify the subset of MISRA C++ rules to check for.

After analysis, the Results List pane lists the coding standard violations. On the Source pane, for every coding rule violation, Polyspace assigns a symbol to the keyword or identifier relevant to the violation.

Settings

Default: required-rules

required-rules

Check required coding rules.

all-rules

Check required and advisory coding rules.

SQO-subset1

Check only a subset of MISRA C++ rules. For more information, see Software Quality Objective Subsets for MISRA Coding Standards.

SQO-subset2

Check a subset of rules including SQO-subset1 and some additional rules. For more information, see Software Quality Objective Subsets for MISRA Coding Standards

from-file

Specify an XML file where you configure a custom selection of checkers for this coding standard. To create a configuration file, click , then select the rules and recommendations you want to check for this coding standard from the right pane of the Checkers selection window. Save the file.

To use or update an existing configuration file, in the Checkers selection window, enter the full path to the file in the field provided or click Browse.

If you set the option to from-file, enable Set checkers by file (-checkers-selection-file).

Dependencies

This option is available only if you set Source code language (-lang) to CPP or C-CPP.

For projects with mixed C and C++ code, the MISRA C++ checker analyzes only .cpp files.

Command-Line Information

Use the command -misra-cpp in the command line to check for violations of MISRA C++ rules.

Parameter: -misra-cpp
Value: required-rules | all-rules | SQO-subset1 | SQO-subset2 | from-file
Example (Bug Finder): polyspace-bug-finder -sources file_name -misra-cpp all-rules
Example (Bug Finder Server): polyspace-bug-finder-server -sources file_name -misra-cpp all-rules

Alternatively, enable all or specific MISRA C++ rules through a checkers activation XML file. See Checkers activation file (-checkers-activation-file).

Version History

expand all


1 MISRA is a registered trademark of MIRA Ltd., held on behalf of the MISRA Consortium.