[PATCH] NoReturn Warning: Removed Warning for Unreachable Return

Michael Bao mike.h.bao at gmail.com
Fri Jan 3 12:29:46 PST 2014


> Do we have some corresponding dead code warning? I'm not exactly in
> favor of this...

If you compile with -Wunreachable-code (which is not on by default) then
there will be an unreachable code warning for the return statement. Is that
along the lines of what you want? (in that case maybe nothing needs to be
done here?).

> Also, why has this code moved ~200 lines further down? I think this is
> changing the semantics of the diagnostic.

I originally moved it down because DiagRuntimeBehavior requires a non-null
statement (2nd parameter) to be passed in for the reachability test to be
run before displaying the diagnostic. Where the diagnostic was previously,
I wouldn't have access to the return statement (Stmt) which is in the
variable "Result". The only thing I would have would be RetValExp, however,
using that fails when trying to detect a return in a void function.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140103/caa9a9f2/attachment.html>


More information about the cfe-commits mailing list