summaryrefslogtreecommitdiffstats
path: root/libcxx/include
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/include')
-rw-r--r--libcxx/include/__config18
-rw-r--r--libcxx/include/any6
-rw-r--r--libcxx/include/optional7
-rw-r--r--libcxx/include/variant13
4 files changed, 39 insertions, 5 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 8000f406398..f91c13438ed 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1307,9 +1307,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
__attribute__((availability(ios,strict,introduced=10.0))) \
__attribute__((availability(tvos,strict,introduced=10.0))) \
__attribute__((availability(watchos,strict,introduced=3.0)))
-# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable))
+# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \
+ __attribute__((availability(macosx,strict,introduced=10.14))) \
+ __attribute__((availability(ios,strict,introduced=12.0))) \
+ __attribute__((availability(tvos,strict,introduced=12.0))) \
+ __attribute__((availability(watchos,strict,introduced=5.0)))
+# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \
+ _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
-# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable))
+# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \
+ _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
__attribute__((availability(macosx,strict,introduced=10.12))) \
__attribute__((availability(ios,strict,introduced=10.0))) \
@@ -1333,6 +1340,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
__attribute__((availability(ios,strict,introduced=7.0)))
#else
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
+# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
# define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
@@ -1349,11 +1357,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_AVAILABILITY_DYNARRAY
# define _LIBCPP_AVAILABILITY_FUTURE
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
+# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
#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
+# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS \
+ _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
+# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS \
+ _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
#endif
// Availability of stream API in the dylib got dropped and re-added. The
diff --git a/libcxx/include/any b/libcxx/include/any
index e2945bdfa98..781eee7869c 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -94,7 +94,7 @@ namespace std {
#endif
namespace std {
-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;
@@ -106,6 +106,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER > 14
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
void __throw_bad_any_cast()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -577,6 +578,7 @@ any make_any(initializer_list<_Up> __il, _Args&&... __args) {
template <class _ValueType>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
_ValueType any_cast(any const & __v)
{
using _RawValueType = __uncvref_t<_ValueType>;
@@ -591,6 +593,7 @@ _ValueType any_cast(any const & __v)
template <class _ValueType>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
_ValueType any_cast(any & __v)
{
using _RawValueType = __uncvref_t<_ValueType>;
@@ -605,6 +608,7 @@ _ValueType any_cast(any & __v)
template <class _ValueType>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
_ValueType any_cast(any && __v)
{
using _RawValueType = __uncvref_t<_ValueType>;
diff --git a/libcxx/include/optional b/libcxx/include/optional
index 9ef0aac3999..544140f2366 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -169,7 +169,7 @@ _LIBCPP_PUSH_MACROS
namespace std // purposefully not using versioning namespace
{
-class _LIBCPP_EXCEPTION_ABI bad_optional_access
+class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
: public exception
{
public:
@@ -186,6 +186,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_NORETURN
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
void __throw_bad_optional_access() {
#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_optional_access();
@@ -933,6 +934,7 @@ public:
using __base::__get;
_LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
constexpr value_type const& value() const&
{
if (!this->has_value())
@@ -941,6 +943,7 @@ public:
}
_LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
constexpr value_type& value() &
{
if (!this->has_value())
@@ -949,6 +952,7 @@ public:
}
_LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
constexpr value_type&& value() &&
{
if (!this->has_value())
@@ -957,6 +961,7 @@ public:
}
_LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
constexpr value_type const&& value() const&&
{
if (!this->has_value())
diff --git a/libcxx/include/variant b/libcxx/include/variant
index f9505bf2711..b33b1c40ae5 100644
--- a/libcxx/include/variant
+++ b/libcxx/include/variant
@@ -219,7 +219,7 @@ _LIBCPP_PUSH_MACROS
namespace std { // explicitly not using versioning namespace
-class _LIBCPP_EXCEPTION_ABI bad_variant_access : public exception {
+class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS bad_variant_access : public exception {
public:
virtual const char* what() const _NOEXCEPT;
};
@@ -232,6 +232,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_NORETURN
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
void __throw_bad_variant_access() {
#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_variant_access();
@@ -1321,6 +1322,7 @@ constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept {
template <size_t _Ip, class _Vp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr auto&& __generic_get(_Vp&& __v) {
using __variant_detail::__access::__variant;
if (!__holds_alternative<_Ip>(__v)) {
@@ -1331,6 +1333,7 @@ constexpr auto&& __generic_get(_Vp&& __v) {
template <size_t _Ip, class... _Types>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr variant_alternative_t<_Ip, variant<_Types...>>& get(
variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
@@ -1340,6 +1343,7 @@ constexpr variant_alternative_t<_Ip, variant<_Types...>>& get(
template <size_t _Ip, class... _Types>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get(
variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
@@ -1349,6 +1353,7 @@ constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get(
template <size_t _Ip, class... _Types>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr const variant_alternative_t<_Ip, variant<_Types...>>& get(
const variant<_Types...>& __v) {
static_assert(_Ip < sizeof...(_Types));
@@ -1358,6 +1363,7 @@ constexpr const variant_alternative_t<_Ip, variant<_Types...>>& get(
template <size_t _Ip, class... _Types>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr const variant_alternative_t<_Ip, variant<_Types...>>&& get(
const variant<_Types...>&& __v) {
static_assert(_Ip < sizeof...(_Types));
@@ -1367,6 +1373,7 @@ constexpr const variant_alternative_t<_Ip, variant<_Types...>>&& get(
template <class _Tp, class... _Types>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr _Tp& get(variant<_Types...>& __v) {
static_assert(!is_void_v<_Tp>);
return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
@@ -1374,6 +1381,7 @@ constexpr _Tp& get(variant<_Types...>& __v) {
template <class _Tp, class... _Types>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr _Tp&& get(variant<_Types...>&& __v) {
static_assert(!is_void_v<_Tp>);
return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>(
@@ -1382,6 +1390,7 @@ constexpr _Tp&& get(variant<_Types...>&& __v) {
template <class _Tp, class... _Types>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr const _Tp& get(const variant<_Types...>& __v) {
static_assert(!is_void_v<_Tp>);
return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v);
@@ -1389,6 +1398,7 @@ constexpr const _Tp& get(const variant<_Types...>& __v) {
template <class _Tp, class... _Types>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr const _Tp&& get(const variant<_Types...>&& __v) {
static_assert(!is_void_v<_Tp>);
return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>(
@@ -1521,6 +1531,7 @@ constexpr bool operator>=(const variant<_Types...>& __lhs,
template <class _Visitor, class... _Vs>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) {
using __variant_detail::__visitation::__variant;
bool __results[] = {__vs.valueless_by_exception()...};
OpenPOWER on IntegriCloud