RVCT reports a "statement is unreachable" warning in this case:

while (true) {
   // no break in the loop
   ...
      return someValue;
   ...
     return someValue;
}

ASSERT_NOT_REACHED();
return someValue;


I understand that if we remove the last return statement, some compilers
will complain that "not all paths return a value".

So how about adding a macro "UNREACHABLE_RETURN(valueToReturn)"?

Like this:

#if COMPILER(RVCT)
#define UNREACHABLE_RETURN(valueToReturn) // nothing here
#else
 #define UNREACHABLE_RETURN(valueToReturn)   \
ASSERT_NOT_REACHED(); \
return valueToReturn;
#endif

-Yong
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to