From 892f11b7f1371e01b5605d6e6e882c01d4830d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 17 Apr 2017 10:39:05 +0200 Subject: [PATCH] Misra: Fix FP, rule 15.6 --- addons/misra-test.c | 5 ++++- addons/misra.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) 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