summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-11-01 18:24:03 +0000
committerReid Kleckner <rnk@google.com>2018-11-01 18:24:03 +0000
commit60cce5c78267cced3ec9bbb24f8e94b88b7710d4 (patch)
treed2b4dabe267b9d4c49a1883c7e0a65b5f87bf565 /libcxx/include
parentb34a0528528ea553a79e08f889686f44a9eef0f1 (diff)
downloadbcm5719-llvm-60cce5c78267cced3ec9bbb24f8e94b88b7710d4.tar.gz
bcm5719-llvm-60cce5c78267cced3ec9bbb24f8e94b88b7710d4.zip
Use C++11 fallthrough attribute syntax when available and add a break
Summary: This silences the two -Wimplicit-fallthrough warnings clang finds in ItaniumDemangle.h in libc++abi. Clang does not have a GNU attribute spelling for this attribute, so this is necessary. I will commit the same change to the LLVM demangler soon. Reviewers: EricWF, ldionne Subscribers: christof, erik.pilkington, cfe-commits Differential Revision: https://reviews.llvm.org/D53985 llvm-svn: 345870
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/__config6
1 files changed, 5 insertions, 1 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index b9295bf5d5e..8000f406398 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1248,8 +1248,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_DIAGNOSE_ERROR(...)
#endif
-#if __has_attribute(fallthough) || _GNUC_VER >= 700
// Use a function like macro to imply that it must be followed by a semicolon
+#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
+# define _LIBCPP_FALLTHROUGH() [[fallthrough]]
+#elif __has_cpp_attribute(clang::fallthrough)
+# define _LIBCPP_FALLTHROUGH() [[clang::fallthrough]]
+#elif __has_attribute(fallthough) || _GNUC_VER >= 700
# define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
#else
# define _LIBCPP_FALLTHROUGH() ((void)0)
OpenPOWER on IntegriCloud