MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / misra_16_6

Method misra_16_6

addons/misra.py:3410–3427  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

3408 self.reportError(token, 16, 5)
3409
3410 def misra_16_6(self, data):
3411 for token in data.tokenlist:
3412 if not (simpleMatch(token, 'switch (') and simpleMatch(token.next.link, ') {')):
3413 continue
3414 tok = token.next.link.next.next
3415 count = 0
3416 while tok:
3417 if tok.str in ['break', 'return', 'throw']:
3418 count = count + 1
3419 elif tok.str == '{':
3420 tok = tok.link
3421 if isNoReturnScope(tok):
3422 count = count + 1
3423 elif tok.str == '}':
3424 break
3425 tok = tok.next
3426 if count < 2:
3427 self.reportError(token, 16, 6)
3428
3429 def misra_16_7(self, data):
3430 for token in data.tokenlist:

Callers

nothing calls this directly

Calls 3

reportErrorMethod · 0.95
isNoReturnScopeFunction · 0.85
simpleMatchFunction · 0.70

Tested by

no test coverage detected