I have C source code and I am making it MISRA Compliant. I got an following errors related to MISRA 2012 Rule 13.3 and 13.2:
increment/decrement operation combined with other operation with side-effects [MISRA 2012 Rule 13.3, advisory]buf[count++] = U1RXREG;
both sides have side effects [MISRA 2012 Rule 1.3, required], [MISRA 2012 Rule 13.2, required] buf[count] = U1RXREG;
Source code for problem 1:
void UART_call(void)
{
if(count < BUF_SIZE)
{
buf[count++] = U1RXREG;
Flag = 1;
}
else
{
count = 0;
Flag = 0;
}
}
After resolving 13.3 error from problem 1 code I am getting MISRA 1.3 and 13.2 errors. Source code for problem 2:
void UART_call(void)
{
if(count < BUF_SIZE)
{
buf[count] = U1RXREG;
count = count + 1U;
Flag = 1;
}
else
{
count = 0;
Flag = 0;
}
}