diff --git a/libcxx/include/__pstl/internal/algorithm_impl.h b/libcxx/include/__pstl/internal/algorithm_impl.h --- a/libcxx/include/__pstl/internal/algorithm_impl.h +++ b/libcxx/include/__pstl/internal/algorithm_impl.h @@ -3093,8 +3093,8 @@ __first2, __last2, [__first1, __last1, __first2, __last2, &__comp](_RandomAccessIterator2 __i, _RandomAccessIterator2 __j) { - _PSTL_ASSERT(__j > __i); - //_PSTL_ASSERT(__j - __i > 1); + _LIBCPP_ASSERT(__j > __i, ""); + //_LIBCPP_ASSERT(__j - __i > 1, ""); // 1. moving boundaries to "consume" subsequence of equal elements auto __is_equal = [&__comp](_RandomAccessIterator2 __a, _RandomAccessIterator2 __b) -> bool { @@ -3117,8 +3117,8 @@ // 2. testing is __a subsequence of the second range included into the first range auto __b = std::lower_bound(__first1, __last1, *__i, __comp); - _PSTL_ASSERT(!__comp(*(__last1 - 1), *__b)); - _PSTL_ASSERT(!__comp(*(__j - 1), *__i)); + _LIBCPP_ASSERT(!__comp(*(__last1 - 1), *__b), ""); + _LIBCPP_ASSERT(!__comp(*(__j - 1), *__i), ""); return !std::includes(__b, __last1, __i, __j, __comp); }); }); @@ -3335,7 +3335,7 @@ } const auto __m2 = __left_bound_seq_2 - __first2; - _PSTL_ASSERT(__m1 == 0 || __m2 == 0); + _LIBCPP_ASSERT(__m1 == 0 || __m2 == 0, ""); if (__m2 > __set_algo_cut_off) { auto __res_or = __result; __result += __m2; // we know proper offset due to [first2; left_bound_seq_2) < [first1; last1) diff --git a/libcxx/include/__pstl/internal/numeric_impl.h b/libcxx/include/__pstl/internal/numeric_impl.h --- a/libcxx/include/__pstl/internal/numeric_impl.h +++ b/libcxx/include/__pstl/internal/numeric_impl.h @@ -466,7 +466,7 @@ _RandomAccessIterator2 __d_first, BinaryOperation __op, /*is_vector=*/std::true_type) noexcept { - _PSTL_ASSERT(__first != __last); + _LIBCPP_ASSERT(__first != __last, "Range cannot be empty"); typedef typename std::iterator_traits<_RandomAccessIterator1>::reference _ReferenceType1; typedef typename std::iterator_traits<_RandomAccessIterator2>::reference _ReferenceType2; @@ -504,7 +504,7 @@ _RandomAccessIterator1 __last, _RandomAccessIterator2 __d_first, _BinaryOperation __op) { - _PSTL_ASSERT(__first != __last); + _LIBCPP_ASSERT(__first != __last, "range cannot be empty"); typedef typename std::iterator_traits<_RandomAccessIterator1>::reference _ReferenceType1; typedef typename std::iterator_traits<_RandomAccessIterator2>::reference _ReferenceType2; diff --git a/libcxx/include/__pstl/internal/parallel_backend_tbb.h b/libcxx/include/__pstl/internal/parallel_backend_tbb.h --- a/libcxx/include/__pstl/internal/parallel_backend_tbb.h +++ b/libcxx/include/__pstl/internal/parallel_backend_tbb.h @@ -526,7 +526,7 @@ __task* allocate_func_task(_Fn&& __f) { - _PSTL_ASSERT(_M_execute_data != nullptr); + _LIBCPP_ASSERT(_M_execute_data != nullptr, ""); tbb::detail::d1::small_object_allocator __alloc{}; auto __t = __alloc.new_object<__func_task::type>>(*_M_execute_data, std::forward<_Fn>(__f)); @@ -571,7 +571,7 @@ make_additional_child_of(__task* __parent, _Fn&& __f) { auto __t = make_child_of(__parent, std::forward<_Fn>(__f)); - _PSTL_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0); + _LIBCPP_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0, ""); ++__parent->_M_refcount; return __t; } @@ -592,7 +592,7 @@ inline void spawn(__task* __t) { - _PSTL_ASSERT(_M_execute_data != nullptr); + _LIBCPP_ASSERT(_M_execute_data != nullptr, ""); tbb::detail::d1::spawn(*__t, *_M_execute_data->context); } @@ -645,11 +645,11 @@ this->~__func_task(); - _PSTL_ASSERT(__parent != nullptr); - _PSTL_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0); + _LIBCPP_ASSERT(__parent != nullptr, ""); + _LIBCPP_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0, ""); if (--__parent->_M_refcount == 0) { - _PSTL_ASSERT(__next == nullptr); + _LIBCPP_ASSERT(__next == nullptr, ""); __alloc.deallocate(this, *__ed); return __parent; } @@ -861,20 +861,20 @@ { const auto __nx = (_M_xe - _M_xs); const auto __ny = (_M_ye - _M_ys); - _PSTL_ASSERT(__nx > 0 && __ny > 0); + _LIBCPP_ASSERT(__nx > 0 && __ny > 0, ""); - _PSTL_ASSERT(_x_orig == _y_orig); - _PSTL_ASSERT(!is_partial()); + _LIBCPP_ASSERT(_x_orig == _y_orig, ""); + _LIBCPP_ASSERT(!is_partial(), ""); if (_x_orig) { - _PSTL_ASSERT(std::is_sorted(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_comp)); - _PSTL_ASSERT(std::is_sorted(_M_x_beg + _M_ys, _M_x_beg + _M_ye, _M_comp)); + _LIBCPP_ASSERT(std::is_sorted(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_comp), ""); + _LIBCPP_ASSERT(std::is_sorted(_M_x_beg + _M_ys, _M_x_beg + _M_ye, _M_comp), ""); return !_M_comp(*(_M_x_beg + _M_ys), *(_M_x_beg + _M_xe - 1)); } - _PSTL_ASSERT(std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp)); - _PSTL_ASSERT(std::is_sorted(_M_z_beg + _M_ys, _M_z_beg + _M_ye, _M_comp)); + _LIBCPP_ASSERT(std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp), ""); + _LIBCPP_ASSERT(std::is_sorted(_M_z_beg + _M_ys, _M_z_beg + _M_ye, _M_comp), ""); return !_M_comp(*(_M_z_beg + _M_zs + __nx), *(_M_z_beg + _M_zs + __nx - 1)); } void @@ -882,7 +882,7 @@ { const auto __nx = (_M_xe - _M_xs); const auto __ny = (_M_ye - _M_ys); - _PSTL_ASSERT(__nx > 0 && __ny > 0); + _LIBCPP_ASSERT(__nx > 0 && __ny > 0, ""); if (_x_orig) __move_range_construct()(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_z_beg + _M_zs); @@ -913,7 +913,7 @@ __task* merge_ranges(__task* __self) { - _PSTL_ASSERT(_x_orig == _y_orig); //two merged subrange must be lie into the same buffer + _LIBCPP_ASSERT(_x_orig == _y_orig, ""); //two merged subrange must be lie into the same buffer const auto __nx = (_M_xe - _M_xs); const auto __ny = (_M_ye - _M_ys); @@ -929,15 +929,15 @@ _M_leaf_merge(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_x_beg + _M_ys, _M_x_beg + _M_ye, _M_z_beg + _M_zs, _M_comp, __move_value_construct(), __move_value_construct(), __move_range_construct(), __move_range_construct()); - _PSTL_ASSERT(parent_merge(__self)); //not root merging task + _LIBCPP_ASSERT(parent_merge(__self), ""); //not root merging task } //merge to "origin" else { - _PSTL_ASSERT(_x_orig == _y_orig); + _LIBCPP_ASSERT(_x_orig == _y_orig, ""); - _PSTL_ASSERT(is_partial() || std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp)); - _PSTL_ASSERT(is_partial() || std::is_sorted(_M_z_beg + _M_ys, _M_z_beg + _M_ye, _M_comp)); + _LIBCPP_ASSERT(is_partial() || std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp), ""); + _LIBCPP_ASSERT(is_partial() || std::is_sorted(_M_z_beg + _M_ys, _M_z_beg + _M_ye, _M_comp), ""); const auto __nx = (_M_xe - _M_xs); const auto __ny = (_M_ye - _M_ys); @@ -954,8 +954,8 @@ __task* process_ranges(__task* __self) { - _PSTL_ASSERT(_x_orig == _y_orig); - _PSTL_ASSERT(!_split); + _LIBCPP_ASSERT(_x_orig == _y_orig, ""); + _LIBCPP_ASSERT(!_split, ""); auto p = parent_merge(__self); @@ -1001,7 +1001,7 @@ __task* split_merging(__task* __self) { - _PSTL_ASSERT(_x_orig == _y_orig); + _LIBCPP_ASSERT(_x_orig == _y_orig, ""); const auto __nx = (_M_xe - _M_xs); const auto __ny = (_M_ye - _M_ys); @@ -1073,8 +1073,8 @@ { const _SizeType __nx = (_M_xe - _M_xs); const _SizeType __ny = (_M_ye - _M_ys); - _PSTL_ASSERT(__nx > 0); - _PSTL_ASSERT(__nx > 0); + _LIBCPP_ASSERT(__nx > 0, ""); + _LIBCPP_ASSERT(__nx > 0, ""); if (__nx < __ny) move_x_range(); @@ -1130,7 +1130,7 @@ if (__n <= __sort_cut_off) { _M_leaf_sort(_M_xs, _M_xe, _M_comp); - _PSTL_ASSERT(!_M_root); + _LIBCPP_ASSERT(!_M_root, ""); return nullptr; } diff --git a/libcxx/include/__pstl/internal/parallel_backend_utils.h b/libcxx/include/__pstl/internal/parallel_backend_utils.h --- a/libcxx/include/__pstl/internal/parallel_backend_utils.h +++ b/libcxx/include/__pstl/internal/parallel_backend_utils.h @@ -55,7 +55,7 @@ constexpr bool __same_move_seq = std::is_same<_MoveSequenceX, _MoveSequenceY>::value; auto __n = _M_nmerge; - _PSTL_ASSERT(__n > 0); + _LIBCPP_ASSERT(__n > 0, ""); auto __nx = __xe - __xs; //auto __ny = __ye - __ys; diff --git a/libcxx/include/__pstl/internal/pstl_config.h b/libcxx/include/__pstl/internal/pstl_config.h --- a/libcxx/include/__pstl/internal/pstl_config.h +++ b/libcxx/include/__pstl/internal/pstl_config.h @@ -15,9 +15,6 @@ // TODO: Make this a proper configuration option #define _PSTL_PAR_BACKEND_SERIAL -#include <__assert> -#define _PSTL_ASSERT(pred) _LIBCPP_ASSERT(pred, "") - #define _PSTL_PRAGMA(x) _Pragma(# x) // Enable SIMD for compilers that support OpenMP 4.0