[PATCH] D53985: Use C++11 fallthrough attribute syntax when available and add a break

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 1 11:28:31 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL345870: Use C++11 fallthrough attribute syntax when available and add a break (authored by rnk, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D53985?vs=172175&id=172189#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D53985

Files:
  libcxx/trunk/include/__config
  libcxxabi/trunk/src/demangle/ItaniumDemangle.h


Index: libcxx/trunk/include/__config
===================================================================
--- libcxx/trunk/include/__config
+++ libcxx/trunk/include/__config
@@ -1248,8 +1248,12 @@
 #  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)
Index: libcxxabi/trunk/src/demangle/ItaniumDemangle.h
===================================================================
--- libcxxabi/trunk/src/demangle/ItaniumDemangle.h
+++ libcxxabi/trunk/src/demangle/ItaniumDemangle.h
@@ -2812,6 +2812,7 @@
       SoFar = make<ExpandedSpecialSubstitution>(SSK);
       if (!SoFar)
         return nullptr;
+      break;
     default:
       break;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53985.172189.patch
Type: text/x-patch
Size: 1157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181101/add66e06/attachment-0001.bin>


More information about the cfe-commits mailing list