[cfe-commits] [PATCH] Minor improvement for -Wimplicit-fallthrough

Alexander Kornienko alexfh at google.com
Fri May 25 11:15:28 PDT 2012


Hi cfe-commits,

This patch handles a specific (but surprisingly common) case when a
fall-through occurs to a switch label immediately followed by a break;. In
this case it doesn't make sense to suggest a fall-through annotation,
almost certainly inserting break; is a good fix-it.
Example:

switch (x) {
  case 111:
    f();
  case 222: // don't offer "[[clang::fallthrough]];", just "break;"
    break;
}

Please, review this patch.

--
Best regards,
Alexander Kornienko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120525/e0e98f4f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fallthrough-to-empty-case.diff
Type: application/octet-stream
Size: 1594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120525/e0e98f4f/attachment.obj>


More information about the cfe-commits mailing list