diff --git a/addons/misra-test.c b/addons/misra-test.c index 3c35592cd..c8470684f 100644 --- a/addons/misra-test.c +++ b/addons/misra-test.c @@ -169,9 +169,12 @@ int misra_15_5() { void misra_15_6() { if (x!=0); // 15.6 else{} -#if A + +#if A>1 // no-warning (void)0; #endif + + do {} while (x<0); // no-warning } void misra_15_7() { diff --git a/addons/misra.py b/addons/misra.py index 6853db599..6a03bf3c7 100644 --- a/addons/misra.py +++ b/addons/misra.py @@ -641,7 +641,9 @@ def misra_15_6(rawTokens): tok1 = None for token in rawTokens: if token.str in ['if', 'for', 'while']: - if token.previous and token.previous.str == '#': + if simpleMatch(token.previous, '# if'): + continue + if simpleMatch(token.previous, "} while"): continue state = 1 indent = 0