Skip to content

Commit

Permalink
Fix #10652: FP: misra-c2012-10.4 (char)'1' != (char)
Browse files Browse the repository at this point in the history
  • Loading branch information
swasti16 committed Oct 14, 2023
1 parent ebb877a commit 6f3f0a7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions addons/misra.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ def getEssentialTypeCategory(expr):
return expr.valueType.sign

if expr.valueType:
if expr.valueType.type == 'char':
return "char"
return expr.valueType.sign
return None

Expand Down
6 changes: 6 additions & 0 deletions addons/test/misra/misra-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,12 @@ static void misra_10_4(u32 x, s32 y) {
}
}

//10652
bool fp(const char c) //8.4
{
return ( (char)'1' != c ); //no-warning
}

static void misra_10_5(uint16_t x) {
// bool
res = (uint16_t) (x > 10u); // 10.5
Expand Down

0 comments on commit 6f3f0a7

Please sign in to comment.