Skip to content

Commit b22aa3d

Browse files
committed
[libc++][NFC] Rename _LIBCPP_NO_EXCEPTIONS to _LIBCPP_HAS_NO_EXCEPTIONS
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
1 parent 1320036 commit b22aa3d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+483
-483
lines changed

libcxx/include/__availability

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@
270270

271271
#endif
272272

273-
// Define availability attributes that depend on _LIBCPP_NO_EXCEPTIONS.
273+
// Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS.
274274
// Those are defined in terms of the availability attributes above, and
275275
// should not be vendor-specific.
276-
#if defined(_LIBCPP_NO_EXCEPTIONS)
276+
#if defined(_LIBCPP_HAS_NO_EXCEPTIONS)
277277
# define _LIBCPP_AVAILABILITY_FUTURE
278278
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
279279
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS

libcxx/include/__config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ typedef __char32_t char32_t;
448448
# endif
449449

450450
# if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L
451-
# define _LIBCPP_NO_EXCEPTIONS
451+
# define _LIBCPP_HAS_NO_EXCEPTIONS
452452
# endif
453453

454454
# define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)

libcxx/include/__expected/expected.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace __expected {
6464

6565
template <class _Err, class _Arg>
6666
_LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) {
67-
# ifndef _LIBCPP_NO_EXCEPTIONS
67+
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
6868
throw bad_expected_access<_Err>(std::forward<_Arg>(__arg));
6969
# else
7070
(void)__arg;

libcxx/include/__filesystem/filesystem_error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
8686

8787
template <class... _Args>
8888
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
89-
#ifndef _LIBCPP_NO_EXCEPTIONS
89+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
9090
void __throw_filesystem_error(_Args&&... __args) {
9191
throw filesystem_error(_VSTD::forward<_Args>(__args)...);
9292
}

libcxx/include/__format/format_error.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class _LIBCPP_EXCEPTION_ABI format_error : public runtime_error {
4040

4141
_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void
4242
__throw_format_error(const char* __s) {
43-
#ifndef _LIBCPP_NO_EXCEPTIONS
43+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
4444
throw format_error(__s);
4545
#else
4646
(void)__s;

libcxx/include/__functional/function.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ _LIBCPP_DIAGNOSTIC_POP
6868
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
6969
void __throw_bad_function_call()
7070
{
71-
#ifndef _LIBCPP_NO_EXCEPTIONS
71+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
7272
throw bad_function_call();
7373
#else
7474
_VSTD::abort();

libcxx/include/__hash_table

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,10 +1597,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
15971597
if (bucket_count() != 0)
15981598
{
15991599
__next_pointer __cache = __detach();
1600-
#ifndef _LIBCPP_NO_EXCEPTIONS
1600+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
16011601
try
16021602
{
1603-
#endif // _LIBCPP_NO_EXCEPTIONS
1603+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
16041604
const_iterator __i = __u.begin();
16051605
while (__cache != nullptr && __u.size() != 0)
16061606
{
@@ -1610,14 +1610,14 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
16101610
__node_insert_multi(__cache->__upcast());
16111611
__cache = __next;
16121612
}
1613-
#ifndef _LIBCPP_NO_EXCEPTIONS
1613+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
16141614
}
16151615
catch (...)
16161616
{
16171617
__deallocate_node(__cache);
16181618
throw;
16191619
}
1620-
#endif // _LIBCPP_NO_EXCEPTIONS
1620+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
16211621
__deallocate_node(__cache);
16221622
}
16231623
const_iterator __i = __u.begin();
@@ -1659,25 +1659,25 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_unique(_InputIterator __first
16591659
if (bucket_count() != 0)
16601660
{
16611661
__next_pointer __cache = __detach();
1662-
#ifndef _LIBCPP_NO_EXCEPTIONS
1662+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
16631663
try
16641664
{
1665-
#endif // _LIBCPP_NO_EXCEPTIONS
1665+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
16661666
for (; __cache != nullptr && __first != __last; ++__first)
16671667
{
16681668
__cache->__upcast()->__value_ = *__first;
16691669
__next_pointer __next = __cache->__next_;
16701670
__node_insert_unique(__cache->__upcast());
16711671
__cache = __next;
16721672
}
1673-
#ifndef _LIBCPP_NO_EXCEPTIONS
1673+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
16741674
}
16751675
catch (...)
16761676
{
16771677
__deallocate_node(__cache);
16781678
throw;
16791679
}
1680-
#endif // _LIBCPP_NO_EXCEPTIONS
1680+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
16811681
__deallocate_node(__cache);
16821682
}
16831683
for (; __first != __last; ++__first)
@@ -1699,25 +1699,25 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
16991699
if (bucket_count() != 0)
17001700
{
17011701
__next_pointer __cache = __detach();
1702-
#ifndef _LIBCPP_NO_EXCEPTIONS
1702+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
17031703
try
17041704
{
1705-
#endif // _LIBCPP_NO_EXCEPTIONS
1705+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
17061706
for (; __cache != nullptr && __first != __last; ++__first)
17071707
{
17081708
__cache->__upcast()->__value_ = *__first;
17091709
__next_pointer __next = __cache->__next_;
17101710
__node_insert_multi(__cache->__upcast());
17111711
__cache = __next;
17121712
}
1713-
#ifndef _LIBCPP_NO_EXCEPTIONS
1713+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
17141714
}
17151715
catch (...)
17161716
{
17171717
__deallocate_node(__cache);
17181718
throw;
17191719
}
1720-
#endif // _LIBCPP_NO_EXCEPTIONS
1720+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
17211721
__deallocate_node(__cache);
17221722
}
17231723
for (; __first != __last; ++__first)

libcxx/include/__iterator/counted_iterator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ class counted_iterator
143143
decltype(auto) operator++(int) {
144144
_LIBCPP_ASSERT(__count_ > 0, "Iterator already at or past end.");
145145
--__count_;
146-
#ifndef _LIBCPP_NO_EXCEPTIONS
146+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
147147
try { return __current_++; }
148148
catch(...) { ++__count_; throw; }
149149
#else
150150
return __current_++;
151-
#endif // _LIBCPP_NO_EXCEPTIONS
151+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
152152
}
153153

154154
_LIBCPP_HIDE_FROM_ABI

libcxx/include/__memory/shared_ptr.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class _LIBCPP_EXCEPTION_ABI bad_weak_ptr
118118
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
119119
void __throw_bad_weak_ptr()
120120
{
121-
#ifndef _LIBCPP_NO_EXCEPTIONS
121+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
122122
throw bad_weak_ptr();
123123
#else
124124
_VSTD::abort();
@@ -508,10 +508,10 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
508508
shared_ptr(_Yp* __p, _Dp __d)
509509
: __ptr_(__p)
510510
{
511-
#ifndef _LIBCPP_NO_EXCEPTIONS
511+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
512512
try
513513
{
514-
#endif // _LIBCPP_NO_EXCEPTIONS
514+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
515515
typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
516516
typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
517517
#ifndef _LIBCPP_CXX03_LANG
@@ -520,25 +520,25 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
520520
__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
521521
#endif // not _LIBCPP_CXX03_LANG
522522
__enable_weak_this(__p, __p);
523-
#ifndef _LIBCPP_NO_EXCEPTIONS
523+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
524524
}
525525
catch (...)
526526
{
527527
__d(__p);
528528
throw;
529529
}
530-
#endif // _LIBCPP_NO_EXCEPTIONS
530+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
531531
}
532532

533533
template<class _Yp, class _Dp, class _Alloc, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> >
534534
_LIBCPP_HIDE_FROM_ABI
535535
shared_ptr(_Yp* __p, _Dp __d, _Alloc __a)
536536
: __ptr_(__p)
537537
{
538-
#ifndef _LIBCPP_NO_EXCEPTIONS
538+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
539539
try
540540
{
541-
#endif // _LIBCPP_NO_EXCEPTIONS
541+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
542542
typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
543543
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
544544
typedef __allocator_destructor<_A2> _D2;
@@ -552,51 +552,51 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
552552
#endif // not _LIBCPP_CXX03_LANG
553553
__cntrl_ = _VSTD::addressof(*__hold2.release());
554554
__enable_weak_this(__p, __p);
555-
#ifndef _LIBCPP_NO_EXCEPTIONS
555+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
556556
}
557557
catch (...)
558558
{
559559
__d(__p);
560560
throw;
561561
}
562-
#endif // _LIBCPP_NO_EXCEPTIONS
562+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
563563
}
564564

565565
template<class _Dp>
566566
_LIBCPP_HIDE_FROM_ABI
567567
shared_ptr(nullptr_t __p, _Dp __d)
568568
: __ptr_(nullptr)
569569
{
570-
#ifndef _LIBCPP_NO_EXCEPTIONS
570+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
571571
try
572572
{
573-
#endif // _LIBCPP_NO_EXCEPTIONS
573+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
574574
typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
575575
typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk;
576576
#ifndef _LIBCPP_CXX03_LANG
577577
__cntrl_ = new _CntrlBlk(__p, _VSTD::move(__d), _AllocT());
578578
#else
579579
__cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
580580
#endif // not _LIBCPP_CXX03_LANG
581-
#ifndef _LIBCPP_NO_EXCEPTIONS
581+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
582582
}
583583
catch (...)
584584
{
585585
__d(__p);
586586
throw;
587587
}
588-
#endif // _LIBCPP_NO_EXCEPTIONS
588+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
589589
}
590590

591591
template<class _Dp, class _Alloc>
592592
_LIBCPP_HIDE_FROM_ABI
593593
shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
594594
: __ptr_(nullptr)
595595
{
596-
#ifndef _LIBCPP_NO_EXCEPTIONS
596+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
597597
try
598598
{
599-
#endif // _LIBCPP_NO_EXCEPTIONS
599+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
600600
typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk;
601601
typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
602602
typedef __allocator_destructor<_A2> _D2;
@@ -609,14 +609,14 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr
609609
_CntrlBlk(__p, __d, __a);
610610
#endif // not _LIBCPP_CXX03_LANG
611611
__cntrl_ = _VSTD::addressof(*__hold2.release());
612-
#ifndef _LIBCPP_NO_EXCEPTIONS
612+
#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
613613
}
614614
catch (...)
615615
{
616616
__d(__p);
617617
throw;
618618
}
619-
#endif // _LIBCPP_NO_EXCEPTIONS
619+
#endif // _LIBCPP_HAS_NO_EXCEPTIONS
620620
}
621621

622622
template<class _Yp>

0 commit comments

Comments
 (0)