@@ -1308,7 +1308,7 @@ def misra_20_14(data):
13081308 elif directive .str == '#endif' :
13091309 if len (ifStack ) == 0 :
13101310 reportError (directive , 20 , 14 )
1311- elif directive .file != ifStack [- 1 ].file :
1311+ elif directive .file != ifStack [- 1 ].file :
13121312 reportError (directive , 20 , 14 )
13131313 ifStack .pop ()
13141314
@@ -1330,6 +1330,15 @@ def misra_21_5(data):
13301330 reportError (directive , 21 , 5 )
13311331
13321332
1333+ def misra_21_6 (data ):
1334+ dir_stdio = findInclude (data .directives , '<stdio.h>' )
1335+ dir_wchar = findInclude (data .directives , '<wchar.h>' )
1336+ if dir_stdio :
1337+ reportError (dir_stdio , 21 , 6 )
1338+ if dir_wchar :
1339+ reportError (dir_wchar , 21 , 6 )
1340+
1341+
13331342def misra_21_7 (data ):
13341343 for token in data .tokenlist :
13351344 if isFunctionCall (token ) and (token .astOperand1 .str in {'atof' , 'atoi' , 'atol' , 'atoll' }):
@@ -1348,6 +1357,16 @@ def misra_21_9(data):
13481357 reportError (token , 21 , 9 )
13491358
13501359
1360+ def misra_21_10 (data ):
1361+ directive = findInclude (data .directives , '<time.h>' )
1362+ if directive :
1363+ reportError (directive , 21 , 10 )
1364+
1365+ for token in data .tokenlist :
1366+ if (token .str == 'wcsftime' ) and token .next and token .next .str == '(' :
1367+ reportError (token , 21 , 10 )
1368+
1369+
13511370def misra_21_11 (data ):
13521371 directive = findInclude (data .directives , '<tgmath.h>' )
13531372 if directive :
@@ -1603,9 +1622,11 @@ def generateTable():
16031622 misra_21_3 (cfg )
16041623 misra_21_4 (cfg )
16051624 misra_21_5 (cfg )
1625+ misra_21_6 (cfg )
16061626 misra_21_7 (cfg )
16071627 misra_21_8 (cfg )
16081628 misra_21_9 (cfg )
1629+ misra_21_10 (cfg )
16091630 misra_21_11 (cfg )
16101631 # 22.4 is already covered by Cppcheck writeReadOnlyFile
16111632 if VERIFY :
0 commit comments