Skip to main content

IAR Embedded Workbench for RH850 3.20.x

MISRAC2012-Rule-5.5_c99

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 63 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:

/*          0        1         2         3         4         5         6     */
/*          123456789012345678901234567890123456789012345678901234567890123* */
#define     n01_var_hides_macro__________________________________________63x 1
#define     n02_function_hides_macro_____________________________________63x 1
#define     n03_param_hides_macro________________________________________63x 1
#define     n04_type_hides_macro_________________________________________63x 1
#define     n05_tag_hides_macro__________________________________________63x 1
#define     n06_label_hides_macro________________________________________63x 1

int         n01_var_hides_macro__________________________________________63y;
void        n02_function_hides_macro_____________________________________63y(
        int n03_param_hides_macro________________________________________63y){}
typedef int n04_type_hides_macro_________________________________________63y;
struct      n05_tag_hides_macro__________________________________________63y {
  int x;
};
void f1() {
n06_label_hides_macro________________________________________63y:
}

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;
}