diff --git a/addons/misra.py b/addons/misra.py index 21a353e2d..0ca52d634 100755 --- a/addons/misra.py +++ b/addons/misra.py @@ -1479,6 +1479,8 @@ class MisraChecker: continue if not simpleMatch(scope.bodyStart, '{ if ('): continue + if scope.bodyStart.col > 0: + continue tok = scope.bodyStart.next.next.link if not simpleMatch(tok, ') {'): continue diff --git a/addons/test/misra/misra-test.c b/addons/test/misra/misra-test.c index 72f0ae110..fc50b6d77 100644 --- a/addons/test/misra/misra-test.c +++ b/addons/test/misra/misra-test.c @@ -397,6 +397,9 @@ void misra_15_7() { var2 = 10u; } // no-warning } + + if (a==2) {} else if (b==4) {} // 15.7 + if (a==2) {} else { if (b==4) {} } // no-warning } void misra_16_2() {