Misra: Add rule 20.3

This commit is contained in:
Daniel Marjamäki 2017-04-14 22:25:35 +02:00
parent 79ef26d7a2
commit c8d3cccc21
2 changed files with 10 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#include <stdarg.h> // 17.1
#include "path\file.h" // 20.2
#include /*abc*/ "file.h" // 20.3
typedef unsigned char u8;

View File

@ -574,6 +574,14 @@ def misra_20_2(rawTokens):
reportError(token, 20, 2)
break
def misra_20_3(rawTokens):
for token in rawTokens:
if not simpleMatch(token, '# include'):
continue
headerToken = token.next.next
if not headerToken or not (headerToken.str.startswith('<') or headerToken.str.startswith('"')):
reportError(token, 20, 3)
if '-verify' in sys.argv[1:]:
VERIFY = True
@ -642,6 +650,7 @@ for arg in sys.argv[1:]:
if cfgNumber == 1:
misra_20_1(data.rawTokens)
misra_20_2(data.rawTokens)
misra_20_3(data.rawTokens)
if VERIFY:
for expected in VERIFY_EXPECTED: