misra addon: handle [[fallthrough]] attribute

This commit is contained in:
Daniel Marjamäki 2018-03-12 13:43:23 +01:00
parent 0d2171a553
commit f10d170ad3
2 changed files with 8 additions and 0 deletions

View File

@ -809,6 +809,8 @@ def misra_16_3(rawTokens):
elif token.str.startswith('/*') or token.str.startswith('//'):
if 'fallthrough' in token.str.lower():
state = 2
elif simpleMatch(token, '[ [ fallthrough ] ] ;'):
state = 1
elif token.str == '{':
state = 2
elif token.str == 'case' and state != 2:

View File

@ -220,6 +220,12 @@ void misra_16_3() {
// fallthrough
case 5:
break;
case 7:
a=3;
[[fallthrough]];
case 8:
a=4;
break;
default: break;
}
}