Main Content

Allowed pragmas (-allowed-pragmas)

(Removed) Specify pragma directives that are documented

This option applies only to coding rules, which has been removed from Code Prover. Use Allowed pragmas (-allowed-pragmas) in Bug Finder instead. For more information, see Version History.

Description

Specify pragma directives that must not be flagged by MISRA C™:2004 rule 3.4 or MISRA™ C++ rule 16-6-1. These rules require that you document all pragma directives.

Set Option

User interface (desktop products only): In your project configuration, the option is on the Coding Standards & Code Metrics node. For other options that you must also enable, see Dependencies.

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

Why Use This Option

MISRA C:2004/MISRA AC AGC rule 3.4 and MISRA C++ rule 16-6-1 require that all pragma directives are documented within the documentation of the compiler. If you list a pragma as documented by using this analysis option, Polyspace does not flag use of the pragma as a violation of these rules.

Settings

No Default

To add a field, click . Enter the pragma name that you want Polyspace® to ignore during coding rule checking.

Dependencies

This option is enabled only if you select one of these options:

Tips

Enter only the name of the pragma 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 (Code Prover): polyspace-code-prover -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
Example (Code Prover Server): polyspace-code-prover-server -sources filename -misra-cpp required-rules -allowed-pragmas pragma_01,pragma_02

Version History

expand all

R2024a: Removed from Code Prover

If you use the option -allowed-pragmas in a Code Prover analysis, Polyspace issues a warning and the analysis ignores the option. The workflow for checking coding rule violation has been removed from Code Prover. To check for coding rule violations, use Bug Finder. For instance, at the command line, replace this command:

polyspace-code-prover -sources SRC -misra-cpp all-rules -allowed-pragmas pragma_01
with this command:
polyspace-bug-finder -sources SRC -misra-cpp all-rules -allowed-pragmas pragma_01
See Migrate Code Prover Workflows for Checking Coding Standards and Code Metrics to Bug Finder.