rnk created this revision.
rnk added reviewers: EricWF, ldionne.
Herald added subscribers: erik.pilkington, christof.

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.


https://reviews.llvm.org/D53985

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


Index: libcxxabi/src/demangle/ItaniumDemangle.h
===================================================================
--- libcxxabi/src/demangle/ItaniumDemangle.h
+++ libcxxabi/src/demangle/ItaniumDemangle.h
@@ -2812,6 +2812,7 @@
       SoFar = make<ExpandedSpecialSubstitution>(SSK);
       if (!SoFar)
         return nullptr;
+      break;
     default:
       break;
     }
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/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/src/demangle/ItaniumDemangle.h
===================================================================
--- libcxxabi/src/demangle/ItaniumDemangle.h
+++ libcxxabi/src/demangle/ItaniumDemangle.h
@@ -2812,6 +2812,7 @@
       SoFar = make<ExpandedSpecialSubstitution>(SSK);
       if (!SoFar)
         return nullptr;
+      break;
     default:
       break;
     }
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/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)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D53985: U... Reid Kleckner via Phabricator via cfe-commits

Reply via email to