This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Spurious warning C180

I just upgraded to uVision 5.21.1.0 and Compiler V7.56.0.0

This sample code produces warning C180: 'myFunc': not every path returns a value. The warning was not produced by the previous version of uVision/Compiler that I was using.

void dummyFunc(void)
{
}

int
myFunc(void)
{
  int a;

  for ( ;; ) {
    if ( a==0 )
      return a;
    dummyFunc();
  }
}

If I comment out the call to dummyFunc() then the warning does not occur.
If I comment out the if and return statement lines then the warning does not occur.

Anyone know why the code "as-is" produces the warning? As far as I can see the function does return a value for all return paths - which is just one: "return a".

Paul