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

Method misra_1_4

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

Source from the content-addressed store, hash-verified

1702
1703
1704 def misra_1_4(self, cfg):
1705 for token in cfg.tokenlist:
1706 if token.str in ('_Atomic', '_Noreturn', '_Generic', '_Thread_local', '_Alignas', '_Alignof'):
1707 self.reportError(token, 1, 4)
1708 if token.str.endswith('_s') and isFunctionCall(token.next, cfg.standards.c):
1709 # See C specification C11 - Annex K, page 578
1710 if token.str in ('tmpfile_s', 'tmpnam_s', 'fopen_s', 'freopen_s', 'fprintf_s', 'fscanf_s', 'printf_s', 'scanf_s',
1711 'snprintf_s', 'sprintf_s', 'sscanf_s', 'vfprintf_s', 'vfscanf_s', 'vprintf_s', 'vscanf_s',
1712 'vsnprintf_s', 'vsprintf_s', 'vsscanf_s', 'gets_s', 'set_constraint_handler_s', 'abort_handler_s',
1713 'ignore_handler_s', 'getenv_s', 'bsearch_s', 'qsort_s', 'wctomb_s', 'mbstowcs_s', 'wcstombs_s',
1714 'memcpy_s', 'memmove_s', 'strcpy_s', 'strncpy_s', 'strcat_s', 'strncat_s', 'strtok_s', 'memset_s',
1715 'strerror_s', 'strerrorlen_s', 'strnlen_s', 'asctime_s', 'ctime_s', 'gmtime_s', 'localtime_s',
1716 'fwprintf_s', 'fwscanf_s', 'snwprintf_s', 'swprintf_s', 'swscanf_s', 'vfwprintf_s', 'vfwscanf_s',
1717 'vsnwprintf_s', 'vswprintf_s', 'vswscanf_s', 'vwprintf_s', 'vwscanf_s', 'wprintf_s', 'wscanf_s',
1718 'wcscpy_s', 'wcsncpy_s', 'wmemcpy_s', 'wmemmove_s', 'wcscat_s', 'wcsncat_s', 'wcstok_s', 'wcsnlen_s',
1719 'wcrtomb_s', 'mbsrtowcs_s', 'wcsrtombs_s'):
1720 self.reportError(token, 1, 4)
1721
1722 def misra_2_2(self, cfg):
1723 for token in cfg.tokenlist:

Callers

nothing calls this directly

Calls 2

reportErrorMethod · 0.95
isFunctionCallFunction · 0.70

Tested by

no test coverage detected