Misra: Fix FP, rule 15.6

This commit is contained in:
Daniel Marjamäki 2017-04-17 09:38:46 +02:00
parent 0adc4f0789
commit a47a5e55e4
2 changed files with 11 additions and 1 deletions

View File

@ -169,6 +169,9 @@ int misra_15_5() {
void misra_15_6() {
if (x!=0); // 15.6
else{}
#if A
(void)0;
#endif
}
void misra_15_7() {

View File

@ -638,11 +638,18 @@ def misra_15_5(data):
def misra_15_6(rawTokens):
state = 0
indent = 0
tok1 = None
for token in rawTokens:
if token.str in ['if', 'for', 'while']:
if token.previous and token.previous.str == '#':
continue
state = 1
indent = 0
tok1 = token
elif state == 1:
if indent == 0 and token.str != '(':
state = 0
continue
if token.str == '(':
indent = indent + 1
elif token.str == ')':
@ -656,7 +663,7 @@ def misra_15_6(rawTokens):
continue
state = 0
if token.str != '{':
reportError(token, 15, 6)
reportError(tok1, 15, 6)
def misra_15_7(data):
for token in data.tokenlist: