From f1382fc71eef026f20608e1e8e5633ef6b428a96 Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Wed, 31 Aug 2016 23:43:14 +0000 Subject: [PATCH] Support: Avoid errors with LLVM_FALLTHROUGH in clang 3.6 and below in C mode Older versions of clang defined __has_cpp_attribute in C mode, but would choke on scoped attributes, as per llvm.org/PR23435. Since we support building with clang all the way back to 3.1, we have to work around this issue. llvm-svn: 280326 --- llvm/include/llvm/Support/Compiler.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index a9b2e43..3cf9910 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -235,6 +235,10 @@ /// LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements. #if __cplusplus > 201402L && __has_cpp_attribute(fallthrough) #define LLVM_FALLTHROUGH [[fallthrough]] +#elif !__cplusplus +// Workaround for llvm.org/PR23435, since clang 3.6 and below emit a spurious +// error when __has_cpp_attribute is given a scoped attribute in C mode. +#define LLVM_FALLTHROUGH #elif __has_cpp_attribute(clang::fallthrough) #define LLVM_FALLTHROUGH [[clang::fallthrough]] #else -- 2.7.4