<br><br><div class="gmail_quote">Le 21 avril 2012 18:17, Jordy Rose <span dir="ltr"><<a href="mailto:jediknil@belkadan.com">jediknil@belkadan.com</a>></span> a écrit :<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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:<br>
<br>
warning: fall-through to subsequent switch case<br>
note: use 'break' to prevent fall-through<br>
  [fixit]<br>
note: use 'fallthrough' attribute to silence this warning<br>
  [fixit]<br>
<br>
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.<br>
<br>
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.)<br>

<br>
Jordy<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br>Two remarks:<br><br>> if there is no statement between two cases, then fallthrough is most probable<br>> otherwise it is not possible to actually distinguish between a possible fallthrough or break<br>
<br>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.<br><br>-- Matthieu<br>