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

Method misra_17_3

addons/misra.py:3492–3509  ·  view source on GitHub ↗
(self, cfg)

Source from the content-addressed store, hash-verified

3490 tok = tok.next
3491
3492 def misra_17_3(self, cfg):
3493 # Check for Clang warnings related to implicit function declarations
3494 for w in cfg.clang_warnings:
3495 if w['message'].endswith('[-Wimplicit-function-declaration]'):
3496 self.reportError(cppcheckdata.Location(w), 17, 3)
3497
3498 # Additional check for implicit function calls in expressions
3499 for token in cfg.tokenlist:
3500 if token.isName and token.function is None and token.valueType is None:
3501 if token.next and token.next.str == "(" and token.next.valueType is None:
3502 if token.next.next.str == "*" and \
3503 token.next.next.next.isName and token.next.next.next.valueType is not None and \
3504 token.next.next.next.valueType.pointer > 0 :
3505 # this is a function pointer definition the tokens look like this int16_t ( * misra_8_2_p_a ) ()
3506 # and the int16_t causes the detection as the '(' follows
3507 continue
3508 if not isKeyword(token.str,cfg.standards.c) and not isStdLibId(token.str,cfg.standards.c):
3509 self.reportError(token, 17, 3)
3510
3511 def misra_config(self, data):
3512 for var in data.variables:

Callers

nothing calls this directly

Calls 4

reportErrorMethod · 0.95
isStdLibIdFunction · 0.85
isKeywordFunction · 0.70
LocationMethod · 0.45

Tested by

no test coverage detected