-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Labels:
-
Message:Document this #pragma directive
-
Default Severity:Major
-
Impact:Low
-
Likelihood:High
-
Covered Languages:C, C++, Objective-C
-
Remediation Function:Constant/Issue
-
Constant Cost:10min
-
CERT:MSC00-C.
-
MISRA C 2004:3.4
-
MISRA C++ 2008:16-6-1
The #pragma directive is implementation-defined, hence it is important both to demonstrate that all uses are correct, and to minimize, localize and encapsulate any use of pragmas within dedicated functions whenever possible.
The meaning of each pragma shall be documented.
There shall be sufficient supporting description to demonstrate that the behavior of the pragma and its implications for the application, have been fully understood.
This rule flags all instances of #pragma directives, and leaves it to the user to determine whether they have been properly documented.
See
- MISRA C:2004, 3.4 - All uses of the #pragma directive shall be documented and explained
- MISRA C++:2008, 16-6-1 - All uses of the #pragma directive shall be documented
- CERT, MSC00-C - Compile cleanly at high warning levels
- is depended upon by
-
CPP-320 Rule: All uses of the #pragma directive shall be documented and explained (MISRA C 3.4, MISRA C++ 16-6-1)
-
- Closed
-
- is implemented by
-
CPP-707 Create Objective-C rules repository containing targeted rules
-
- Closed
-
-
CPP-463 The description of rule "All uses of the #pragma directive shall be documented ..." must be improved to explain what "documented" mean
-
- Closed
-
- is related to
-
CPP-2067 S793: Fix false-positives by Whitelisting the usage of "#pragma once" from this rule
-
- Closed
-