MISRA C:2012 Rule 5.4
Macro identifiers shall be distinct
Description
Rule Definition
Macro identifiers shall be distinct1 .
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 R2014bSee Also
MISRA C:2012 Rule 5.1 | MISRA C:2012 Rule 5.2 | MISRA C:2012 Rule 5.5 | Check MISRA C:2012 (-misra3)
1 All MISRA coding rules and directives are © Copyright The MISRA Consortium Limited 2021.
The MISRA coding standards referenced in the Polyspace® Bug Finder™ documentation are from the following MISRA standards:
- MISRA C:2004 
- MISRA C:2012 
- MISRA C:2023 
- MISRA C++:2008 
- MISRA C++:2023 
MISRA and MISRA C are registered trademarks of The MISRA Consortium Limited 2021.