Skip to main content

IAR Embedded Workbench for RX 5.20

MISRAC2012-Rule-5.4_c89

In this section:
Synopsis

(Required) Macro identifiers shall be distinct.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Macro names were found that are not distinct in their first 31 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:

/*         1234567890123456789012345678901***  */
#define    n01_macro_hides_macro________31x 1
#define    n02_param_hides_macro________31x 1
#define    n03_macro_hides_param________31x 1

#define    n01_macro_hides_macro________31y 2
#define m1(n02_param_hides_macro________31y) (n01_param_hides_macro________31y + 1)
#define    n03_macro_hides_param________31y 2

#define m2(n04_param_hides_param________31x,\
           n04_param_hides_param________31y) 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)