[webkit-dev] statement is unreachable warnings
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 webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] statement is unreachable warnings
On Jan 22, 2010, at 7:08 AM, Yong Li wrote: So how about adding a macro UNREACHABLE_RETURN(valueToReturn)? I like that idea. I don’t think it’s only the RVCT compiler that has this issue. I seem to recall something similar with the Visual Studio compiler. Obviously in any compiler that knows the code is unreachable we’d like to not omit the code there. -- Darin ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev