I have a very simple function which created a time delay:
void delay(int time_in_ms)
{
int t = get_time() + time_in_ms;
while (get_time() < t)
{
};
}
delay(750);
I'm getting the warning that the control variable t is not modified inside the while loop. I don't need to modify the variable, I just need to be inside the while loop as long as the condition is met. How to bypass this in a "nice" way?
The warning is created by MISRA static analysis tool. The full message:
"The control variable in this loop construct is never modified"
MISRA C:2012 Rules applicable to message 2467: