diff --git a/addons/misra.py b/addons/misra.py index 606c8f3ed..d00a8f56d 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -781,7 +781,7 @@ def misra_10_1(data): reportError(token, 10, 1) def misra_10_4(data): - op = {'+', '-', '*', '/', '%', '&', '|', '^', '+=', '-=', '?', ':'} + op = {'+', '-', '*', '/', '%', '&', '|', '^', '+=', '-=', ':'} for token in data.tokenlist: if token.str not in op and not token.isComparisonOp: continue diff --git a/addons/test/misra-test.c b/addons/test/misra-test.c index b3df1ae63..1d143972c 100644 --- a/addons/test/misra-test.c +++ b/addons/test/misra-test.c @@ -153,13 +153,15 @@ void misra_10_1() { void misra_10_4(u32 x, s32 y) { z = x + 3; // 10.4 - enum misra_10_4_enuma { misra_10_4_A1, misra_10_4_A2, misra_10_4_A3 }; + enum misra_10_4_enuma { misra_10_4_A1, misra_10_4_A2, misra_10_4_A3 } a; enum misra_10_4_enumb { misra_10_4_B1, misra_10_4_B2, misra_10_4_B3 }; if ( misra_10_4_B1 > misra_10_4_A1 ) //10.4 { ; } - z = x + y; //10.4 + z = x + y; //10.4 + z = (a == misra_10_4_A3) ? x : y; //10.4 + z = (a == misra_10_4_A3) ? y : y; // no-warning } void misra_10_6(u8 x, u32 a, u32 b) {