Skip to content

Commit

Permalink
Fix #12417: False positive: misra-config for struct (#5954)
Browse files Browse the repository at this point in the history
  • Loading branch information
swasti16 authored and danmar committed Feb 16, 2024
1 parent e9c4d5b commit 51cbbda
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 @@ -3335,7 +3335,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 @@ -1355,6 +1355,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

1 comment on commit 51cbbda

@bjornfor
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We detected the changed/force pushed 2.13.4 tag in nixpkgs: NixOS/nixpkgs#289096 (comment)

As a downstream packager I suggest to create new tags instead of updating existing ones.

Thanks!

Please sign in to comment.