cppcheck/addons/misra.py

756 lines
22 KiB
Python
Raw Normal View History

2017-04-08 16:08:54 +02:00
#/usr/bin/python
#
2017-04-11 14:45:38 +02:00
# MISRA C 2012 checkers
2017-04-08 16:08:54 +02:00
#
# Example usage of this addon (scan a sourcefile main.cpp)
# cppcheck --dump main.cpp
# python misra.py main.cpp.dump
#
# Limitations: This addon is released as open source. Rule texts can't be freely
# distributed. https://www.misra.org.uk/forum/viewtopic.php?f=56&t=1189
#
2017-04-14 18:51:12 +02:00
# Total number of rules: 153
2017-04-08 16:08:54 +02:00
import cppcheckdata
import sys
import re
VERIFY = False
VERIFY_EXPECTED = []
VERIFY_ACTUAL = []
def reportError(location, num1, num2):
if VERIFY:
VERIFY_ACTUAL.append(str(location.linenr) + ':' + str(num1) + '.' + str(num2))
else:
sys.stderr.write('[' + location.file + ':' + str(location.linenr) + '] misra ' + str(num1) + '.' + str(num2) + ' violation\n')
2017-04-15 14:29:29 +02:00
2017-04-14 12:57:07 +02:00
def simpleMatch(token, pattern):
for p in pattern.split(' '):
if not token or token.str != p:
return False
token = token.next
return True
2017-04-13 11:05:04 +02:00
# Platform
# TODO get this from dump
CHAR_BITS = 8
SHORT_BITS = 16
INT_BITS = 32
2017-04-14 22:33:59 +02:00
KEYWORDS = ['auto',
'break',
'case',
'char',
'const',
'continue',
'default',
'do',
'double',
'else',
'enum',
'extern',
'float',
'for',
'goto',
'if',
'int',
'long',
'register',
'return',
'short',
'signed',
'sizeof',
'static',
'struct',
'switch',
'typedef',
'union',
'unsigned',
'void',
'volatile',
'while']
2017-04-13 10:04:50 +02:00
def getEssentialType(expr):
if not expr:
return None
if expr.variable:
typeToken = expr.variable.typeStartToken
while typeToken and typeToken.isName:
if typeToken.str in ['char', 'short', 'int', 'long', 'float', 'double']:
return typeToken.str
typeToken = typeToken.next
return None
def bitsOfEssentialType(expr):
type = getEssentialType(expr)
if type is None:
return 0
# TODO get --platform type sizes
2017-04-13 11:05:04 +02:00
if type == 'char':
return CHAR_BITS
if type == 'short':
return SHORT_BITS
if type == 'int':
return INT_BITS
2017-04-13 10:04:50 +02:00
return 0
2017-04-13 19:38:25 +02:00
def isFunctionCall(expr):
if not expr:
return False
if expr.str != '(' or not expr.astOperand1:
return False
if expr.astOperand1 != expr.previous:
return False
2017-04-15 15:21:55 +02:00
if expr.astOperand1.str in KEYWORDS:
2017-04-13 19:38:25 +02:00
return False
return True
def countSideEffects(expr):
if not expr or expr.str in [',', ';']:
return 0
ret = 0
if expr.str in ['++', '--', '=']:
ret = 1
return ret + countSideEffects(expr.astOperand1) + countSideEffects(expr.astOperand2)
2017-04-13 22:26:12 +02:00
def getForLoopExpressions(forToken):
if not forToken or forToken.str != 'for':
return None
lpar = forToken.next
if not lpar or lpar.str != '(':
return None
if not lpar.astOperand2 or lpar.astOperand2.str != ';':
return None
if not lpar.astOperand2.astOperand2 or lpar.astOperand2.astOperand2.str != ';':
return None
return [lpar.astOperand2.astOperand1, lpar.astOperand2.astOperand2.astOperand1, lpar.astOperand2.astOperand2.astOperand2]
2017-04-13 22:05:27 +02:00
def hasFloatComparison(expr):
if not expr:
return False
if expr.isLogicalOp:
return hasFloatComparison(expr.astOperand1) or hasFloatComparison(expr.astOperand2)
if expr.isComparisonOp:
# TODO: Use ValueType
return cppcheckdata.astIsFloat(expr.astOperand1) or cppcheckdata.astIsFloat(expr.astOperand2)
return False
2017-04-13 19:11:48 +02:00
def hasSideEffectsRecursive(expr):
2017-04-08 16:08:54 +02:00
if not expr:
return False
2017-04-08 19:00:50 +02:00
if expr.str in ['++', '--', '=']:
2017-04-08 16:08:54 +02:00
return True
# Todo: Check function calls
2017-04-13 19:11:48 +02:00
return hasSideEffectsRecursive(expr.astOperand1) or hasSideEffectsRecursive(expr.astOperand2)
2017-04-08 16:08:54 +02:00
2017-04-11 14:45:38 +02:00
def isBoolExpression(expr):
return expr and expr.str in ['!', '==', '!=', '<', '<=', '>', '>=', '&&', '||']
2017-04-13 11:05:04 +02:00
def isConstantExpression(expr):
if expr.isNumber:
return True
if expr.isName:
return False
2017-04-14 21:09:25 +02:00
if simpleMatch(expr.previous, 'sizeof ('):
return True
2017-04-13 11:05:04 +02:00
if expr.astOperand1 and not isConstantExpression(expr.astOperand1):
return False
if expr.astOperand2 and not isConstantExpression(expr.astOperand2):
return False
return True
def isUnsignedInt(expr):
# TODO this function is very incomplete. use ValueType?
if not expr:
return False
if expr.isNumber:
return expr.str.find('u')>0 or expr.str.find('U')>0
if expr.str in ['+','-','*','/','%']:
return isUnsignedInt(expr.astOperand1) or isUnsignedInt(expr.astOperand2)
return False
2017-04-11 22:21:54 +02:00
def getPrecedence(expr):
if not expr:
return 16
if not expr.astOperand1 or not expr.astOperand2:
return 16
if expr.str in ['*', '/', '%']:
return 12
if expr.str in ['+', '-']:
return 11
if expr.str in ['<<', '>>']:
return 10
if expr.str in ['<', '>', '<=', '>=']:
return 9
if expr.str in ['==', '!=']:
return 8
if expr.str == '&':
return 7
if expr.str == '^':
return 6
if expr.str == '|':
return 5
if expr.str == '&&':
return 4
if expr.str == '||':
return 3
if expr.str in ['?',':']:
return 2
if expr.isAssignmentOp:
return 1
if expr.str == ',':
return 0
return -1
def noParentheses(tok1, tok2):
while tok1 and tok1 != tok2:
if tok1.str == '(' or tok1.str == ')':
return False
tok1 = tok1.next
return tok1 == tok2
2017-04-11 14:45:38 +02:00
2017-04-13 23:02:06 +02:00
def findGotoLabel(gotoToken):
label = gotoToken.next.str
tok = gotoToken.next.next
while tok:
if tok.str == '}' and tok.scope.type == 'Function':
break
if tok.str == label and tok.next.str == ':':
return tok
tok = tok.next
return None
2017-04-15 14:29:29 +02:00
def findInclude(directives, header):
for directive in directives:
if directive.str == '#include ' + header:
return directive
2017-04-15 12:40:23 +02:00
return None
2017-04-11 14:45:38 +02:00
def misra_5_1(data):
2017-04-08 16:08:54 +02:00
for token in data.tokenlist:
if token.isName and len(token.str) > 31:
2017-04-11 22:21:54 +02:00
reportError(token, 5, 1)
2017-04-08 16:08:54 +02:00
2017-04-11 14:45:38 +02:00
def misra_7_1(rawTokens):
2017-04-09 10:11:54 +02:00
for tok in rawTokens:
2017-04-11 14:45:38 +02:00
if re.match(r'^0[0-7]+$', tok.str):
2017-04-11 22:21:54 +02:00
reportError(tok, 7, 1)
2017-04-08 16:08:54 +02:00
def misra_7_3(rawTokens):
for tok in rawTokens:
2017-04-12 19:07:10 +02:00
if re.match(r'^[0-9]+l', tok.str):
2017-04-11 22:21:54 +02:00
reportError(tok, 7, 3)
2017-04-12 16:19:13 +02:00
def misra_12_1_sizeof(rawTokens):
state = 0
for tok in rawTokens:
if tok.str.startswith('//') or tok.str.startswith('/*'):
continue
if tok.str == 'sizeof':
state = 1
elif state == 1:
if re.match(r'^[a-zA-Z_]',tok.str):
state = 2
else:
state = 0
elif state == 2:
if tok.str in ['+','-','*','/','%']:
reportError(tok, 12, 1)
else:
state = 0
2017-04-11 22:21:54 +02:00
def misra_12_1(data):
for token in data.tokenlist:
p = getPrecedence(token)
if p < 2 or p > 12:
continue
p1 = getPrecedence(token.astOperand1)
if p1 <= 12 and p1 > p and noParentheses(token.astOperand1,token):
reportError(token, 12, 1)
continue
p2 = getPrecedence(token.astOperand2)
if p2 <= 12 and p2 > p and noParentheses(token, token.astOperand2):
reportError(token, 12, 1)
continue
2017-04-13 10:04:50 +02:00
def misra_12_2(data):
for token in data.tokenlist:
if not (token.str in ['<<','>>']):
continue
if (not token.astOperand2) or (not token.astOperand2.values):
continue
maxval = 0
for val in token.astOperand2.values:
if val.intvalue > maxval:
maxval = val.intvalue
if maxval == 0:
continue
sz = bitsOfEssentialType(token.astOperand1)
if sz <= 0:
continue
if maxval >= sz:
reportError(token, 12, 2)
2017-04-12 20:18:54 +02:00
def misra_12_3(data):
for token in data.tokenlist:
if token.str != ',':
continue
if token.astParent and (token.astParent.str in ['(', ',', '{']):
2017-04-12 21:45:39 +02:00
continue
2017-04-12 20:18:54 +02:00
reportError(token, 12, 3)
2017-04-13 11:05:04 +02:00
def misra_12_4(data):
max_uint = 0
if INT_BITS == 16:
max_uint = 0xffff
elif INT_BITS == 32:
max_uint = 0xffffffff
else:
return
for token in data.tokenlist:
if (not isConstantExpression(token)) or (not isUnsignedInt(token)):
continue
if not token.values:
continue
for value in token.values:
if value.intvalue < 0 or value.intvalue > max_uint:
reportError(token, 12, 4)
break
2017-04-13 19:11:48 +02:00
def misra_13_1(data):
for token in data.tokenlist:
if token.str != '=':
continue
init = token.next
if init and init.str == '{' and hasSideEffectsRecursive(init):
reportError(init,13,1)
2017-04-13 19:38:25 +02:00
def misra_13_3(data):
for token in data.tokenlist:
if not token.astOperand1:
continue
if token.astParent and token.astParent.str != ',':
continue
if token.str == ',':
continue
if countSideEffects(token) >= 2:
reportError(token, 13, 3)
2017-04-13 19:43:06 +02:00
def misra_13_4(data):
for token in data.tokenlist:
if token.str != '=':
continue
if not token.astParent:
continue
if not (token.astParent.str in [',', ';']):
reportError(token, 13, 4)
2017-04-11 14:45:38 +02:00
def misra_13_5(data):
2017-04-08 16:08:54 +02:00
for token in data.tokenlist:
2017-04-13 19:11:48 +02:00
if token.isLogicalOp and hasSideEffectsRecursive(token.astOperand2):
2017-04-11 22:21:54 +02:00
reportError(token, 13, 5)
2017-04-08 16:08:54 +02:00
2017-04-13 21:40:59 +02:00
def misra_13_6(data):
for token in data.tokenlist:
if token.str == 'sizeof' and hasSideEffectsRecursive(token.next):
reportError(token, 13, 6)
2017-04-13 22:05:27 +02:00
def misra_14_1(data):
for token in data.tokenlist:
if token.str != 'for':
continue
2017-04-13 22:26:12 +02:00
exprs = getForLoopExpressions(token)
if exprs and hasFloatComparison(exprs[1]):
2017-04-13 22:05:27 +02:00
reportError(token, 14, 1)
2017-04-13 22:26:12 +02:00
def misra_14_2(data):
for token in data.tokenlist:
expressions = getForLoopExpressions(token)
if not expressions:
continue
if expressions[0] and not expressions[0].isAssignmentOp:
reportError(token, 14, 2)
elif hasSideEffectsRecursive(expressions[1]):
reportError(token, 14, 2)
2017-04-13 22:05:27 +02:00
2017-04-11 14:45:38 +02:00
def misra_14_4(data):
2017-04-08 16:08:54 +02:00
for token in data.tokenlist:
2017-04-11 14:45:38 +02:00
if token.str != '(':
2017-04-08 19:00:50 +02:00
continue
2017-04-11 14:45:38 +02:00
if not token.astOperand1 or not (token.astOperand1.str in ['if', 'while']):
continue
if not isBoolExpression(token.astOperand2):
2017-04-11 22:21:54 +02:00
reportError(token, 14, 4)
2017-04-08 16:08:54 +02:00
2017-04-11 14:45:38 +02:00
def misra_15_1(data):
2017-04-08 16:08:54 +02:00
for token in data.tokenlist:
2017-04-08 19:00:50 +02:00
if token.str == "goto":
2017-04-11 22:21:54 +02:00
reportError(token, 15, 1)
2017-04-08 16:08:54 +02:00
2017-04-13 22:44:43 +02:00
def misra_15_2(data):
for token in data.tokenlist:
if token.str != 'goto':
continue
if (not token.next) or (not token.next.isName):
continue
2017-04-13 23:02:06 +02:00
if not findGotoLabel(token):
reportError(token, 15, 2)
def misra_15_3(data):
for token in data.tokenlist:
if token.str != 'goto':
continue
if (not token.next) or (not token.next.isName):
continue
tok = findGotoLabel(token)
if not tok:
continue
scope = token.scope
while scope and scope != tok.scope:
scope = scope.nestedIn
if not scope:
reportError(token, 15, 3)
2017-04-08 16:08:54 +02:00
2017-04-13 23:07:41 +02:00
def misra_15_5(data):
for token in data.tokenlist:
if token.str == 'return' and token.scope.type != 'Function':
reportError(token, 15, 5)
2017-04-13 23:24:35 +02:00
def misra_15_6(rawTokens):
state = 0
indent = 0
for token in rawTokens:
if token.str in ['if', 'for', 'while']:
state = 1
indent = 0
elif state == 1:
if token.str == '(':
indent = indent + 1
elif token.str == ')':
if indent == 0:
state = 0
elif indent == 1:
state = 2
indent = indent - 1
elif state == 2:
if token.str.startswith('//') or token.str.startswith('/*'):
continue
state = 0
if token.str != '{':
reportError(token, 15, 6)
2017-04-14 08:05:14 +02:00
def misra_15_7(data):
for token in data.tokenlist:
2017-04-14 13:01:02 +02:00
if not simpleMatch(token, 'if ('):
2017-04-14 08:05:14 +02:00
continue
2017-04-14 13:01:02 +02:00
if not simpleMatch(token.next.link, ') {'):
2017-04-14 08:05:14 +02:00
continue
2017-04-14 13:01:02 +02:00
if not simpleMatch(token.next.link.next.link, '} else'):
2017-04-14 08:05:14 +02:00
reportError(token, 15, 7)
2017-04-14 08:17:32 +02:00
# TODO add 16.1 rule
def misra_16_2(data):
for token in data.tokenlist:
if token.str == 'case' and token.scope.type != 'Switch':
reportError(token, 16, 2)
2017-04-14 08:05:14 +02:00
2017-04-14 10:46:35 +02:00
def misra_16_3(rawTokens):
# state: 0=no, 1=break is seen but not its ';', 2=after 'break;', 'comment', '{'
state = 0
for token in rawTokens:
if token.str == 'break':
state = 1
elif token.str == ';':
if state == 1:
state = 2
else:
state = 0
elif token.str.startswith('/*') or token.str.startswith('//'):
if token.str.lower().find('fallthrough')>0:
state = 2
elif token.str == '{':
state = 2
elif token.str == 'case' and state != 2:
reportError(token, 16, 3)
2017-04-14 12:57:07 +02:00
def misra_16_4(data):
for token in data.tokenlist:
if token.str != 'switch':
continue
if not simpleMatch(token, 'switch ('):
continue
if not simpleMatch(token.next.link, ') {'):
continue
startTok = token.next.link.next
tok = startTok.next
while tok and tok.str != '}':
if tok.str == '{':
tok = tok.link
elif tok.str == 'default':
break
tok = tok.next
if tok and tok.str != 'default':
reportError(token, 16, 4)
2017-04-14 13:07:48 +02:00
def misra_16_5(data):
for token in data.tokenlist:
if token.str != 'default':
continue
if token.previous and token.previous.str == '{':
continue
tok2 = token
while tok2:
if tok2.str in ['}', 'case']:
break
if tok2.str == '{':
tok2 = tok2.link
tok2 = tok2.next
if tok2 and tok2.str == 'case':
reportError(token, 16, 5)
2017-04-14 13:18:20 +02:00
def misra_16_6(data):
for token in data.tokenlist:
if not (simpleMatch(token, 'switch (') and simpleMatch(token.next.link, ') {')):
continue
tok = token.next.link.next.next
count = 0
while tok:
if tok.str == 'break':
count = count + 1
elif tok.str == '{':
tok = tok.link
elif tok.str == '}':
break
tok = tok.next
if count < 2:
reportError(token, 16, 6)
2017-04-14 13:23:53 +02:00
def misra_16_7(data):
for token in data.tokenlist:
if simpleMatch(token, 'switch (') and isBoolExpression(token.next.astOperand2):
reportError(token, 16, 7)
2017-04-15 15:20:28 +02:00
def misra_17_1(data):
for token in data.tokenlist:
if isFunctionCall(token) and token.astOperand1.str in ['va_list', 'va_arg', 'va_start', 'va_end' , 'va_copy']:
2017-04-14 14:13:37 +02:00
reportError(token, 17, 1)
2017-04-14 18:51:12 +02:00
def misra_17_6(rawTokens):
for token in rawTokens:
if simpleMatch(token, '[ static'):
reportError(token, 17, 6)
2017-04-14 13:18:20 +02:00
2017-04-14 20:38:35 +02:00
def misra_17_8(data):
for token in data.tokenlist:
if not (token.isAssignmentOp or (token.str in ['++','--'])):
continue
if not token.astOperand1:
continue
var = token.astOperand1.variable
if var and var.isArgument:
reportError(token, 17, 8)
2017-04-14 20:51:09 +02:00
def misra_18_5(data):
for var in data.variables:
if not var.isPointer:
continue
typetok = var.nameToken
count = 0
while typetok:
if typetok.str == '*':
count = count + 1
elif not typetok.isName:
break
typetok = typetok.previous
if count > 2:
reportError(var.nameToken, 18, 5)
2017-04-14 21:09:25 +02:00
def misra_18_8(data):
for var in data.variables:
if not var.isArray:
continue
# TODO Array dimensions are not available in dump
typetok = var.nameToken.next
if not typetok or typetok.str != '[':
continue
if not isConstantExpression(typetok.astOperand2):
reportError(var.nameToken, 18, 8)
2017-04-14 20:51:09 +02:00
2017-04-14 21:14:26 +02:00
def misra_19_2(data):
for token in data.tokenlist:
if token.str == 'union':
reportError(token, 19, 2)
def misra_20_1(data):
for directive in data.directives:
if not directive.str.startswith('#include'):
2017-04-14 21:49:52 +02:00
continue
for token in data.tokenlist:
if token.file != directive.file:
continue
if int(token.linenr) < int(directive.linenr):
reportError(directive, 20, 1)
break
2017-04-14 21:14:26 +02:00
def misra_20_2(data):
for directive in data.directives:
if not directive.str.startswith('#include '):
2017-04-14 22:22:22 +02:00
continue
for pattern in ['\\', '//', '/*', '\'']:
if directive.str.find(pattern)>0:
reportError(directive, 20, 2)
2017-04-14 22:22:22 +02:00
break
2017-04-14 22:25:35 +02:00
def misra_20_3(rawTokens):
2017-04-14 22:33:59 +02:00
linenr = -1
2017-04-14 22:25:35 +02:00
for token in rawTokens:
2017-04-14 22:33:59 +02:00
if token.str.startswith('/') or token.linenr == linenr:
continue
linenr = token.linenr
2017-04-14 22:25:35 +02:00
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)
def misra_20_4(data):
for directive in data.directives:
res = re.search(r'#define ([a-z][a-z0-9_]+)', directive.str)
if res and (res.group(1) in KEYWORDS):
reportError(directive, 20, 4)
2017-04-14 22:33:59 +02:00
def misra_20_5(data):
for directive in data.directives:
if directive.str.startswith('#undef '):
reportError(directive, 20, 5)
2017-04-14 22:33:59 +02:00
2017-04-14 22:53:45 +02:00
def misra_21_3(data):
for token in data.tokenlist:
2017-04-15 15:20:28 +02:00
if isFunctionCall(token) and (token.astOperand1.str in ['malloc', 'calloc', 'realloc', 'free']):
2017-04-14 22:53:45 +02:00
reportError(token, 21, 3)
2017-04-15 14:29:29 +02:00
def misra_21_4(data):
directive = findInclude(data.directives, '<setjmp.h>')
if directive:
reportError(directive, 21, 4)
2017-04-14 22:58:42 +02:00
2017-04-15 14:29:29 +02:00
def misra_21_5(data):
directive = findInclude(data.directives, '<signal.h>')
if directive:
reportError(directive, 21, 5)
2017-04-14 22:58:42 +02:00
2017-04-15 08:08:17 +02:00
def misra_21_7(data):
for token in data.tokenlist:
2017-04-15 15:20:28 +02:00
if isFunctionCall(token) and (token.astOperand1.str in ['atof', 'atoi', 'atol', 'atoll']):
2017-04-15 08:08:17 +02:00
reportError(token, 21, 7)
2017-04-14 22:58:42 +02:00
2017-04-15 08:24:24 +02:00
def misra_21_8(data):
for token in data.tokenlist:
2017-04-15 15:20:28 +02:00
if isFunctionCall(token) and (token.astOperand1.str in ['abort', 'getenv', 'system']):
2017-04-15 08:24:24 +02:00
reportError(token, 21, 8)
2017-04-15 08:30:09 +02:00
def misra_21_9(data):
for token in data.tokenlist:
if (token.str in ['bsearch', 'qsort']) and token.next and token.next.str == '(':
reportError(token, 21, 9)
2017-04-15 14:29:29 +02:00
def misra_21_11(data):
directive = findInclude(data.directives, '<tgmath.h>')
if directive:
reportError(directive, 21, 11)
2017-04-15 12:40:23 +02:00
if '-verify' in sys.argv[1:]:
VERIFY = True
2017-04-08 16:08:54 +02:00
for arg in sys.argv[1:]:
if not arg.endswith('.dump'):
continue
2017-04-08 16:08:54 +02:00
data = cppcheckdata.parsedump(arg)
2017-04-09 10:11:54 +02:00
if VERIFY:
VERIFY_ACTUAL = []
VERIFY_EXPECTED = []
for tok in data.rawTokens:
if tok.str.startswith('//') and tok.str.find('TODO')<0:
for word in tok.str[2:].split(' '):
if re.match(r'[0-9]+\.[0-9]+', word):
VERIFY_EXPECTED.append(str(tok.linenr) + ':' + word)
else:
print('Checking ' + arg + '...')
2017-04-09 10:11:54 +02:00
cfgNumber = 0
2017-04-08 16:08:54 +02:00
for cfg in data.configurations:
2017-04-09 10:11:54 +02:00
cfgNumber = cfgNumber + 1
2017-04-08 16:08:54 +02:00
if len(data.configurations) > 1:
print('Checking ' + arg + ', config "' + cfg.name + '"...')
2017-04-11 14:45:38 +02:00
misra_5_1(cfg)
if cfgNumber == 1:
misra_7_1(data.rawTokens)
misra_7_3(data.rawTokens)
2017-04-12 16:19:13 +02:00
misra_12_1_sizeof(data.rawTokens)
2017-04-11 22:21:54 +02:00
misra_12_1(cfg)
2017-04-13 10:04:50 +02:00
misra_12_2(cfg)
2017-04-12 20:18:54 +02:00
misra_12_3(cfg)
2017-04-13 11:05:04 +02:00
misra_12_4(cfg)
2017-04-13 19:11:48 +02:00
misra_13_1(cfg)
2017-04-13 19:38:25 +02:00
misra_13_3(cfg)
2017-04-13 19:43:06 +02:00
misra_13_4(cfg)
2017-04-11 14:45:38 +02:00
misra_13_5(cfg)
2017-04-13 21:40:59 +02:00
misra_13_6(cfg)
2017-04-13 22:05:27 +02:00
misra_14_1(cfg)
2017-04-13 22:26:12 +02:00
misra_14_2(cfg)
2017-04-11 14:45:38 +02:00
misra_14_4(cfg)
misra_15_1(cfg)
2017-04-13 22:44:43 +02:00
misra_15_2(cfg)
2017-04-13 23:02:06 +02:00
misra_15_3(cfg)
2017-04-13 23:07:41 +02:00
misra_15_5(cfg)
2017-04-13 23:24:35 +02:00
if cfgNumber == 1:
misra_15_6(data.rawTokens)
2017-04-14 08:05:14 +02:00
misra_15_7(cfg)
2017-04-14 08:17:32 +02:00
misra_16_2(cfg)
2017-04-14 10:46:35 +02:00
if cfgNumber == 1:
misra_16_3(data.rawTokens)
2017-04-14 12:57:07 +02:00
misra_16_4(cfg)
2017-04-14 13:07:48 +02:00
misra_16_5(cfg)
2017-04-14 13:18:20 +02:00
misra_16_6(cfg)
2017-04-14 13:23:53 +02:00
misra_16_7(cfg)
2017-04-15 15:20:28 +02:00
misra_17_1(cfg)
2017-04-14 14:13:37 +02:00
if cfgNumber == 1:
2017-04-14 18:51:12 +02:00
misra_17_6(data.rawTokens)
2017-04-14 20:38:35 +02:00
misra_17_8(cfg)
2017-04-14 20:51:09 +02:00
misra_18_5(cfg)
2017-04-14 21:09:25 +02:00
misra_18_8(cfg)
2017-04-14 21:14:26 +02:00
misra_19_2(cfg)
misra_20_1(cfg)
misra_20_2(cfg)
2017-04-14 21:49:52 +02:00
if cfgNumber == 1:
2017-04-14 22:25:35 +02:00
misra_20_3(data.rawTokens)
misra_20_4(cfg)
misra_20_5(cfg)
2017-04-14 22:53:45 +02:00
misra_21_3(cfg)
2017-04-15 14:29:29 +02:00
misra_21_4(cfg)
misra_21_5(cfg)
2017-04-15 08:08:17 +02:00
misra_21_7(cfg)
2017-04-15 08:24:24 +02:00
misra_21_8(cfg)
2017-04-15 08:30:09 +02:00
misra_21_9(cfg)
2017-04-15 14:29:29 +02:00
misra_21_11(cfg)
2017-04-13 22:44:43 +02:00
if VERIFY:
for expected in VERIFY_EXPECTED:
if not expected in VERIFY_ACTUAL:
print('Expected but not seen: ' + expected)
sys.exit(1)
for actual in VERIFY_ACTUAL:
if not actual in VERIFY_EXPECTED:
print('Not expected: ' + actual)
sys.exit(1)