summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-08-31 23:43:14 +0000
committerJustin Bogner <mail@justinbogner.com>2016-08-31 23:43:14 +0000
commitf1382fc71eef026f20608e1e8e5633ef6b428a96 (patch)
tree4782f3faa638e2bfcdfc0d3f5c0ea8acce27218b
parentf3e82f14181655e6e8ccac1212da888f4d83a367 (diff)
downloadbcm5719-llvm-f1382fc71eef026f20608e1e8e5633ef6b428a96.tar.gz
bcm5719-llvm-f1382fc71eef026f20608e1e8e5633ef6b428a96.zip
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
-rw-r--r--llvm/include/llvm/Support/Compiler.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h
index a9b2e433a76..3cf99102faf 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
OpenPOWER on IntegriCloud