misra.py: Improved 'isBoolExpression'
This commit is contained in:
parent
26e36a1d6b
commit
fb89c987b0
|
@ -214,7 +214,11 @@ def hasSideEffectsRecursive(expr):
|
||||||
|
|
||||||
|
|
||||||
def isBoolExpression(expr):
|
def isBoolExpression(expr):
|
||||||
return expr and expr.str in ['!', '==', '!=', '<', '<=', '>', '>=', '&&', '||', '0', '1']
|
if not expr:
|
||||||
|
return False
|
||||||
|
if expr.valueType and expr.valueType.type == 'bool':
|
||||||
|
return True
|
||||||
|
return expr.str in ['!', '==', '!=', '<', '<=', '>', '>=', '&&', '||', '0', '1']
|
||||||
|
|
||||||
|
|
||||||
def isConstantExpression(expr):
|
def isConstantExpression(expr):
|
||||||
|
|
|
@ -153,9 +153,12 @@ void misra_14_2() {
|
||||||
// TODO check more variants
|
// TODO check more variants
|
||||||
}
|
}
|
||||||
|
|
||||||
void misra_14_4() {
|
void misra_14_4(bool b) {
|
||||||
if (x+4){} // 14.4
|
if (x+4){} // 14.4
|
||||||
else {}
|
else {}
|
||||||
|
|
||||||
|
if (b) {}
|
||||||
|
else {}
|
||||||
}
|
}
|
||||||
|
|
||||||
void misra_15_1() {
|
void misra_15_1() {
|
||||||
|
|
Loading…
Reference in New Issue