File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -617,11 +617,15 @@ def isCast(expr):
617617def is_constant_integer_expression (expr ):
618618 if expr is None :
619619 return False
620+ if expr .isInt :
621+ return True
622+ if not expr .isArithmeticalOp :
623+ return False
620624 if expr .astOperand1 and not is_constant_integer_expression (expr .astOperand1 ):
621625 return False
622626 if expr .astOperand2 and not is_constant_integer_expression (expr .astOperand2 ):
623627 return False
624- return expr . astOperand1 or expr . astOperand2 or expr . isInt
628+ return True
625629
626630def isFunctionCall (expr , std = 'c99' ):
627631 if not expr :
Original file line number Diff line number Diff line change @@ -679,7 +679,7 @@ static void misra_10_3(uint32_t u32a, uint32_t u32b) {
679679 uint8_t res ;
680680 res = u32a + u32b ; // 10.3
681681 res = (uint16_t )(2U + 3U ); // 10.3 10.8
682- res = ( uint16_t ) 2U + ( uint16_t ) 3U ;
682+ res = 2U + 3U ; // no warning, utlr=unsigned char
683683 res = 0.1f ; // 10.3
684684 const char c = '0' ; // no-warning
685685}
@@ -725,6 +725,7 @@ static void misra_10_7(uint16_t u16a, uint16_t u16b) {
725725 res = u32a * ( ( uint32_t ) u16a + u16b ); // no-warning
726726 res = u32a * (u16a + u16b ); // 10.7
727727 u32a *= u16a + u16b ; // 10.7
728+ u32a = ((uint32_t )4 * (uint32_t )2 * (uint32_t )4 ); // no-warning (#10488)
728729}
729730
730731static void misra_10_8 (u8 x , s32 a , s32 b ) {
You can’t perform that action at this time.
0 commit comments