Misra: Fix FP, rule 15.6

This commit is contained in:
Daniel Marjamäki 2017-04-17 10:39:05 +02:00
parent a47a5e55e4
commit 892f11b7f1
2 changed files with 7 additions and 2 deletions

View File

@ -169,9 +169,12 @@ int misra_15_5() {
void misra_15_6() { void misra_15_6() {
if (x!=0); // 15.6 if (x!=0); // 15.6
else{} else{}
#if A
#if A>1 // no-warning
(void)0; (void)0;
#endif #endif
do {} while (x<0); // no-warning
} }
void misra_15_7() { void misra_15_7() {

View File

@ -641,7 +641,9 @@ def misra_15_6(rawTokens):
tok1 = None tok1 = None
for token in rawTokens: for token in rawTokens:
if token.str in ['if', 'for', 'while']: 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 continue
state = 1 state = 1
indent = 0 indent = 0