[LLVMdev] [llvm-commits] PROPOSAL: LLVM_FALLTHROUGH macro for intended fall-throughs between switch cases
Richard Smith
richard at metafoo.co.uk
Thu Jul 26 17:02:08 PDT 2012
On Thu, Jul 26, 2012 at 4:24 PM, Jim Grosbach <grosbach at apple.com> wrote:
>
> On Jul 26, 2012, at 4:07 PM, Chris Lattner <clattner at apple.com> wrote:
>
> > <dropping llvm-commits>
> >
> > On Jul 2, 2012, at 9:59 AM, Alexander Kornienko wrote:
> >
> >> Hi llvmdev, llvm-commits,
> >>
> >> There was a discussion on this topic a while ago, and now I've decided
> to make a formal proposal and post it here.
> >
> > I missed the earlier discussion, so I'm sorry for chiming in late.
> >
> >> I propose to add the LLVM_FALLTHROUGH macro for specifying intended
> fall-through locations between switch cases.
> >
> > I don't really see that the tradeoff here is worthwhile. It is possible
> that we have some fallthrough bugs, but the cost of sprinkling this macro
> everywhere doesn't seem like the right tradeoff.
> >
>
> While I tend to agree with you, it's also true that for many (most?) of
> the locations where we have an intentional fall through, there's already a
> comment to that effect as a matter of style. This would simply formalize
> that currently voluntary bit of style and use the macro rather than a
> comment. Depending on how many bugs this would enable find (perhaps some
> experiments are in order?), I could be convinced the tradeoff is worthwhile.
I believe Alex has already gone through the hits from this diagnostic; see
the fallthrough-bugs-llvm.diff patch attached to the original mail on this
thread for the bugs he found.
Alex: can you tell us how many FALLTHROUGH annotations would be required,
and how many bugs you found, when running this over LLVM and Clang?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120726/ca662685/attachment.html>
More information about the llvm-dev
mailing list