Fixed #10486 (FP: misra-c2012-8.4)

This commit is contained in:
Daniel Marjamäki 2021-09-20 21:27:05 +02:00
parent adb703c09d
commit 47ea670eb3
2 changed files with 7 additions and 4 deletions

View File

@ -1975,11 +1975,11 @@ class MisraChecker:
if var.nameToken is None:
continue
if var.isExtern:
extern_vars.append(var.nameToken)
extern_vars.append(var.nameToken.str)
else:
var_defs.append(var.nameToken)
for vartok in var_defs:
if vartok not in extern_vars:
if vartok.str not in extern_vars:
self.reportError(vartok, 8, 4)
def misra_8_5(self, dumpfile, cfg):

View File

@ -124,7 +124,7 @@ int misra_5_1_var_hides_var________d; //5.1 8.4
int misra_5_1_var_hides_var________e; //5.1 8.4
extern const uint8_t misra_5_2_var1;
const uint8_t misra_5_2_var1 = 3; // 8.4
const uint8_t misra_5_2_var1 = 3;
static int misra_5_2_var_hides_var______31x;
static int misra_5_2_var_hides_var______31y;//5.2
static int misra_5_2_function_hides_var_31x;
@ -382,9 +382,12 @@ static int misra_8_2_q
void misra_8_4_foo(void) {} // 8.4
static void misra_8_4_bar(void) {} // Declared in header
extern int16_t misra_8_4_count; // no-warning
int16_t misra_8_4_count = 0; // 8.4
int16_t misra_8_4_count = 0; // Compliant
extern uint8_t misra_8_4_buf1[13]; // no-warning
uint8_t misra_8_4_buf2[24]; // 8.4
typedef struct { uint16_t a; uint16_t b; } misra_8_4_struct;
extern misra_8_4_struct bar[42];
misra_8_4_struct bar[42]; // compliant
static int32_t misra_8_8 = 123;
extern int32_t misra_8_8; // 8.8