Skip to content

Commit

Permalink
[libc++][NFC] Rename _LIBCPP_NO_EXCEPTIONS to _LIBCPP_HAS_NO_EXCEPTIONS
Browse files Browse the repository at this point in the history
Other macros that disable parts of the library are named `_LIBCPP_HAS_NO_WHATEVER`.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits, smeenai

Differential Revision: https://reviews.llvm.org/D143163
  • Loading branch information
philnik777 committed Feb 17, 2023
1 parent 1320036 commit b22aa3d
Show file tree
Hide file tree
Showing 43 changed files with 483 additions and 483 deletions.
4 changes: 2 additions & 2 deletions libcxx/include/__availability
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@

#endif

// Define availability attributes that depend on _LIBCPP_NO_EXCEPTIONS.
// Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS.
// Those are defined in terms of the availability attributes above, and
// should not be vendor-specific.
#if defined(_LIBCPP_NO_EXCEPTIONS)
#if defined(_LIBCPP_HAS_NO_EXCEPTIONS)
# define _LIBCPP_AVAILABILITY_FUTURE
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ typedef __char32_t char32_t;
# endif

# if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L
# define _LIBCPP_NO_EXCEPTIONS
# define _LIBCPP_HAS_NO_EXCEPTIONS
# endif

# define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__expected/expected.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace __expected {

template <class _Err, class _Arg>
_LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) {
# ifndef _LIBCPP_NO_EXCEPTIONS
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_expected_access<_Err>(std::forward<_Arg>(__arg));
# else
(void)__arg;
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__filesystem/filesystem_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH

template <class... _Args>
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
void __throw_filesystem_error(_Args&&... __args) {
throw filesystem_error(_VSTD::forward<_Args>(__args)...);
}
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__format/format_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class _LIBCPP_EXCEPTION_ABI format_error : public runtime_error {

_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void
__throw_format_error(const char* __s) {
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw format_error(__s);
#else
(void)__s;
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/__functional/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ _LIBCPP_DIAGNOSTIC_POP
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_bad_function_call()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_function_call();
#else
_VSTD::abort();
Expand Down
24 changes: 12 additions & 12 deletions libcxx/include/__hash_table
Original file line number Diff line number Diff line change
Expand Up @@ -1597,10 +1597,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
if (bucket_count() != 0)
{
__next_pointer __cache = __detach();
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
const_iterator __i = __u.begin();
while (__cache != nullptr && __u.size() != 0)
{
Expand All @@ -1610,14 +1610,14 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__node_insert_multi(__cache->__upcast());
__cache = __next;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
}
catch (...)
{
__deallocate_node(__cache);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
__deallocate_node(__cache);
}
const_iterator __i = __u.begin();
Expand Down Expand Up @@ -1659,25 +1659,25 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first
if (bucket_count() != 0)
{
__next_pointer __cache = __detach();
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
for (; __cache != nullptr && __first != __last; ++__first)
{
__cache->__upcast()->__value_ = *__first;
__next_pointer __next = __cache->__next_;
__node_insert_unique(__cache->__upcast());
__cache = __next;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
}
catch (...)
{
__deallocate_node(__cache);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
__deallocate_node(__cache);
}
for (; __first != __last; ++__first)
Expand All @@ -1699,25 +1699,25 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
if (bucket_count() != 0)
{
__next_pointer __cache = __detach();
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
for (; __cache != nullptr && __first != __last; ++__first)
{
__cache->__upcast()->__value_ = *__first;
__next_pointer __next = __cache->__next_;
__node_insert_multi(__cache->__upcast());
__cache = __next;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
}
catch (...)
{
__deallocate_node(__cache);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
__deallocate_node(__cache);
}
for (; __first != __last; ++__first)
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__iterator/counted_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ class counted_iterator
decltype(auto) operator++(int) {
_LIBCPP_ASSERT(__count_ > 0, "Iterator already at or past end.");
--__count_;
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try { return __current_++; }
catch(...) { ++__count_; throw; }
#else
return __current_++;
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}

_LIBCPP_HIDE_FROM_ABI
Expand Down
34 changes: 17 additions & 17 deletions libcxx/include/__memory/shared_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class _LIBCPP_EXCEPTION_ABI bad_weak_ptr
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
void __throw_bad_weak_ptr()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
throw bad_weak_ptr();
#else
_VSTD::abort();
Expand Down Expand Up @@ -508,10 +508,10 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
shared_ptr(_Yp* __p, _Dp __d)
: __ptr_(__p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
#ifndef _LIBCPP_CXX03_LANG
Expand All @@ -520,25 +520,25 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
#endif // not _LIBCPP_CXX03_LANG
__enable_weak_this(__p, __p);
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
}
catch (...)
{
__d(__p);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}

template<class _Yp, class _Dp, class _Alloc, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
_LIBCPP_HIDE_FROM_ABI
shared_ptr(_Yp* __p, _Dp __d, _Alloc __a)
: __ptr_(__p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
typedef __allocator_destructor<_A2> _D2;
Expand All @@ -552,51 +552,51 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
#endif // not _LIBCPP_CXX03_LANG
__cntrl_ = _VSTD::addressof(*__hold2.release());
__enable_weak_this(__p, __p);
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
}
catch (...)
{
__d(__p);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}

template<class _Dp>
_LIBCPP_HIDE_FROM_ABI
shared_ptr(nullptr_t __p, _Dp __d)
: __ptr_(nullptr)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk;
#ifndef _LIBCPP_CXX03_LANG
__cntrl_ = new _CntrlBlk(__p, _VSTD::move(__d), _AllocT());
#else
__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
#endif // not _LIBCPP_CXX03_LANG
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
}
catch (...)
{
__d(__p);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}

template<class _Dp, class _Alloc>
_LIBCPP_HIDE_FROM_ABI
shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
: __ptr_(nullptr)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
typedef __allocator_destructor<_A2> _D2;
Expand All @@ -609,14 +609,14 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
_CntrlBlk(__p, __d, __a);
#endif // not _LIBCPP_CXX03_LANG
__cntrl_ = _VSTD::addressof(*__hold2.release());
#ifndef _LIBCPP_NO_EXCEPTIONS
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
}
catch (...)
{
__d(__p);
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
}

template<class _Yp>
Expand Down
Loading

0 comments on commit b22aa3d

Please sign in to comment.