MISRA C:2023 Rule 5.4
Description
Rule Definition
Macro identifiers shall be distinct.
Rationale
The names of macro identifiers must be distinct from both other macro identifiers and their parameters.
Polyspace Implementation
The checker raises a violation if two macros that have the same first 63 characters are defined with different values. The checker does not raise a violation if the same macro is defined with different values but the macro is undefined in between.
The cutoff of 63 characters applies to a C99-based analysis. In C90, the cutoff is
31 characters. In other words, the checker considers two macros as effectively the
same if there is no difference in their first 31 characters. To use the C90 rules
checking, use the value c90
for the option C
standard version (-c-version)
. You can change the number of
characters compared using the option
-code-behavior-specifications
. See -code-behavior-specifications
.
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: Identifiers |
Category: Required |
AGC Category: Required |
Version History
Introduced in R2024a