[cfe-commits] Removing redundant default cases

Ted Kremenek kremenek at apple.com
Fri Sep 23 21:17:14 PDT 2011


There is a WIP warning, -Wunreachable-code, that actually does a reachability analysis on the CFG.  It's not completely ready for prime time, but it is getting there.  Does it catch all of these cases?  If so, I'm not certain if we need a separate warning, although this one looks fairly cheap.

On Sep 23, 2011, at 7:20 PM, David Blaikie wrote:

> I hacked up a cheap version of a warning for defaults in switches that already cover all cases in an enum (the warning is in excess_default.diff - given some discussion with Chandler on IRC I don't think we consider this to be sufficiently high quality to be checked in, but I wouldn't mind some other opinions/thoughts (the issue was that it might need to use the CFG to ensure that it's not reachable via loops nested in the switch or gotos, fallthroughs etc)) and I found/fixed the following cases (excess_default_fixes.diff)
> <excess_default.diff><excess_default_fixes.diff>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list