Added rule 21.6 and 21.10 (#1243)
This commit is contained in:
parent
672d0433a4
commit
00970274b2
|
@ -1330,6 +1330,15 @@ def misra_21_5(data):
|
|||
reportError(directive, 21, 5)
|
||||
|
||||
|
||||
def misra_21_6(data):
|
||||
dir_stdio = findInclude(data.directives, '<stdio.h>')
|
||||
dir_wchar = findInclude(data.directives, '<wchar.h>')
|
||||
if dir_stdio:
|
||||
reportError(dir_stdio, 21, 6)
|
||||
if dir_wchar:
|
||||
reportError(dir_wchar, 21, 6)
|
||||
|
||||
|
||||
def misra_21_7(data):
|
||||
for token in data.tokenlist:
|
||||
if isFunctionCall(token) and (token.astOperand1.str in {'atof', 'atoi', 'atol', 'atoll'}):
|
||||
|
@ -1348,6 +1357,16 @@ def misra_21_9(data):
|
|||
reportError(token, 21, 9)
|
||||
|
||||
|
||||
def misra_21_10(data):
|
||||
directive = findInclude(data.directives, '<time.h>')
|
||||
if directive:
|
||||
reportError(directive, 21, 10)
|
||||
|
||||
for token in data.tokenlist:
|
||||
if (token.str == 'wcsftime') and token.next and token.next.str == '(':
|
||||
reportError(token, 21, 10)
|
||||
|
||||
|
||||
def misra_21_11(data):
|
||||
directive = findInclude(data.directives, '<tgmath.h>')
|
||||
if directive:
|
||||
|
@ -1603,9 +1622,11 @@ for arg in sys.argv[1:]:
|
|||
misra_21_3(cfg)
|
||||
misra_21_4(cfg)
|
||||
misra_21_5(cfg)
|
||||
misra_21_6(cfg)
|
||||
misra_21_7(cfg)
|
||||
misra_21_8(cfg)
|
||||
misra_21_9(cfg)
|
||||
misra_21_10(cfg)
|
||||
misra_21_11(cfg)
|
||||
# 22.4 is already covered by Cppcheck writeReadOnlyFile
|
||||
if VERIFY:
|
||||
|
|
|
@ -5,8 +5,12 @@
|
|||
#include /*abc*/ "file.h" // 20.3
|
||||
#include <setjmp.h> // 21.4
|
||||
#include <signal.h> // 21.5
|
||||
#include <stdio.h> //21.6
|
||||
#include <wchar.h> //21.6
|
||||
#include <time.h> // 21.10
|
||||
#include <tgmath.h> // 21.11
|
||||
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
|
|
Loading…
Reference in New Issue