MISRA C++:2008 Rule 16-6-1
All uses of the #pragma directive shall be documented
Description
Rule Definition
All uses of the #pragma directive shall be documented.
Rationale
Because the behaviors of #pragma
directives depend on the set of
software, hardware, and compilers that you use, the developer's intent for a
#pragma
directive might be unclear. To clearly communicate the
developer intent and the expected behavior of a #pragma
directive, for
each of these directives, document:
The meaning
The detailed expected behavior
The implication of the directive for the code
Document the preceding factors in sufficient detail to show that you fully
understand what the #pragma
directives mean and how they might impact the
code. Avoid using #pragma
directives as much as possible. Encapsulate
their use in dedicated functions whenever possible.
Polyspace Implementation
To check this rule, list the pragmas that are allowed in source files by using the
option Allowed pragmas
(-allowed-pragmas)
. If Polyspace® finds a pragma not in the allowed pragma list, a violation is raised.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Check Information
Group: Preprocessing Directives |
Category: Document |
Version History
Introduced in R2016b