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

Method misra_13_1

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

Source from the content-addressed store, hash-verified

2989
2990
2991 def misra_13_1(self, data):
2992 for token in data.tokenlist:
2993 if simpleMatch(token, ") {") and token.next.astParent == token.link:
2994 pass
2995 elif not simpleMatch(token, '= {'):
2996 continue
2997 init = token.next
2998 end = init.link
2999 if not end:
3000 continue # syntax is broken
3001
3002 tn = init
3003 while tn and tn != end:
3004 if tn.str == '[' and tn.link:
3005 tn = tn.link
3006 if tn and tn.next and tn.next.str == '=':
3007 tn = tn.next.next
3008 continue
3009 break
3010 if tn.str == '.' and tn.next and tn.next.isName:
3011 tn = tn.next
3012 if tn.next and tn.next.str == '=':
3013 tn = tn.next.next
3014 continue
3015 if tn.str in {'++', '--'} or tn.isAssignmentOp:
3016 self.reportError(init, 13, 1)
3017 tn = tn.next
3018
3019 def misra_13_3(self, data):
3020 for token in data.tokenlist:

Callers

nothing calls this directly

Calls 2

reportErrorMethod · 0.95
simpleMatchFunction · 0.70

Tested by

no test coverage detected