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

Method misra_21_1

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

Source from the content-addressed store, hash-verified

3925 ifStack.pop()
3926
3927 def misra_21_1(self, data):
3928 re_forbidden_macro = re.compile(r'#(?:define|undef) _[_A-Z]+')
3929 re_macro_name = re.compile(r'#(?:define|undef) (.+)[ $]')
3930
3931 for d in data.directives:
3932 # Search for forbidden identifiers
3933 m = re.search(re_forbidden_macro, d.str)
3934 if m:
3935 self.reportError(d, 21, 1)
3936 continue
3937
3938 # Search standard library identifiers in macro names
3939 m = re.search(re_macro_name, d.str)
3940 if not m:
3941 continue
3942 name = m.group(1)
3943 if isStdLibId(name, data.standards.c):
3944 self.reportError(d, 21, 1)
3945
3946 def misra_21_2(self, cfg):
3947 for directive in cfg.directives:

Callers

nothing calls this directly

Calls 3

reportErrorMethod · 0.95
isStdLibIdFunction · 0.85
compileMethod · 0.80

Tested by

no test coverage detected