Skip to content

Commit

Permalink
Fix #12417: False positive: misra-config for struct
Browse files Browse the repository at this point in the history
  • Loading branch information
swasti16 committed Feb 6, 2024
1 parent eaac4a2 commit d7b600c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -3334,7 +3334,7 @@ def misra_config(self, data):
continue
if not tok.isName:
continue
if tok.function or tok.variable or tok.varId or tok.valueType:
if tok.function or tok.variable or tok.varId or tok.valueType or tok.typeScope:
continue
if tok.next.str == "(" or tok.str in ["EOF"]:
continue
Expand Down
10 changes: 10 additions & 0 deletions addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,16 @@ static void misra_14_4(bool b) {
if (z) {} //config
}

// #12417
struct bar_12417{ int a; };
static int foo_12417(void){
int ret = 1;
if (sizeof(struct bar_12417) == 0U){ // no warning for misra-config
ret = 0;
}
return ret;
}

static void misra_15_1(void) {
goto a1; // 15.1
a1:
Expand Down

0 comments on commit d7b600c

Please sign in to comment.