Main Content
MISRA C:2012 Rule 20.9
All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be #define’d before evaluation
Description
Rule Definition
All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be #define’d before evaluation.
Rationale
If attempt to use a macro identifier in a preprocessing directive, and you have not defined that identifier, then the preprocessor assumes that it has a value of zero. This value might not meet developer expectations.
Additional Message in Report
Identifier
is not defined.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Preprocessing Directives |
Category: Required |
AGC Category: Required |