From ed5afe4277413a922db393061fc81c05b8a11057 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 20 May 2015 02:44:14 +0000 Subject: [PATCH] Support: Introduce LLVM_FALLTHROUGH macro. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237766 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/Compiler.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index c81fbaff9db..4da7fd48fa5 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -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 -- 2.34.1