File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -459,6 +459,13 @@ def getEssentialTypeCategory(expr):
459459 if typeToken .valueType .sign :
460460 return typeToken .valueType .sign
461461 typeToken = typeToken .next
462+
463+ # See Appendix D, section D.6, Character constants
464+ if expr .str [0 ] == "'" and expr .str [- 1 ] == "'" :
465+ if len (expr .str ) == 3 or (len (expr .str ) == 4 and expr .str [1 ] == '\\ ' ):
466+ return 'char'
467+ return expr .valueType .sign
468+
462469 if expr .valueType :
463470 return expr .valueType .sign
464471 return None
Original file line number Diff line number Diff line change @@ -669,13 +669,13 @@ static void misra_10_2(void) {
669669 float f32a = 0.0 ;
670670 char res ;
671671
672- res = '0' + u8a ; // 10.4
672+ res = '0' + u8a ; // Convert u8a to digit
673673 res = s8a + '0' ;
674674 res = cha - '0' ;
675675 res = '0' - s8a ;
676676 res = cha + ':' ; // 10.2
677677
678- res = s16a - 'a' ; // 10.2 10.3
678+ res = s16a - 'a' ; // 10.2 10.3 10.4
679679 res = '0' + f32a ; // 10.2 10.4
680680}
681681
@@ -699,6 +699,12 @@ static void misra_10_4(u32 x, s32 y) {
699699 z = x + y ; //10.4
700700 z = (a == misra_10_4_A3 ) ? x : y ; //10.4
701701 z = (a == misra_10_4_A3 ) ? y : y ; // no-warning
702+
703+ // #10499
704+ const char buf [10 ] = {0 };
705+ if ('0' == buf [x ]) // no-warning
706+ {
707+ }
702708}
703709
704710static void misra_10_5 (uint16_t x ) {
You can’t perform that action at this time.
0 commit comments