dexonsmith created this revision.

As a follow up to r302172, add missing availability for bad_any_cast.

rdar://problem/32161524


https://reviews.llvm.org/D33177

Files:
  libcxx/include/__config
  libcxx/include/experimental/any
  libcxx/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
  libcxx/test/std/experimental/any/any.class/any.assign/move.pass.cpp
  libcxx/test/std/experimental/any/any.class/any.assign/value.pass.cpp
  libcxx/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
  libcxx/test/std/experimental/any/any.class/any.cons/move.pass.cpp
  libcxx/test/std/experimental/any/any.class/any.cons/value.pass.cpp
  libcxx/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
  libcxx/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
  libcxx/test/support/experimental_any_helpers.h

Index: libcxx/test/support/experimental_any_helpers.h
===================================================================
--- libcxx/test/support/experimental_any_helpers.h
+++ libcxx/test/support/experimental_any_helpers.h
@@ -55,6 +55,7 @@
 
 // Assert that an 'any' object stores the specified 'Type' and 'value'.
 template <class Type>
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
 void assertContains(std::experimental::any const& a, int value = 1) {
     assert(!a.empty());
     RTTI_ASSERT(a.type() == typeid(Type));
@@ -64,6 +65,7 @@
 // Modify the value of a "test type" stored within an any to the specified
 // 'value'.
 template <class Type>
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
 void modifyValue(std::experimental::any& a, int value) {
     assert(!a.empty());
     RTTI_ASSERT(a.type() == typeid(Type));
Index: libcxx/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
===================================================================
--- libcxx/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
+++ libcxx/test/std/experimental/any/any.class/any.modifiers/swap.pass.cpp
@@ -9,12 +9,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx
 
 // <experimental/any>
 
Index: libcxx/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
===================================================================
--- libcxx/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
+++ libcxx/test/std/experimental/any/any.class/any.modifiers/clear.pass.cpp
@@ -9,12 +9,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx
 
 // <experimental/any>
 
Index: libcxx/test/std/experimental/any/any.class/any.cons/value.pass.cpp
===================================================================
--- libcxx/test/std/experimental/any/any.class/any.cons/value.pass.cpp
+++ libcxx/test/std/experimental/any/any.class/any.cons/value.pass.cpp
@@ -9,12 +9,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx
 
 // <experimental/any>
 
Index: libcxx/test/std/experimental/any/any.class/any.cons/move.pass.cpp
===================================================================
--- libcxx/test/std/experimental/any/any.class/any.cons/move.pass.cpp
+++ libcxx/test/std/experimental/any/any.class/any.cons/move.pass.cpp
@@ -9,12 +9,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx
 
 // <experimental/any>
 
Index: libcxx/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
===================================================================
--- libcxx/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
+++ libcxx/test/std/experimental/any/any.class/any.cons/copy.pass.cpp
@@ -9,12 +9,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx
 
 // <experimental/any>
 
Index: libcxx/test/std/experimental/any/any.class/any.assign/value.pass.cpp
===================================================================
--- libcxx/test/std/experimental/any/any.class/any.assign/value.pass.cpp
+++ libcxx/test/std/experimental/any/any.class/any.assign/value.pass.cpp
@@ -9,12 +9,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx
 
 // <experimental/any>
 
Index: libcxx/test/std/experimental/any/any.class/any.assign/move.pass.cpp
===================================================================
--- libcxx/test/std/experimental/any/any.class/any.assign/move.pass.cpp
+++ libcxx/test/std/experimental/any/any.class/any.assign/move.pass.cpp
@@ -9,12 +9,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx
 
 // <experimental/any>
 
Index: libcxx/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
===================================================================
--- libcxx/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
+++ libcxx/test/std/experimental/any/any.class/any.assign/copy.pass.cpp
@@ -9,12 +9,7 @@
 
 // UNSUPPORTED: c++98, c++03, c++11
 
-// XFAIL: with_system_cxx_lib=macosx10.12
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
-// XFAIL: with_system_cxx_lib=macosx10.7
-// XFAIL: with_system_cxx_lib=macosx10.8
+// XFAIL: availability=macosx
 
 // <experimental/any>
 
Index: libcxx/include/experimental/any
===================================================================
--- libcxx/include/experimental/any
+++ libcxx/include/experimental/any
@@ -89,15 +89,16 @@
 
 _LIBCPP_BEGIN_NAMESPACE_LFTS
 
-class _LIBCPP_EXCEPTION_ABI bad_any_cast : public bad_cast
+class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast
 {
 public:
     virtual const char* what() const _NOEXCEPT;
 };
 
 #if _LIBCPP_STD_VER > 11                                            // C++ > 11
 
 _LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
 void __throw_bad_any_cast()
 {
 #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -506,7 +507,7 @@
 }
 
 template <class _ValueType>
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
 _ValueType any_cast(any const & __v)
 {
     static_assert(
@@ -522,7 +523,7 @@
 }
 
 template <class _ValueType>
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
 _ValueType any_cast(any & __v)
 {
     static_assert(
@@ -537,7 +538,7 @@
 }
 
 template <class _ValueType>
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
 _ValueType any_cast(any && __v)
 {
     static_assert(
Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1139,6 +1139,7 @@
   __attribute__((availability(watchos,strict,introduced=3.0)))
 #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable))
 #define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
+#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable))
 #define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS                               \
   __attribute__((availability(macosx,strict,introduced=10.12)))                \
   __attribute__((availability(ios,strict,introduced=10.0)))                    \
@@ -1164,6 +1165,7 @@
 #define _LIBCPP_AVAILABILITY_SHARED_MUTEX
 #define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
 #define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
+#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
 #define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
 #define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
 #define _LIBCPP_AVAILABILITY_FUTURE_ERROR
@@ -1176,9 +1178,12 @@
 #ifdef _LIBCPP_NO_EXCEPTIONS
 #define _LIBCPP_AVAILABILITY_DYNARRAY
 #define _LIBCPP_AVAILABILITY_FUTURE
+#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
 #else
 #define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
 #define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
+#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST                                \
+  _LIBCPP_AVAILABILITY_BAD_ANY_CAST
 #endif
 
 // Availability of stream API in the dylib got dropped and re-added.  The
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D33177: an... Duncan P. N. Exon Smith via Phabricator via cfe-commits

Reply via email to