Hi Chandler, On Thu, Apr 26, 2012 at 1:02 AM, Chandler Carruth <chandl...@google.com>wrote:
> >> test.cpp:16:5: note: insert [[fallthrough]]; to silence this warning >> [-Wimplicit-fallthrough] >> > > s/to silence this warning/to annotate the fall-through as intentional/ ? > I found it quite common in clang to use "to silence this warning" wording in fix-it hints. As for me, it seems to be a good idea to have a common wording for fix-it hints which leave semantic as is and just serve to shut up the relevant diagnostic message. Or you see a reason to have a specific message in this particular case? > * added specific diagnostic message for unreachable fall-through >> annotation, e.g. this code: >> >> switch(x) { >> case 1: >> break; >> [[fallthrough]]; >> case 2: >> ... >> >> will produce a similar warning: >> test.cpp:12:7: warning: fallthrough annotation in unreachable code >> [-Wimplicit-fallthrough] >> [[fallthrough]]; >> ^ >> > > Idea for a future iteration: add a note that points to the break here, at > least in the easy cases. We should be able to find the terminator of the > CFG block which precedes this somehow. > The whole point is that CFG block containing break statement doesn't precede a block with a code just after the break. BTW, current logic detects only trivially unreachable code, but if a part of unreachable code contains branches/loops/etc, so it will treat it as a fall-through (either annotated or not). -- Best regards, Alexander Kornienko
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits