[LLVMdev] [llvm-commits] PROPOSAL: LLVM_FALLTHROUGH macro for intended fall-throughs between switch cases

Jim Grosbach grosbach at apple.com
Thu Jul 26 16:24:47 PDT 2012


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.

-Jim




More information about the llvm-dev mailing list