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

Method misra_21_16

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

Source from the content-addressed store, hash-verified

4081 self.reportError(token, 21, 15)
4082
4083 def misra_21_16(self, cfg):
4084 for token in cfg.tokenlist:
4085 if token.str != 'memcmp':
4086 continue
4087 name, args = cppcheckdata.get_function_call_name_args(token)
4088 if name is None:
4089 continue
4090 if len(args) != 3:
4091 continue
4092 for arg in args[:2]:
4093 if arg.valueType is None:
4094 continue
4095 if arg.valueType.pointer > 1:
4096 continue
4097 if getEssentialTypeCategory(arg) in ('unsigned', 'signed', 'bool'):
4098 continue
4099 if arg.valueType.isEnum():
4100 continue
4101 self.reportError(token, 21, 16)
4102
4103 def misra_21_19(self, cfg):
4104 for token in cfg.tokenlist:

Callers

nothing calls this directly

Calls 3

reportErrorMethod · 0.95
getEssentialTypeCategoryFunction · 0.85
isEnumMethod · 0.80

Tested by

no test coverage detected