[cfe-commits] [PATCH] Implicit fall-through between switch labels
David Blaikie
dblaikie at gmail.com
Sat Apr 21 15:52:11 PDT 2012
On Sat, Apr 21, 2012 at 3:26 PM, Chandler Carruth <chandlerc at google.com> wrote:
> On Sat, Apr 21, 2012 at 11:00 AM, Matthieu Monrocq
> <matthieu.monrocq at gmail.com> wrote:
>>
>> 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.
>
>
> Note that these are fixit hints on *notes* attached to the diagnostic.
Except that's the thing - in the current code out for review, there's
only two warnings being added, and no notes (one warning for
fallthrough without the attribute, one warning for using the attribute
in non case statements).
+ S.Diag(Label->getLocStart(), diag::warn_missing_break) <<
+ FixItHint::CreateInsertion(Label->getLocStart(), "[[fallthrough]]");
But we're all in agreement - it should be on a note :)
- David
More information about the cfe-commits
mailing list