Main Content

Allowed pragmas (-allowed-pragmas)

Specify pragma directives that are documented

Description

Specify pragma directives that must not be flagged by these coding rules that require you to document all pragma directives:

  • MISRA C™:2004 rule 3.4

  • MISRA™ C++ rule 16-6-1

  • MISRA C:2012 and MISRA C:2023 Directive 1.1

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 the Defects and Coding Standards > Checkers Behavior node and then enter values for this option. See Dependencies for other options you must enable first.

  • Command line and options file: Use the option -allowed-pragmas. See Command-Line Information.

Why Use This Option

Some MISRA C coding rules require that all pragma directives are documented within the documentation of the compiler. If you list a pragma as documented using this analysis option, Polyspace does not flag use of the pragma as a violation of these rules.

Settings

No Default

Enter the pragma name that you want Polyspace® to ignore during coding rule checking.

  • Add a single pragma name by clicking the Add empty row button and entering the name of the pragma.

  • Add or update multiple pragma names by clicking the Add/edit multiple rows button and entering one name per line in the Add/edit multiple rows dialog box. Leading and trailing spaces are trimmed, and empty lines are ignored.

Dependencies

This option is enabled only if you select one of these options in the Polyspace user interface:

Or the option Use custom checkers file in the Polyspace Platform user interface.

Tips

Enter the name of the pragma only excluding any argument. For instance, if you use the pragma pack:

#pragma pack(n)
Enter only the name pack for this option.

Command-Line Information

Parameter: -allowed-pragmas
Value: pragma1[,pragma2[,...]]
Example (Bug Finder): polyspace-bug-finder -sources filename -misra-cpp required-rules -allowed-pragmas pragma_01,pragma_02
Example (Bug Finder Server): polyspace-bug-finder-server -sources filename -misra-cpp required-rules -allowed-pragmas pragma_01,pragma_02

Version History

expand all