MISRAC2012-Rule-5.4_c99
In this section:
Synopsis
(Required) Macro identifiers shall be distinct.
Enabled by default
Yes
Severity/Certainty
Low/Medium

Full description
Macro names were found that are not distinct in their first 63 characters from their macro parameters or other macro names.
Coding standards
- MISRA C:2012 Rule-5.4
(Required) Macro identifiers shall be distinct
Code examples
The following code example fails the check and will give a warning:
/* 0 1 2 3 4 5 6 */
/* 123456789012345678901234567890123456789012345678901234567890123* */
#define n01_macro_hides_macro________________________________________63x 1
#define n02_param_hides_macro________________________________________63x 1
#define n03_macro_hides_param________________________________________63x 1
#define n01_macro_hides_macro________________________________________63y 2
#define m1(n02_param_hides_macro________________________________________63y) \
(n01_param_hides_macro________________________________________63y + 1)
#define n03_macro_hides_param________________________________________63y 2
#define m2(n04_param_hides_param________________________________________63x, \
n04_param_hides_param________________________________________63y) 1
The following code example passes the check and will not give a warning about this issue:
#define m1(n01_param_of_other_macro) (n01_param_hides_macro + 1) #define m2(n01_param_of_other_macro) (n01_param_hides_macro + 1)