Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #12417: False positive: misra-config for struct #5954

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading