Le 21 avril 2012 18:17, Jordy Rose <jedik...@belkadan.com> a écrit :
> I feel like the common case here is not actually fall-through but a > missing break, though like David said there are many other ways to exit a > switch. I would expect something like this instead: > > warning: fall-through to subsequent switch case > note: use 'break' to prevent fall-through > [fixit] > note: use 'fallthrough' attribute to silence this warning > [fixit] > > If we really want to go crazy, we could look and see if 'return' is more > appropriate than 'break', but I think probably these would cover the common > cases. > > Also, the attribute fixit would have to only use square-bracket syntax if > it's supported, and possibly disabled altogether if the current language > options don't support attributes at all, i.e. non-GNU. (The warning could > still be disabled with pragmas, after all.) > > Jordy > _______________________________________________ > cfe-commits mailing list > cfe-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > Two remarks: > if there is no statement between two cases, then fallthrough is most probable > otherwise it is not possible to actually distinguish between a possible fallthrough or break I don't think that providing a fixit is reasonable, because fixit should be provided only when they are right, taking chances is risking miscompilation. -- Matthieu
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits