misra; fix essential type for comparisons and logical operators

This commit is contained in:
Daniel Marjamäki 2021-07-20 16:50:43 +02:00
parent b320a092d0
commit bc43bfcb73
1 changed files with 5 additions and 0 deletions

View File

@ -474,6 +474,9 @@ def getEssentialType(expr):
if expr.valueType.isIntegral():
return '%s %s' % (expr.valueType.sign, expr.valueType.type)
if expr.str in ('<', '<=', '>=', '>', '==', '!=', '&&', '||', '!'):
return 'Boolean'
elif expr.astOperand1 and expr.astOperand2 and expr.str in (
'+', '-', '*', '/', '%', '&', '|', '^', '>>', "<<", "?", ":"):
if expr.astOperand1.valueType and expr.astOperand1.valueType.pointer > 0:
@ -499,6 +502,8 @@ def bitsOfEssentialType(ty):
if ty is None:
return 0
ty = ty.split(' ')[-1]
if ty == 'Boolean':
return 1
if ty == 'char':
return typeBits['CHAR']
if ty == 'short':