MISRA C Compliance
AndreyVV-100 opened this issue · 3 comments
Hi! Сontinuing the issue #147 , our tool gave some new reports. Are this lines violation of rules?
- Violation of Rule MISRA C 2012 10.3
Line 691 in 8c7ba86
According to MISRA C 2012 standard paragraph 8.10 "The essential type model", in this example value
is of Essentially Signed type category, and the constant 0U
is of Essentially Unsigned type category. Assigning the value to an object with different essential type category is prohibited by the rule 10.3.
- Violation of Rule MISRA C 2012 20.12
Line 1039 in 8c7ba86
In standard header file assert.h
macro assert
is defined as follows:
# define assert(expr) \
((void) sizeof ((expr) ? 1 : 0), __extension__ ({ \
if (expr) \
; /* empty */ \
else \
__assert_fail (#expr, __FILE__, __LINE__, __ASSERT_FUNCTION); \
}))
# endif
So in this example macro parameter isOpenBracket_
(which is also macro) is itself subject for further macro replacement (#expr)
, supplied as expr
parameter.
Hi @AndreyVV-100
Thanks a lot for your efforts. Let me discuss with the team about this and get back to you.
Regards,
We address this issue in PR #157. I use the coverity 2023.06.1 to check the MISRA deviations and this issue is not reported. It would be great if you can help to verify this patch in your environment. Thank you for reporting this issue.
@chinglee-iot We checked this PR in our environment and there is no warning now.