[llvm] r237766 - Support: Introduce LLVM_FALLTHROUGH macro.

Peter Collingbourne peter at pcc.me.uk
Thu May 21 12:46:30 PDT 2015


Hi Pete,

I was planning to use it in an upcoming patch (http://reviews.llvm.org/D6094).

While I'd like to see us using this macro, I don't have plans to convert
the entire codebase to start using it, and the value of the macro over
just a comment seems to be very low unless we actually start using it
everywhere. Given that objections have been raised in the past, I'll revert
this change and we can probably consider making it another time.

Peter

On Thu, May 21, 2015 at 09:37:34AM -0700, Pete Cooper wrote:
> Hi Peter
> 
> Are you planning on using this in the LLVM/clang codebases?
> 
> I’m in favour of using it, but there was discussion a few years ago where some doubts were raised.  In particular (http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-July/052103.html <http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-July/052103.html>):
> 
> "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.
> 
> -Chris”
> 
> It would be worth revising that discussion before making use of this throughout the codebase.
> 
> Cheers,
> Pete
> > On May 19, 2015, at 7:44 PM, Peter Collingbourne <peter at pcc.me.uk> wrote:
> > 
> > Author: pcc
> > Date: Tue May 19 21:44:14 2015
> > New Revision: 237766
> > 
> > URL: http://llvm.org/viewvc/llvm-project?rev=237766&view=rev
> > Log:
> > Support: Introduce LLVM_FALLTHROUGH macro.
> > 
> > Modified:
> >    llvm/trunk/include/llvm/Support/Compiler.h
> > 
> > Modified: llvm/trunk/include/llvm/Support/Compiler.h
> > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=237766&r1=237765&r2=237766&view=diff
> > ==============================================================================
> > --- llvm/trunk/include/llvm/Support/Compiler.h (original)
> > +++ llvm/trunk/include/llvm/Support/Compiler.h Tue May 19 21:44:14 2015
> > @@ -29,6 +29,10 @@
> > # define __has_attribute(x) 0
> > #endif
> > 
> > +#ifndef __has_cpp_attribute
> > +# define __has_cpp_attribute(x) 0
> > +#endif
> > +
> > #ifndef __has_builtin
> > # define __has_builtin(x) 0
> > #endif
> > @@ -401,4 +405,12 @@
> > #define LLVM_THREAD_LOCAL
> > #endif
> > 
> > +/// \macro LLVM_FALLTHROUGH
> > +/// \brief Marks an empty statement preceding a deliberate switch fallthrough.
> > +#if __has_cpp_attribute(clang::fallthrough)
> > +#define LLVM_FALLTHROUGH [[clang::fallthrough]]
> > +#else
> > +#define LLVM_FALLTHROUGH
> > +#endif
> > +
> > #endif
> > 
> > 
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Peter




More information about the llvm-commits mailing list