Skip to main content

IAR Embedded Workbench for RISC-V 3.40

MISRAC2012-Rule-5.5_c89

In this section:
Synopsis

(Required) Identifiers shall be distinct from macro names.

Enabled by default

Yes

Severity/Certainty

Low/Medium

lowmedium.png
Full description

Non-macro identifiers were found that are not distinct in their first 31 characters from macro names.

Coding standards
MISRA C:2012 Rule-5.5

(Required) Identifiers shall be distinct from macro names

Code examples

The following code example fails the check and will give a warning:

/*          1234567890123456789012345678901***  */
#define     n01_var_hides_macro__________31x 1
#define     n02_function_hides_macro_____31x 1
#define     n03_param_hides_macro________31x 1
#define     n04_type_hides_macro_________31x 1
#define     n05_tag_hides_macro__________31x 1
#define     n06_label_hides_macro________31x 1

int         n01_var_hides_macro__________31y;
void        n02_function_hides_macro_____31y(int n03_param_hides_macro________31y){}
typedef int n04_type_hides_macro_________31y;
struct      n05_tag_hides_macro__________31y {
  int x;
};
void f1() {
n06_label_hides_macro________31y:
}

The following code example passes the check and will not give a warning about this issue:

#define   n01_expanded_macro 1

void foo() {
  int x = n01_expanded_macro;
}