misra: fix 16.3 false negative for conditional break

This commit is contained in:
Daniel Marjamäki 2018-05-04 22:27:45 +02:00
parent 8be593db8f
commit 904e9149bf
1 changed files with 2 additions and 2 deletions

View File

@ -983,10 +983,10 @@ def misra_16_3(rawTokens):
state = STATE_BREAK state = STATE_BREAK
elif token.str == '{': elif token.str == '{':
state = STATE_OK state = STATE_OK
elif token.str == '}' and state == STATE_BREAK: elif token.str == '}' and state == STATE_OK:
# is this {} an unconditional block of code? # is this {} an unconditional block of code?
link = findRawLink(token) link = findRawLink(token)
if (link is None) or (link.previous is None) or (link.previous not in ':;{}'): if (link is None) or (link.previous is None) or (link.previous.str not in ':;{}'):
state = STATE_NONE state = STATE_NONE
elif token.str == 'case' or token.str == 'default': elif token.str == 'case' or token.str == 'default':
if state != STATE_OK: if state != STATE_OK: