Skip to content

Commit 6b3d84a

Browse files
committed
Partially implement MISRA 23.6
Signed-off-by: David Heidelberg <david@ixit.cz>
1 parent 1093382 commit 6b3d84a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

addons/misra.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4070,6 +4070,24 @@ def misra_22_10(self, cfg):
40704070
elif not is_errno_setting_function(last_function_call):
40714071
self.reportError(token, 22, 10)
40724072

4073+
def misra_23_6(self, cfg):
4074+
"""Part of the 23.6"""
4075+
def get_category(essential_type):
4076+
if essential_type:
4077+
if essential_type == 'bool':
4078+
return essential_type
4079+
return None
4080+
for tok in cfg.tokenlist:
4081+
if tok.isAssignmentOp:
4082+
lhs = getEssentialType(tok.astOperand1)
4083+
rhs = getEssentialType(tok.astOperand2)
4084+
if lhs is None or rhs is None:
4085+
continue
4086+
lhs_is_bool = lhs == 'bool'
4087+
rhs_is_bool = rhs == 'bool'
4088+
if lhs_is_bool:
4089+
if not rhs_is_bool:
4090+
self.reportError(tok, 23, 6)
40734091

40744092
def get_verify_expected(self):
40754093
"""Return the list of expected violations in the verify test"""
@@ -4678,6 +4696,7 @@ def fillVerifyExpected(verify_expected, tok):
46784696
self.executeCheck(2208, self.misra_22_8, cfg)
46794697
self.executeCheck(2209, self.misra_22_9, cfg)
46804698
self.executeCheck(2210, self.misra_22_10, cfg)
4699+
self.executeCheck(2306, self.misra_23_6, cfg)
46814700

46824701
def read_ctu_info_line(self, line):
46834702
if not line.startswith('{'):

0 commit comments

Comments
 (0)