@@ -457,9 +457,7 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
457457
458458 template <class _Yp , class _Dp , __enable_if_t <__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int > = 0 >
459459 _LIBCPP_HIDE_FROM_ABI shared_ptr (_Yp* __p, _Dp __d) : __ptr_(__p) {
460- #if _LIBCPP_HAS_EXCEPTIONS
461- try {
462- #endif // _LIBCPP_HAS_EXCEPTIONS
460+ _LIBCPP_TRY {
463461 typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
464462 typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk;
465463#ifndef _LIBCPP_CXX03_LANG
@@ -468,22 +466,18 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
468466 __cntrl_ = new _CntrlBlk (__p, __d, _AllocT ());
469467#endif // not _LIBCPP_CXX03_LANG
470468 __enable_weak_this (__p, __p);
471- #if _LIBCPP_HAS_EXCEPTIONS
472- } catch (...) {
469+ } _LIBCPP_CATCH (...) {
473470 __d (__p);
474- throw ;
471+ _LIBCPP_RETHROW ;
475472 }
476- #endif // _LIBCPP_HAS_EXCEPTIONS
477473 }
478474
479475 template <class _Yp ,
480476 class _Dp ,
481477 class _Alloc ,
482478 __enable_if_t <__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value, int > = 0 >
483479 _LIBCPP_HIDE_FROM_ABI shared_ptr (_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) {
484- #if _LIBCPP_HAS_EXCEPTIONS
485- try {
486- #endif // _LIBCPP_HAS_EXCEPTIONS
480+ _LIBCPP_TRY {
487481 typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk;
488482 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
489483 typedef __allocator_destructor<_A2> _D2;
@@ -497,12 +491,10 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
497491#endif // not _LIBCPP_CXX03_LANG
498492 __cntrl_ = std::addressof (*__hold2.release ());
499493 __enable_weak_this (__p, __p);
500- #if _LIBCPP_HAS_EXCEPTIONS
501- } catch (...) {
494+ } _LIBCPP_CATCH (...) {
502495 __d (__p);
503- throw ;
496+ _LIBCPP_RETHROW ;
504497 }
505- #endif // _LIBCPP_HAS_EXCEPTIONS
506498 }
507499
508500 template <class _Dp >
@@ -511,22 +503,18 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
511503 _Dp __d,
512504 __enable_if_t <__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
513505 : __ptr_(nullptr ) {
514- #if _LIBCPP_HAS_EXCEPTIONS
515- try {
516- #endif // _LIBCPP_HAS_EXCEPTIONS
506+ _LIBCPP_TRY {
517507 typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
518508 typedef __shared_ptr_pointer<nullptr_t , _Dp, _AllocT> _CntrlBlk;
519509#ifndef _LIBCPP_CXX03_LANG
520510 __cntrl_ = new _CntrlBlk (__p, std::move (__d), _AllocT ());
521511#else
522512 __cntrl_ = new _CntrlBlk (__p, __d, _AllocT ());
523513#endif // not _LIBCPP_CXX03_LANG
524- #if _LIBCPP_HAS_EXCEPTIONS
525- } catch (...) {
514+ } _LIBCPP_CATCH (...) {
526515 __d (__p);
527- throw ;
516+ _LIBCPP_RETHROW ;
528517 }
529- #endif // _LIBCPP_HAS_EXCEPTIONS
530518 }
531519
532520 template <class _Dp , class _Alloc >
@@ -536,9 +524,7 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
536524 _Alloc __a,
537525 __enable_if_t <__shared_ptr_nullptr_deleter_ctor_reqs<_Dp>::value, __nullptr_sfinae_tag> = __nullptr_sfinae_tag())
538526 : __ptr_(nullptr ) {
539- #if _LIBCPP_HAS_EXCEPTIONS
540- try {
541- #endif // _LIBCPP_HAS_EXCEPTIONS
527+ _LIBCPP_TRY {
542528 typedef __shared_ptr_pointer<nullptr_t , _Dp, _Alloc> _CntrlBlk;
543529 typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;
544530 typedef __allocator_destructor<_A2> _D2;
@@ -551,12 +537,10 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr {
551537 _CntrlBlk (__p, __d, __a);
552538#endif // not _LIBCPP_CXX03_LANG
553539 __cntrl_ = std::addressof (*__hold2.release ());
554- #if _LIBCPP_HAS_EXCEPTIONS
555- } catch (...) {
540+ } _LIBCPP_CATCH (...) {
556541 __d (__p);
557- throw ;
542+ _LIBCPP_RETHROW ;
558543 }
559- #endif // _LIBCPP_HAS_EXCEPTIONS
560544 }
561545
562546 template <class _Yp >
0 commit comments