File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -443,8 +443,11 @@ def getEssentialTypeCategory(expr):
443443 return expr .valueType .sign
444444 if expr .valueType and expr .valueType .typeScope and expr .valueType .typeScope .className :
445445 return "enum<" + expr .valueType .typeScope .className + ">"
446- if expr .variable :
447- typeToken = expr .variable .typeStartToken
446+ vartok = expr
447+ while simpleMatch (vartok , '[' ) or (vartok and vartok .str == '*' and vartok .astOperand2 is None ):
448+ vartok = vartok .astOperand1
449+ if vartok and vartok .variable :
450+ typeToken = vartok .variable .typeStartToken
448451 while typeToken and typeToken .isName :
449452 if typeToken .str == 'char' and not typeToken .isSigned and not typeToken .isUnsigned :
450453 return 'char'
Original file line number Diff line number Diff line change 11// To test:
22// ~/cppcheck/cppcheck --addon=misra --platform=avr8 misra-test-avr8.c
33
4+ static void misra_10_4 (void )
5+ {
6+ // #10480
7+ char buf [1 ] = {'f' };
8+ const char c = '0' ;
9+ signed int x = buf [0 ] - c ;
10+ }
11+
412static void misra_12_2 (void ) {
513 a = (((uint64_t )0xFF ) << 32 );
614}
You can’t perform that action at this time.
0 commit comments