[PATCH] NoReturn Warning: Removed Warning for Unreachable Return
aaron at aaronballman.com
Sat Jan 4 10:39:35 PST 2014
On Fri, Jan 3, 2014 at 3:29 PM, Michael Bao <mike.h.bao at gmail.com> wrote:
>> 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.
That makes sense as to why you'd move it, but I'm still concerned
about this changing the semantics. For instance, this can now fire for
ObjCMethodDecl objects, where it used to not be possible. This could
be a bug fix, but it would also require further testing (and
confirmation from some of the ObjC experts as to whether this is
More information about the cfe-commits