Skip to content

Commit c9c55c9

Browse files
authored
Fix #12417: False positive: misra-config for struct (#5954)
1 parent eef13b6 commit c9c55c9

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

addons/misra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3334,7 +3334,7 @@ def misra_config(self, data):
33343334
continue
33353335
if not tok.isName:
33363336
continue
3337-
if tok.function or tok.variable or tok.varId or tok.valueType:
3337+
if tok.function or tok.variable or tok.varId or tok.valueType or tok.typeScope:
33383338
continue
33393339
if tok.next.str == "(" or tok.str in ["EOF"]:
33403340
continue

addons/test/misra/misra-test.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,16 @@ static void misra_14_4(bool b) {
13571357
if (z) {} //config
13581358
}
13591359

1360+
// #12417
1361+
struct bar_12417{ int a; };
1362+
static int foo_12417(void){
1363+
int ret = 1;
1364+
if (sizeof(struct bar_12417) == 0U){ // no warning for misra-config
1365+
ret = 0;
1366+
}
1367+
return ret;
1368+
}
1369+
13601370
static void misra_15_1(void) {
13611371
goto a1; // 15.1
13621372
a1:

0 commit comments

Comments
 (0)