On Wed, Mar 5, 2014 at 4:25 PM, Ted Kremenek <[email protected]> wrote: > On Mar 5, 2014, at 4:15 PM, David Blaikie <[email protected]> wrote: > > +MyEnum trivial_dead_return_enum_2(int x) { > + switch (x) { > + case 1: return 1; > + case 2: return 2; > + case 3: return 3; > + } > + > + return 2; // no-warning > > > Wow - was this return really considered 'dead' at some point? How/why? > That looks totally reachable... > > +} > + > +MyEnum nontrivial_dead_return_enum_2(int x) { > + switch (x) { > + case 1: return 1; > + case 2: return 2; > + case 3: return 3; > + default: return 4; > + } > + > + return calledFun(); // expected-warning {{will never be executed}} > > > Did this not warn previously? > > > These two test cases are meant to be the same other than the return value in > the second case is "non-trivial", and thus we should warn. The first test > is missing the "default" case.
Hmm, OK. It seems LLVM developers were/are generally happy to remove those returns after fully covered switches - it comes up quite often in code review and we diligently remove them. Do we want to validate/promote it? (any that are in I suspect are a matter of oversight rather than deliberate preference) But I guess they're harmless enough to not be worth the warning, maybe... - David _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
