[webkit-dev] "statement is unreachable" warnings
Yong Li
yong.li.webkit at gmail.com
Fri Jan 22 07:08:55 PST 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100122/204b6fcf/attachment.html>
More information about the webkit-dev
mailing list