From f10d170ad3eb9fa832d947397e405a7e860d5589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 12 Mar 2018 13:43:23 +0100 Subject: [PATCH] misra addon: handle [[fallthrough]] attribute --- addons/misra.py | 2 ++ addons/test/misra-test.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/addons/misra.py b/addons/misra.py index d817fd168..61caaadc6 100644 --- a/addons/misra.py +++ b/addons/misra.py @@ -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: diff --git a/addons/test/misra-test.c b/addons/test/misra-test.c index 528357caf..28a56e6fc 100644 --- a/addons/test/misra-test.c +++ b/addons/test/misra-test.c @@ -220,6 +220,12 @@ void misra_16_3() { // fallthrough case 5: break; + case 7: + a=3; + [[fallthrough]]; + case 8: + a=4; + break; default: break; } }