diff --git a/libcxx/include/__algorithm/clamp.h b/libcxx/include/__algorithm/clamp.h --- a/libcxx/include/__algorithm/clamp.h +++ b/libcxx/include/__algorithm/clamp.h @@ -26,7 +26,7 @@ const _Tp& clamp(const _Tp& __v, const _Tp& __lo, const _Tp& __hi, _Compare __comp) { - _LIBCPP_ASSERT(!__comp(__hi, __lo), "Bad bounds passed to std::clamp"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__comp(__hi, __lo), "Bad bounds passed to std::clamp"); return __comp(__v, __lo) ? __lo : __comp(__hi, __v) ? __hi : __v; } diff --git a/libcxx/include/__algorithm/pop_heap.h b/libcxx/include/__algorithm/pop_heap.h --- a/libcxx/include/__algorithm/pop_heap.h +++ b/libcxx/include/__algorithm/pop_heap.h @@ -31,7 +31,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len) { - _LIBCPP_ASSERT(__len > 0, "The heap given to pop_heap must be non-empty"); + _LIBCPP_ASSERT_UNCATEGORIZED(__len > 0, "The heap given to pop_heap must be non-empty"); __comp_ref_type<_Compare> __comp_ref = __comp; diff --git a/libcxx/include/__algorithm/ranges_clamp.h b/libcxx/include/__algorithm/ranges_clamp.h --- a/libcxx/include/__algorithm/ranges_clamp.h +++ b/libcxx/include/__algorithm/ranges_clamp.h @@ -34,8 +34,8 @@ indirect_strict_weak_order> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr const _Type& operator()( const _Type& __value, const _Type& __low, const _Type& __high, _Comp __comp = {}, _Proj __proj = {}) const { - _LIBCPP_ASSERT(!bool(std::invoke(__comp, std::invoke(__proj, __high), std::invoke(__proj, __low))), - "Bad bounds passed to std::ranges::clamp"); + _LIBCPP_ASSERT_UNCATEGORIZED(!bool(std::invoke(__comp, std::invoke(__proj, __high), std::invoke(__proj, __low))), + "Bad bounds passed to std::ranges::clamp"); if (std::invoke(__comp, std::invoke(__proj, __value), std::invoke(__proj, __low))) return __low; diff --git a/libcxx/include/__algorithm/ranges_max.h b/libcxx/include/__algorithm/ranges_max.h --- a/libcxx/include/__algorithm/ranges_max.h +++ b/libcxx/include/__algorithm/ranges_max.h @@ -54,7 +54,7 @@ indirect_strict_weak_order> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const { - _LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list must contain at least one element"); + _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list must contain at least one element"); auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); }; return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp_lhs_rhs_swapped, __proj); @@ -69,7 +69,7 @@ auto __first = ranges::begin(__r); auto __last = ranges::end(__r); - _LIBCPP_ASSERT(__first != __last, "range must contain at least one element"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range must contain at least one element"); if constexpr (forward_range<_Rp> && !__is_cheap_to_copy>) { auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); }; diff --git a/libcxx/include/__algorithm/ranges_min.h b/libcxx/include/__algorithm/ranges_min.h --- a/libcxx/include/__algorithm/ranges_min.h +++ b/libcxx/include/__algorithm/ranges_min.h @@ -53,7 +53,7 @@ indirect_strict_weak_order> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp operator()(initializer_list<_Tp> __il, _Comp __comp = {}, _Proj __proj = {}) const { - _LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list must contain at least one element"); + _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list must contain at least one element"); return *ranges::__min_element_impl(__il.begin(), __il.end(), __comp, __proj); } @@ -65,7 +65,7 @@ operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { auto __first = ranges::begin(__r); auto __last = ranges::end(__r); - _LIBCPP_ASSERT(__first != __last, "range must contain at least one element"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range must contain at least one element"); if constexpr (forward_range<_Rp> && !__is_cheap_to_copy>) { return *ranges::__min_element_impl(__first, __last, __comp, __proj); } else { diff --git a/libcxx/include/__algorithm/ranges_minmax.h b/libcxx/include/__algorithm/ranges_minmax.h --- a/libcxx/include/__algorithm/ranges_minmax.h +++ b/libcxx/include/__algorithm/ranges_minmax.h @@ -65,7 +65,7 @@ indirect_strict_weak_order> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<_Type> operator()(initializer_list<_Type> __il, _Comp __comp = {}, _Proj __proj = {}) const { - _LIBCPP_ASSERT(__il.begin() != __il.end(), "initializer_list has to contain at least one element"); + _LIBCPP_ASSERT_UNCATEGORIZED(__il.begin() != __il.end(), "initializer_list has to contain at least one element"); auto __iters = std::__minmax_element_impl(__il.begin(), __il.end(), __comp, __proj); return ranges::minmax_result<_Type>{*__iters.first, *__iters.second}; } @@ -80,7 +80,7 @@ auto __last = ranges::end(__r); using _ValueT = range_value_t<_Range>; - _LIBCPP_ASSERT(__first != __last, "range has to contain at least one element"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "range has to contain at least one element"); if constexpr (forward_range<_Range>) { // Special-case the one element case. Avoid repeatedly initializing objects from the result of an iterator diff --git a/libcxx/include/__algorithm/sample.h b/libcxx/include/__algorithm/sample.h --- a/libcxx/include/__algorithm/sample.h +++ b/libcxx/include/__algorithm/sample.h @@ -77,7 +77,7 @@ _SampleIterator __sample(_PopulationIterator __first, _PopulationSentinel __last, _SampleIterator __output_iter, _Distance __n, _UniformRandomNumberGenerator& __g) { - _LIBCPP_ASSERT(__n >= 0, "N must be a positive number."); + _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0, "N must be a positive number."); using _PopIterCategory = typename _IterOps<_AlgPolicy>::template __iterator_category<_PopulationIterator>; using _Difference = typename _IterOps<_AlgPolicy>::template __difference_type<_PopulationIterator>; diff --git a/libcxx/include/__algorithm/sift_down.h b/libcxx/include/__algorithm/sift_down.h --- a/libcxx/include/__algorithm/sift_down.h +++ b/libcxx/include/__algorithm/sift_down.h @@ -83,7 +83,7 @@ typename iterator_traits<_RandomAccessIterator>::difference_type __len) { using difference_type = typename iterator_traits<_RandomAccessIterator>::difference_type; - _LIBCPP_ASSERT(__len >= 2, "shouldn't be called unless __len >= 2"); + _LIBCPP_ASSERT_UNCATEGORIZED(__len >= 2, "shouldn't be called unless __len >= 2"); _RandomAccessIterator __hole = __first; _RandomAccessIterator __child_i = __first; diff --git a/libcxx/include/__algorithm/sort.h b/libcxx/include/__algorithm/sort.h --- a/libcxx/include/__algorithm/sort.h +++ b/libcxx/include/__algorithm/sort.h @@ -296,7 +296,9 @@ do { *__j = _Ops::__iter_move(__k); __j = __k; - _LIBCPP_ASSERT(__k != __leftmost, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __k != __leftmost, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (__comp(__t, *--__k)); // No need for bounds check due to the assumption stated above. *__j = std::move(__t); } @@ -498,7 +500,7 @@ using _Ops = _IterOps<_AlgPolicy>; typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type; typedef typename std::iterator_traits<_RandomAccessIterator>::difference_type difference_type; - _LIBCPP_ASSERT(__last - __first >= difference_type(3), ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >= difference_type(3), ""); const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around const _RandomAccessIterator __end = __last; (void)__end; // @@ -508,7 +510,9 @@ // Not guarded since we know the last element is greater than the pivot. do { ++__first; - _LIBCPP_ASSERT(__first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __first != __end, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (!__comp(__pivot, *__first)); } else { while (++__first < __last && !__comp(__pivot, *__first)) { @@ -519,7 +523,9 @@ // It will be always guarded because __introsort will do the median-of-three // before calling this. do { - _LIBCPP_ASSERT(__last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __last != __begin, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; } while (__comp(__pivot, *__last)); } @@ -585,7 +591,7 @@ using _Ops = _IterOps<_AlgPolicy>; typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type; - _LIBCPP_ASSERT(__last - __first >= difference_type(3), ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >= difference_type(3), ""); const _RandomAccessIterator __begin = __first; // used for bounds checking, those are not moved around const _RandomAccessIterator __end = __last; (void)__end; // value_type __pivot(_Ops::__iter_move(__first)); @@ -594,7 +600,9 @@ // this. do { ++__first; - _LIBCPP_ASSERT(__first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __first != __end, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (__comp(*__first, __pivot)); // Find the last element less than the pivot. @@ -604,7 +612,9 @@ } else { // Guarded. do { - _LIBCPP_ASSERT(__last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __last != __begin, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; } while (!__comp(*__last, __pivot)); } @@ -620,10 +630,14 @@ _Ops::iter_swap(__first, __last); do { ++__first; - _LIBCPP_ASSERT(__first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __first != __end, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (__comp(*__first, __pivot)); do { - _LIBCPP_ASSERT(__last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __last != __begin, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; } while (!__comp(*__last, __pivot)); } @@ -652,7 +666,9 @@ // Guarded. do { ++__first; - _LIBCPP_ASSERT(__first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __first != __end, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (!__comp(__pivot, *__first)); } else { while (++__first < __last && !__comp(__pivot, *__first)) { @@ -663,7 +679,9 @@ // It will be always guarded because __introsort will do the // median-of-three before calling this. do { - _LIBCPP_ASSERT(__last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __last != __begin, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; } while (__comp(__pivot, *__last)); } @@ -671,10 +689,14 @@ _Ops::iter_swap(__first, __last); do { ++__first; - _LIBCPP_ASSERT(__first != __end, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __first != __end, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); } while (!__comp(__pivot, *__first)); do { - _LIBCPP_ASSERT(__last != __begin, "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __last != __begin, + "Would read out of bounds, does your comparator satisfy the strict-weak ordering requirement?"); --__last; } while (__comp(__pivot, *__last)); } diff --git a/libcxx/include/__assert b/libcxx/include/__assert --- a/libcxx/include/__assert +++ b/libcxx/include/__assert @@ -46,4 +46,6 @@ # define _LIBCPP_ASSERT(expression, message) ((void)0) #endif +#define _LIBCPP_ASSERT_UNCATEGORIZED(expression, message) _LIBCPP_ASSERT(expression, message) + #endif // _LIBCPP___ASSERT diff --git a/libcxx/include/__bit/bit_ceil.h b/libcxx/include/__bit/bit_ceil.h --- a/libcxx/include/__bit/bit_ceil.h +++ b/libcxx/include/__bit/bit_ceil.h @@ -28,7 +28,7 @@ if (__t < 2) return 1; const unsigned __n = numeric_limits<_Tp>::digits - std::countl_zero((_Tp)(__t - 1u)); - _LIBCPP_ASSERT(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil"); if constexpr (sizeof(_Tp) >= sizeof(unsigned)) return _Tp{1} << __n; diff --git a/libcxx/include/__charconv/from_chars_integral.h b/libcxx/include/__charconv/from_chars_integral.h --- a/libcxx/include/__charconv/from_chars_integral.h +++ b/libcxx/include/__charconv/from_chars_integral.h @@ -227,7 +227,7 @@ template ::value, int>::type = 0> inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result from_chars(const char* __first, const char* __last, _Tp& __value, int __base) { - _LIBCPP_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); + _LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]"); return std::__from_chars_integral(__first, __last, __value, __base); } #endif // _LIBCPP_STD_VER >= 17 diff --git a/libcxx/include/__charconv/to_chars_base_10.h b/libcxx/include/__charconv/to_chars_base_10.h --- a/libcxx/include/__charconv/to_chars_base_10.h +++ b/libcxx/include/__charconv/to_chars_base_10.h @@ -132,13 +132,13 @@ /// range that can be used. However the range is sufficient for /// \ref __base_10_u128. _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline __uint128_t __pow_10(int __exp) noexcept { - _LIBCPP_ASSERT(__exp >= __pow10_128_offset, "Index out of bounds"); + _LIBCPP_ASSERT_UNCATEGORIZED(__exp >= __pow10_128_offset, "Index out of bounds"); return __pow10_128[__exp - __pow10_128_offset]; } _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u128(char* __buffer, __uint128_t __value) noexcept { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __value > numeric_limits::max(), "The optimizations for this algorithm fail when this isn't true."); // Unlike the 64 to 32 bit case the 128 bit case the "upper half" can't be diff --git a/libcxx/include/__charconv/to_chars_integral.h b/libcxx/include/__charconv/to_chars_integral.h --- a/libcxx/include/__charconv/to_chars_integral.h +++ b/libcxx/include/__charconv/to_chars_integral.h @@ -246,7 +246,7 @@ template _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value, unsigned __base) { - _LIBCPP_ASSERT(__value >= 0, "The function requires a non-negative value."); + _LIBCPP_ASSERT_UNCATEGORIZED(__value >= 0, "The function requires a non-negative value."); unsigned __base_2 = __base * __base; unsigned __base_3 = __base_2 * __base; @@ -311,7 +311,7 @@ template ::value, int>::type = 0> inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result to_chars(char* __first, char* __last, _Tp __value, int __base) { - _LIBCPP_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); + _LIBCPP_ASSERT_UNCATEGORIZED(2 <= __base && __base <= 36, "base not in [2, 36]"); using _Type = __make_32_64_or_128_bit_t<_Tp>; return std::__to_chars_integral(__first, __last, static_cast<_Type>(__value), __base, is_signed<_Tp>()); diff --git a/libcxx/include/__charconv/traits.h b/libcxx/include/__charconv/traits.h --- a/libcxx/include/__charconv/traits.h +++ b/libcxx/include/__charconv/traits.h @@ -101,11 +101,11 @@ /// zero is set to one. This means the first element of the lookup table is /// zero. static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __v > numeric_limits::max(), "The optimizations for this algorithm fail when this isn't true."); // There's always a bit set in the upper 64-bits. auto __t = (128 - std::__libcpp_clz(static_cast(__v >> 64))) * 1233 >> 12; - _LIBCPP_ASSERT(__t >= __itoa::__pow10_128_offset, "Index out of bounds"); + _LIBCPP_ASSERT_UNCATEGORIZED(__t >= __itoa::__pow10_128_offset, "Index out of bounds"); // __t is adjusted since the lookup table misses the lower entries. return __t - (__v < __itoa::__pow10_128[__t - __itoa::__pow10_128_offset]) + 1; } diff --git a/libcxx/include/__chrono/parser_std_format_spec.h b/libcxx/include/__chrono/parser_std_format_spec.h --- a/libcxx/include/__chrono/parser_std_format_spec.h +++ b/libcxx/include/__chrono/parser_std_format_spec.h @@ -160,9 +160,10 @@ private: _LIBCPP_HIDE_FROM_ABI constexpr _ConstIterator __parse_chrono_specs(_ConstIterator __begin, _ConstIterator __end, __flags __flags) { - _LIBCPP_ASSERT(__begin != __end, - "When called with an empty input the function will cause " - "undefined behavior by evaluating data not in the input"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __begin != __end, + "When called with an empty input the function will cause " + "undefined behavior by evaluating data not in the input"); if (*__begin != _CharT('%') && *__begin != _CharT('}')) std::__throw_format_error("Expected '%' or '}' in the chrono format-string"); diff --git a/libcxx/include/__coroutine/coroutine_handle.h b/libcxx/include/__coroutine/coroutine_handle.h --- a/libcxx/include/__coroutine/coroutine_handle.h +++ b/libcxx/include/__coroutine/coroutine_handle.h @@ -63,7 +63,7 @@ _LIBCPP_HIDE_FROM_ABI bool done() const { - _LIBCPP_ASSERT(__is_suspended(), "done() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines"); return __builtin_coro_done(__handle_); } @@ -73,14 +73,14 @@ _LIBCPP_HIDE_FROM_ABI void resume() const { - _LIBCPP_ASSERT(__is_suspended(), "resume() can be called only on suspended coroutines"); - _LIBCPP_ASSERT(!done(), "resume() has undefined behavior when the coroutine is done"); + _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done"); __builtin_coro_resume(__handle_); } _LIBCPP_HIDE_FROM_ABI void destroy() const { - _LIBCPP_ASSERT(__is_suspended(), "destroy() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines"); __builtin_coro_destroy(__handle_); } @@ -152,7 +152,7 @@ _LIBCPP_HIDE_FROM_ABI bool done() const { - _LIBCPP_ASSERT(__is_suspended(), "done() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "done() can be called only on suspended coroutines"); return __builtin_coro_done(__handle_); } @@ -162,14 +162,14 @@ _LIBCPP_HIDE_FROM_ABI void resume() const { - _LIBCPP_ASSERT(__is_suspended(), "resume() can be called only on suspended coroutines"); - _LIBCPP_ASSERT(!done(), "resume() has undefined behavior when the coroutine is done"); + _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "resume() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_UNCATEGORIZED(!done(), "resume() has undefined behavior when the coroutine is done"); __builtin_coro_resume(__handle_); } _LIBCPP_HIDE_FROM_ABI void destroy() const { - _LIBCPP_ASSERT(__is_suspended(), "destroy() can be called only on suspended coroutines"); + _LIBCPP_ASSERT_UNCATEGORIZED(__is_suspended(), "destroy() can be called only on suspended coroutines"); __builtin_coro_destroy(__handle_); } diff --git a/libcxx/include/__debug_utils/strict_weak_ordering_check.h b/libcxx/include/__debug_utils/strict_weak_ordering_check.h --- a/libcxx/include/__debug_utils/strict_weak_ordering_check.h +++ b/libcxx/include/__debug_utils/strict_weak_ordering_check.h @@ -31,8 +31,9 @@ using _Comp_ref = __comp_ref_type<_Comp>; if (!__libcpp_is_constant_evaluated()) { // Check if the range is actually sorted. - _LIBCPP_ASSERT((std::is_sorted<_RandomAccessIterator, _Comp_ref>(__first, __last, _Comp_ref(__comp))), - "The range is not sorted after the sort, your comparator is not a valid strict-weak ordering"); + _LIBCPP_ASSERT_UNCATEGORIZED( + (std::is_sorted<_RandomAccessIterator, _Comp_ref>(__first, __last, _Comp_ref(__comp))), + "The range is not sorted after the sort, your comparator is not a valid strict-weak ordering"); // Limit the number of elements we need to check. __diff_t __size = __last - __first > __diff_t(100) ? __diff_t(100) : __last - __first; __diff_t __p = 0; @@ -45,18 +46,18 @@ // Check that the elements from __p to __q are equal between each other. for (__diff_t __b = __p; __b < __q; ++__b) { for (__diff_t __a = __p; __a <= __b; ++__a) { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( !__comp(*(__first + __a), *(__first + __b)), "Your comparator is not a valid strict-weak ordering"); - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( !__comp(*(__first + __b), *(__first + __a)), "Your comparator is not a valid strict-weak ordering"); } } // Check that elements between __p and __q are less than between __q and __size. for (__diff_t __a = __p; __a < __q; ++__a) { for (__diff_t __b = __q; __b < __size; ++__b) { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __comp(*(__first + __a), *(__first + __b)), "Your comparator is not a valid strict-weak ordering"); - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( !__comp(*(__first + __b), *(__first + __a)), "Your comparator is not a valid strict-weak ordering"); } } diff --git a/libcxx/include/__expected/expected.h b/libcxx/include/__expected/expected.h --- a/libcxx/include/__expected/expected.h +++ b/libcxx/include/__expected/expected.h @@ -522,32 +522,32 @@ // [expected.object.obs], observers _LIBCPP_HIDE_FROM_ABI constexpr const _Tp* operator->() const noexcept { - _LIBCPP_ASSERT(__has_val_, "expected::operator-> requires the expected to contain a value"); + _LIBCPP_ASSERT_UNCATEGORIZED(__has_val_, "expected::operator-> requires the expected to contain a value"); return std::addressof(__union_.__val_); } _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator->() noexcept { - _LIBCPP_ASSERT(__has_val_, "expected::operator-> requires the expected to contain a value"); + _LIBCPP_ASSERT_UNCATEGORIZED(__has_val_, "expected::operator-> requires the expected to contain a value"); return std::addressof(__union_.__val_); } _LIBCPP_HIDE_FROM_ABI constexpr const _Tp& operator*() const& noexcept { - _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); + _LIBCPP_ASSERT_UNCATEGORIZED(__has_val_, "expected::operator* requires the expected to contain a value"); return __union_.__val_; } _LIBCPP_HIDE_FROM_ABI constexpr _Tp& operator*() & noexcept { - _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); + _LIBCPP_ASSERT_UNCATEGORIZED(__has_val_, "expected::operator* requires the expected to contain a value"); return __union_.__val_; } _LIBCPP_HIDE_FROM_ABI constexpr const _Tp&& operator*() const&& noexcept { - _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); + _LIBCPP_ASSERT_UNCATEGORIZED(__has_val_, "expected::operator* requires the expected to contain a value"); return std::move(__union_.__val_); } _LIBCPP_HIDE_FROM_ABI constexpr _Tp&& operator*() && noexcept { - _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); + _LIBCPP_ASSERT_UNCATEGORIZED(__has_val_, "expected::operator* requires the expected to contain a value"); return std::move(__union_.__val_); } @@ -584,22 +584,22 @@ } _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { - _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__has_val_, "expected::error requires the expected to contain an error"); return __union_.__unex_; } _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { - _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__has_val_, "expected::error requires the expected to contain an error"); return __union_.__unex_; } _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { - _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__has_val_, "expected::error requires the expected to contain an error"); return std::move(__union_.__unex_); } _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { - _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__has_val_, "expected::error requires the expected to contain an error"); return std::move(__union_.__unex_); } @@ -1207,7 +1207,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool has_value() const noexcept { return __has_val_; } _LIBCPP_HIDE_FROM_ABI constexpr void operator*() const noexcept { - _LIBCPP_ASSERT(__has_val_, "expected::operator* requires the expected to contain a value"); + _LIBCPP_ASSERT_UNCATEGORIZED(__has_val_, "expected::operator* requires the expected to contain a value"); } _LIBCPP_HIDE_FROM_ABI constexpr void value() const& { @@ -1223,22 +1223,22 @@ } _LIBCPP_HIDE_FROM_ABI constexpr const _Err& error() const& noexcept { - _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__has_val_, "expected::error requires the expected to contain an error"); return __union_.__unex_; } _LIBCPP_HIDE_FROM_ABI constexpr _Err& error() & noexcept { - _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__has_val_, "expected::error requires the expected to contain an error"); return __union_.__unex_; } _LIBCPP_HIDE_FROM_ABI constexpr const _Err&& error() const&& noexcept { - _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__has_val_, "expected::error requires the expected to contain an error"); return std::move(__union_.__unex_); } _LIBCPP_HIDE_FROM_ABI constexpr _Err&& error() && noexcept { - _LIBCPP_ASSERT(!__has_val_, "expected::error requires the expected to contain an error"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__has_val_, "expected::error requires the expected to contain an error"); return std::move(__union_.__unex_); } diff --git a/libcxx/include/__filesystem/directory_iterator.h b/libcxx/include/__filesystem/directory_iterator.h --- a/libcxx/include/__filesystem/directory_iterator.h +++ b/libcxx/include/__filesystem/directory_iterator.h @@ -83,7 +83,7 @@ _LIBCPP_HIDE_FROM_ABI const directory_entry& operator*() const { - _LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced"); + _LIBCPP_ASSERT_UNCATEGORIZED(__imp_, "The end iterator cannot be dereferenced"); return __dereference(); } diff --git a/libcxx/include/__filesystem/path_iterator.h b/libcxx/include/__filesystem/path_iterator.h --- a/libcxx/include/__filesystem/path_iterator.h +++ b/libcxx/include/__filesystem/path_iterator.h @@ -67,10 +67,10 @@ _LIBCPP_INLINE_VISIBILITY iterator& operator++() { - _LIBCPP_ASSERT(__state_ != _Singular, - "attempting to increment a singular iterator"); - _LIBCPP_ASSERT(__state_ != _AtEnd, - "attempting to increment the end iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular, + "attempting to increment a singular iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _AtEnd, + "attempting to increment the end iterator"); return __increment(); } @@ -83,10 +83,10 @@ _LIBCPP_INLINE_VISIBILITY iterator& operator--() { - _LIBCPP_ASSERT(__state_ != _Singular, - "attempting to decrement a singular iterator"); - _LIBCPP_ASSERT(__entry_.data() != __path_ptr_->native().data(), - "attempting to decrement the begin iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__state_ != _Singular, + "attempting to decrement a singular iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__entry_.data() != __path_ptr_->native().data(), + "attempting to decrement the begin iterator"); return __decrement(); } diff --git a/libcxx/include/__format/buffer.h b/libcxx/include/__format/buffer.h --- a/libcxx/include/__format/buffer.h +++ b/libcxx/include/__format/buffer.h @@ -115,7 +115,7 @@ // The output doesn't fit in the internal buffer. // Copy the data in "__capacity_" sized chunks. - _LIBCPP_ASSERT(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); + _LIBCPP_ASSERT_UNCATEGORIZED(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); const _InCharT* __first = __str.data(); do { size_t __chunk = _VSTD::min(__n, __capacity_); @@ -132,7 +132,7 @@ /// Like @ref __copy it may need to do type conversion. template <__fmt_char_type _InCharT, class _UnaryOperation> _LIBCPP_HIDE_FROM_ABI void __transform(const _InCharT* __first, const _InCharT* __last, _UnaryOperation __operation) { - _LIBCPP_ASSERT(__first <= __last, "not a valid range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "not a valid range"); size_t __n = static_cast(__last - __first); __flush_on_overflow(__n); @@ -144,7 +144,7 @@ // The output doesn't fit in the internal buffer. // Transform the data in "__capacity_" sized chunks. - _LIBCPP_ASSERT(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); + _LIBCPP_ASSERT_UNCATEGORIZED(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); do { size_t __chunk = _VSTD::min(__n, __capacity_); _VSTD::transform(__first, __first + __chunk, _VSTD::addressof(__ptr_[__size_]), __operation); @@ -166,7 +166,7 @@ // The output doesn't fit in the internal buffer. // Fill the buffer in "__capacity_" sized chunks. - _LIBCPP_ASSERT(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); + _LIBCPP_ASSERT_UNCATEGORIZED(__size_ == 0, "the buffer should be flushed by __flush_on_overflow"); do { size_t __chunk = _VSTD::min(__n, __capacity_); _VSTD::fill_n(_VSTD::addressof(__ptr_[__size_]), __chunk, __value); @@ -584,7 +584,7 @@ template <__fmt_char_type _InCharT, class _UnaryOperation> _LIBCPP_HIDE_FROM_ABI void __transform(const _InCharT* __first, const _InCharT* __last, _UnaryOperation __operation) { - _LIBCPP_ASSERT(__first <= __last, "not a valid range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "not a valid range"); size_t __n = static_cast(__last - __first); if (__size_ + __n >= __capacity_) @@ -611,7 +611,7 @@ _LIBCPP_HIDE_FROM_ABI void __grow_buffer() { __grow_buffer(__capacity_ * 1.6); } _LIBCPP_HIDE_FROM_ABI void __grow_buffer(size_t __capacity) { - _LIBCPP_ASSERT(__capacity > __capacity_, "the buffer must grow"); + _LIBCPP_ASSERT_UNCATEGORIZED(__capacity > __capacity_, "the buffer must grow"); auto __result = std::__allocate_at_least(__alloc_, __capacity); auto __guard = std::__make_exception_guard([&] { allocator_traits<_Alloc>::deallocate(__alloc_, __result.ptr, __result.count); diff --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h --- a/libcxx/include/__format/format_arg.h +++ b/libcxx/include/__format/format_arg.h @@ -85,7 +85,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr __arg_t __get_packed_type(uint64_t __types, size_t __id) { - _LIBCPP_ASSERT(__id <= __packed_types_max, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__id <= __packed_types_max, ""); if (__id > 0) __types >>= __id * __packed_arg_t_bits; diff --git a/libcxx/include/__format/format_string.h b/libcxx/include/__format/format_string.h --- a/libcxx/include/__format/format_string.h +++ b/libcxx/include/__format/format_string.h @@ -66,8 +66,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> __parse_automatic(_Iterator __begin, _Iterator, auto& __parse_ctx) { size_t __value = __parse_ctx.next_arg_id(); - _LIBCPP_ASSERT(__value <= __number_max, - "Compilers don't support this number of arguments"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __value <= __number_max, + "Compilers don't support this number of arguments"); return {__begin, uint32_t(__value)}; } diff --git a/libcxx/include/__format/formatter_bool.h b/libcxx/include/__format/formatter_bool.h --- a/libcxx/include/__format/formatter_bool.h +++ b/libcxx/include/__format/formatter_bool.h @@ -64,7 +64,7 @@ static_cast(__value), __ctx, __parser_.__get_parsed_std_specifications(__ctx)); default: - _LIBCPP_ASSERT(false, "The parse function should have validated the type"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "The parse function should have validated the type"); __libcpp_unreachable(); } } diff --git a/libcxx/include/__format/formatter_floating_point.h b/libcxx/include/__format/formatter_floating_point.h --- a/libcxx/include/__format/formatter_floating_point.h +++ b/libcxx/include/__format/formatter_floating_point.h @@ -56,21 +56,21 @@ template _LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value) { to_chars_result __r = _VSTD::to_chars(__first, __last, __value); - _LIBCPP_ASSERT(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); return __r.ptr; } template _LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value, chars_format __fmt) { to_chars_result __r = _VSTD::to_chars(__first, __last, __value, __fmt); - _LIBCPP_ASSERT(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); return __r.ptr; } template _LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value, chars_format __fmt, int __precision) { to_chars_result __r = _VSTD::to_chars(__first, __last, __value, __fmt, __precision); - _LIBCPP_ASSERT(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); return __r.ptr; } @@ -252,10 +252,10 @@ __result.__radix_point = __result.__last; // clang-format off - _LIBCPP_ASSERT((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent == __result.__last || *__result.__exponent == 'e'), - "Post-condition failure."); + _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent == __result.__last || *__result.__exponent == 'e'), + "Post-condition failure."); // clang-format on return __result; @@ -305,10 +305,10 @@ } // clang-format off - _LIBCPP_ASSERT((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent != __result.__last && *__result.__exponent == 'p'), - "Post-condition failure."); + _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent != __result.__last && *__result.__exponent == 'p'), + "Post-condition failure."); // clang-format on return __result; @@ -335,7 +335,7 @@ __formatter::__to_buffer(__integral, __buffer.end(), __value, chars_format::scientific, __precision); char* __first = __integral + 1; - _LIBCPP_ASSERT(__first != __result.__last, "No exponent present"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first != __result.__last, "No exponent present"); if (*__first == '.') { __result.__radix_point = __first; __result.__exponent = __formatter::__find_exponent(__first + 1, __result.__last); @@ -345,10 +345,10 @@ } // clang-format off - _LIBCPP_ASSERT((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent != __result.__last && *__result.__exponent == 'e'), - "Post-condition failure."); + _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent != __result.__last && *__result.__exponent == 'e'), + "Post-condition failure."); // clang-format on return __result; } @@ -378,10 +378,10 @@ __result.__exponent = __result.__last; // clang-format off - _LIBCPP_ASSERT((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent == __result.__last), - "Post-condition failure."); + _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent == __result.__last), + "Post-condition failure."); // clang-format on return __result; } @@ -415,10 +415,10 @@ } // clang-format off - _LIBCPP_ASSERT((__result.__integral != __result.__last) && - (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && - (__result.__exponent == __result.__last || *__result.__exponent == 'e'), - "Post-condition failure."); + _LIBCPP_ASSERT_UNCATEGORIZED((__result.__integral != __result.__last) && + (__result.__radix_point == __result.__last || *__result.__radix_point == '.') && + (__result.__exponent == __result.__last || *__result.__exponent == 'e'), + "Post-condition failure."); // clang-format on return __result; @@ -490,7 +490,7 @@ return __formatter::__format_buffer_general_upper_case(__buffer, __value, __buffer.__precision(), __first); default: - _LIBCPP_ASSERT(false, "The parser should have validated the type"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "The parser should have validated the type"); __libcpp_unreachable(); } } diff --git a/libcxx/include/__format/formatter_integral.h b/libcxx/include/__format/formatter_integral.h --- a/libcxx/include/__format/formatter_integral.h +++ b/libcxx/include/__format/formatter_integral.h @@ -85,9 +85,9 @@ * regardless whether the @c std::numpunct's type is @c char or @c wchar_t. */ _LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptrdiff_t __size, const string& __grouping) { - _LIBCPP_ASSERT(!__grouping.empty() && __size > __grouping[0], - "The slow grouping formatting is used while there will be no " - "separators written"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__grouping.empty() && __size > __grouping[0], + "The slow grouping formatting is used while there will be no " + "separators written"); string __r; auto __end = __grouping.end() - 1; auto __ptr = __grouping.begin(); @@ -154,7 +154,7 @@ // TODO FMT Evaluate code overhead due to not calling the internal function // directly. (Should be zero overhead.) to_chars_result __r = _VSTD::to_chars(__first, __last, __value, __base); - _LIBCPP_ASSERT(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); return __r.ptr; } @@ -299,7 +299,7 @@ return __formatter::__format_integer(__value, __ctx, __specs, __negative, __array.begin(), __array.end(), "0X", 16); } default: - _LIBCPP_ASSERT(false, "The parse function should have validated the type"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "The parse function should have validated the type"); __libcpp_unreachable(); } } diff --git a/libcxx/include/__format/formatter_output.h b/libcxx/include/__format/formatter_output.h --- a/libcxx/include/__format/formatter_output.h +++ b/libcxx/include/__format/formatter_output.h @@ -72,8 +72,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr __padding_size_result __padding_size(size_t __size, size_t __width, __format_spec::__alignment __align) { - _LIBCPP_ASSERT(__width > __size, "don't call this function when no padding is required"); - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED(__width > __size, "don't call this function when no padding is required"); + _LIBCPP_ASSERT_UNCATEGORIZED( __align != __format_spec::__alignment::__zero_padding, "the caller should have handled the zero-padding"); size_t __fill = __width - __size; @@ -238,8 +238,8 @@ auto __r = __grouping.rbegin(); auto __e = __grouping.rend() - 1; - _LIBCPP_ASSERT(__r != __e, "The slow grouping formatting is used while " - "there will be no separators written."); + _LIBCPP_ASSERT_UNCATEGORIZED(__r != __e, "The slow grouping formatting is used while " + "there will be no separators written."); // The output is divided in small groups of numbers to write: // - A group before the first separator. // - A separator and a group, repeated for the number of separators. @@ -314,7 +314,7 @@ output_iterator&> auto __out_it, __format_spec::__parsed_specifications<_ParserCharT> __specs, ptrdiff_t __size) -> decltype(__out_it) { - _LIBCPP_ASSERT(__first <= __last, "Not a valid range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range"); return __formatter::__write(basic_string_view{__first, __last}, _VSTD::move(__out_it), __specs, __size); } @@ -327,7 +327,7 @@ _Iterator __last, output_iterator&> auto __out_it, __format_spec::__parsed_specifications<_ParserCharT> __specs) -> decltype(__out_it) { - _LIBCPP_ASSERT(__first <= __last, "Not a valid range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range"); return __formatter::__write(__first, __last, _VSTD::move(__out_it), __specs, __last - __first); } @@ -336,7 +336,7 @@ output_iterator auto __out_it, __format_spec::__parsed_specifications<_ParserCharT> __specs, _UnaryOperation __op) -> decltype(__out_it) { - _LIBCPP_ASSERT(__first <= __last, "Not a valid range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range"); ptrdiff_t __size = __last - __first; if (__size >= __specs.__width_) @@ -365,8 +365,9 @@ size_t __size, const _CharT* __exponent, size_t __num_trailing_zeros) -> decltype(__out_it) { - _LIBCPP_ASSERT(__first <= __last, "Not a valid range"); - _LIBCPP_ASSERT(__num_trailing_zeros > 0, "The overload not writing trailing zeros should have been used"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "Not a valid range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__num_trailing_zeros > 0, + "The overload not writing trailing zeros should have been used"); __padding_size_result __padding = __formatter::__padding_size(__size + __num_trailing_zeros, __specs.__width_, __specs.__alignment_); @@ -388,7 +389,7 @@ basic_string_view<_CharT> __str, output_iterator auto __out_it, __format_spec::__parsed_specifications<_CharT> __specs) -> decltype(__out_it) { - _LIBCPP_ASSERT(!__specs.__has_precision(), "use __write_string"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__specs.__has_precision(), "use __write_string"); // No padding -> copy the string if (!__specs.__has_width()) @@ -445,7 +446,7 @@ char __buffer[8]; to_chars_result __r = std::to_chars(std::begin(__buffer), std::end(__buffer), __value, 16); - _LIBCPP_ASSERT(__r.ec == errc(0), "Internal buffer too small"); + _LIBCPP_ASSERT_UNCATEGORIZED(__r.ec == errc(0), "Internal buffer too small"); std::ranges::copy(std::begin(__buffer), __r.ptr, __out_it); __str += _CharT('}'); diff --git a/libcxx/include/__format/formatter_string.h b/libcxx/include/__format/formatter_string.h --- a/libcxx/include/__format/formatter_string.h +++ b/libcxx/include/__format/formatter_string.h @@ -65,8 +65,8 @@ template _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator format(const _CharT* __str, _FormatContext& __ctx) const { - _LIBCPP_ASSERT(__str, "The basic_format_arg constructor should have " - "prevented an invalid pointer."); + _LIBCPP_ASSERT_UNCATEGORIZED(__str, "The basic_format_arg constructor should have " + "prevented an invalid pointer."); __format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx); # if _LIBCPP_STD_VER >= 23 diff --git a/libcxx/include/__format/parser_std_format_spec.h b/libcxx/include/__format/parser_std_format_spec.h --- a/libcxx/include/__format/parser_std_format_spec.h +++ b/libcxx/include/__format/parser_std_format_spec.h @@ -443,9 +443,9 @@ || (same_as<_CharT, wchar_t> && sizeof(wchar_t) == 2) # endif _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) { - _LIBCPP_ASSERT(__begin != __end, - "when called with an empty input the function will cause " - "undefined behavior by evaluating data not in the input"); + _LIBCPP_ASSERT_UNCATEGORIZED(__begin != __end, + "when called with an empty input the function will cause " + "undefined behavior by evaluating data not in the input"); __unicode::__code_point_view<_CharT> __view{__begin, __end}; __unicode::__consume_result __consumed = __view.__consume(); if (__consumed.__status != __unicode::__consume_result::__ok) @@ -475,9 +475,9 @@ template requires(same_as<_CharT, wchar_t> && sizeof(wchar_t) == 4) _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) { - _LIBCPP_ASSERT(__begin != __end, - "when called with an empty input the function will cause " - "undefined behavior by evaluating data not in the input"); + _LIBCPP_ASSERT_UNCATEGORIZED(__begin != __end, + "when called with an empty input the function will cause " + "undefined behavior by evaluating data not in the input"); if (__begin + 1 != __end && __parse_alignment(*(__begin + 1))) { if (!__unicode::__is_scalar_value(*__begin)) std::__throw_format_error("The fill character contains an invalid value"); @@ -502,9 +502,9 @@ // range-fill and tuple-fill are identical template _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) { - _LIBCPP_ASSERT(__begin != __end, - "when called with an empty input the function will cause " - "undefined behavior by evaluating data not in the input"); + _LIBCPP_ASSERT_UNCATEGORIZED(__begin != __end, + "when called with an empty input the function will cause " + "undefined behavior by evaluating data not in the input"); if (__begin + 1 != __end) { if (__parse_alignment(*(__begin + 1))) { __validate_fill_character(*__begin, __use_range_fill); @@ -582,8 +582,8 @@ __format::__parse_number_result __r = __format::__parse_number(__begin, __end); __width_ = __r.__value; - _LIBCPP_ASSERT(__width_ != 0, "A zero value isn't allowed and should be impossible, " - "due to validations in this function"); + _LIBCPP_ASSERT_UNCATEGORIZED(__width_ != 0, "A zero value isn't allowed and should be impossible, " + "due to validations in this function"); __begin = __r.__last; return true; } diff --git a/libcxx/include/__format/range_formatter.h b/libcxx/include/__format/range_formatter.h --- a/libcxx/include/__format/range_formatter.h +++ b/libcxx/include/__format/range_formatter.h @@ -263,8 +263,9 @@ __parse_empty_range_underlying_spec(_ParseContext& __ctx, typename _ParseContext::iterator __begin) { __ctx.advance_to(__begin); [[maybe_unused]] typename _ParseContext::iterator __result = __underlying_.parse(__ctx); - _LIBCPP_ASSERT(__result == __begin, - "the underlying's parse function should not advance the input beyond the end of the input"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __result == __begin, + "the underlying's parse function should not advance the input beyond the end of the input"); return __begin; } diff --git a/libcxx/include/__format/unicode.h b/libcxx/include/__format/unicode.h --- a/libcxx/include/__format/unicode.h +++ b/libcxx/include/__format/unicode.h @@ -155,7 +155,7 @@ // - The parser always needs to consume these code units // - The code is optimized for well-formed UTF-8 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept { - _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first_ != __last_, "can't move beyond the end of input"); // Based on the number of leading 1 bits the number of code units in the // code point can be determined. See @@ -261,7 +261,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept { - _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first_ != __last_, "can't move beyond the end of input"); char32_t __value = static_cast(*__first_++); if constexpr (sizeof(wchar_t) == 2) { @@ -307,8 +307,8 @@ // *** Break at the start and end of text, unless the text is empty. *** - _LIBCPP_ASSERT(__prev != __property::__sot, "should be handled in the constructor"); // GB1 - _LIBCPP_ASSERT(__prev != __property::__eot, "should be handled by our caller"); // GB2 + _LIBCPP_ASSERT_UNCATEGORIZED(__prev != __property::__sot, "should be handled in the constructor"); // GB1 + _LIBCPP_ASSERT_UNCATEGORIZED(__prev != __property::__eot, "should be handled by our caller"); // GB2 // *** Do not break between a CR and LF. Otherwise, break before and after controls. *** if (__prev == __property::__CR && __next == __property::__LF) // GB3 @@ -404,7 +404,7 @@ }; _LIBCPP_HIDE_FROM_ABI constexpr __cluster __consume() { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __next_prop_ != __extended_grapheme_custer_property_boundary::__property::__eot, "can't move beyond the end of input"); @@ -463,7 +463,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Iterator __position() const noexcept { return __first_; } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept { - _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first_ != __last_, "can't move beyond the end of input"); return {static_cast(*__first_++)}; } diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -923,7 +923,7 @@ { } virtual __base<_Rp(_ArgTypes...)>* __clone() const { - _LIBCPP_ASSERT(false, + _LIBCPP_ASSERT_UNCATEGORIZED(false, "Block pointers are just pointers, so they should always fit into " "std::function's small buffer optimization. This function should " "never be invoked."); @@ -943,7 +943,7 @@ } virtual void destroy_deallocate() _NOEXCEPT { - _LIBCPP_ASSERT(false, + _LIBCPP_ASSERT_UNCATEGORIZED(false, "Block pointers are just pointers, so they should always fit into " "std::function's small buffer optimization. This function should " "never be invoked."); diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table --- a/libcxx/include/__hash_table +++ b/libcxx/include/__hash_table @@ -1194,7 +1194,7 @@ _LIBCPP_INLINE_VISIBILITY size_type bucket(const _Key& __k) const { - _LIBCPP_ASSERT(bucket_count() > 0, + _LIBCPP_ASSERT_UNCATEGORIZED(bucket_count() > 0, "unordered container::bucket(key) called when bucket_count() == 0"); return std::__constrain_hash(hash_function()(__k), bucket_count()); } @@ -1259,7 +1259,7 @@ } _LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf) _NOEXCEPT { - _LIBCPP_ASSERT(__mlf > 0, + _LIBCPP_ASSERT_UNCATEGORIZED(__mlf > 0, "unordered container::max_load_factor(lf) called with lf <= 0"); max_load_factor() = _VSTD::max(__mlf, load_factor()); } @@ -1268,7 +1268,7 @@ local_iterator begin(size_type __n) { - _LIBCPP_ASSERT(__n < bucket_count(), + _LIBCPP_ASSERT_UNCATEGORIZED(__n < bucket_count(), "unordered container::begin(n) called with n >= bucket_count()"); return local_iterator(__bucket_list_[__n], __n, bucket_count(), this); } @@ -1277,7 +1277,7 @@ local_iterator end(size_type __n) { - _LIBCPP_ASSERT(__n < bucket_count(), + _LIBCPP_ASSERT_UNCATEGORIZED(__n < bucket_count(), "unordered container::end(n) called with n >= bucket_count()"); return local_iterator(nullptr, __n, bucket_count(), this); } @@ -1286,7 +1286,7 @@ const_local_iterator cbegin(size_type __n) const { - _LIBCPP_ASSERT(__n < bucket_count(), + _LIBCPP_ASSERT_UNCATEGORIZED(__n < bucket_count(), "unordered container::cbegin(n) called with n >= bucket_count()"); return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this); } @@ -1295,7 +1295,7 @@ const_local_iterator cend(size_type __n) const { - _LIBCPP_ASSERT(__n < bucket_count(), + _LIBCPP_ASSERT_UNCATEGORIZED(__n < bucket_count(), "unordered container::cend(n) called with n >= bucket_count()"); return const_local_iterator(nullptr, __n, bucket_count(), this); } @@ -2415,8 +2415,8 @@ _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "unordered container erase(iterator) called with an iterator not" " referring to this container"); - _LIBCPP_ASSERT(__p != end(), - "unordered container erase(iterator) called with a non-dereferenceable iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__p != end(), + "unordered container erase(iterator) called with a non-dereferenceable iterator"); iterator __r(__np, this); ++__r; remove(__p); @@ -2636,10 +2636,10 @@ _NOEXCEPT_(__is_nothrow_swappable::value && __is_nothrow_swappable::value) #endif { - _LIBCPP_ASSERT(__node_traits::propagate_on_container_swap::value || - this->__node_alloc() == __u.__node_alloc(), - "list::swap: Either propagate_on_container_swap must be true" - " or the allocators must compare equal"); + _LIBCPP_ASSERT_UNCATEGORIZED(__node_traits::propagate_on_container_swap::value || + this->__node_alloc() == __u.__node_alloc(), + "list::swap: Either propagate_on_container_swap must be true" + " or the allocators must compare equal"); { __node_pointer_pointer __npp = __bucket_list_.release(); __bucket_list_.reset(__u.__bucket_list_.release()); @@ -2665,7 +2665,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const { - _LIBCPP_ASSERT(__n < bucket_count(), + _LIBCPP_ASSERT_UNCATEGORIZED(__n < bucket_count(), "unordered container::bucket_size(n) called with n >= bucket_count()"); __next_pointer __np = __bucket_list_[__n]; size_type __bc = bucket_count(); diff --git a/libcxx/include/__iterator/advance.h b/libcxx/include/__iterator/advance.h --- a/libcxx/include/__iterator/advance.h +++ b/libcxx/include/__iterator/advance.h @@ -63,8 +63,8 @@ void advance(_InputIter& __i, _Distance __orig_n) { typedef typename iterator_traits<_InputIter>::difference_type _Difference; _Difference __n = static_cast<_Difference>(_VSTD::__convert_to_integral(__orig_n)); - _LIBCPP_ASSERT(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value, - "Attempt to advance(it, n) with negative n on a non-bidirectional iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value, + "Attempt to advance(it, n) with negative n on a non-bidirectional iterator"); _VSTD::__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); } @@ -100,8 +100,8 @@ template _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Ip& __i, iter_difference_t<_Ip> __n) const { - _LIBCPP_ASSERT(__n >= 0 || bidirectional_iterator<_Ip>, - "If `n < 0`, then `bidirectional_iterator` must be true."); + _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || bidirectional_iterator<_Ip>, + "If `n < 0`, then `bidirectional_iterator` must be true."); // If `I` models `random_access_iterator`, equivalent to `i += n`. if constexpr (random_access_iterator<_Ip>) { @@ -147,8 +147,8 @@ template _Sp> _LIBCPP_HIDE_FROM_ABI constexpr iter_difference_t<_Ip> operator()(_Ip& __i, iter_difference_t<_Ip> __n, _Sp __bound_sentinel) const { - _LIBCPP_ASSERT((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>), - "If `n < 0`, then `bidirectional_iterator && same_as` must be true."); + _LIBCPP_ASSERT_UNCATEGORIZED((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>), + "If `n < 0`, then `bidirectional_iterator && same_as` must be true."); // If `S` and `I` model `sized_sentinel_for`: if constexpr (sized_sentinel_for<_Sp, _Ip>) { // If |n| >= |bound_sentinel - i|, equivalent to `ranges::advance(i, bound_sentinel)`. diff --git a/libcxx/include/__iterator/bounded_iter.h b/libcxx/include/__iterator/bounded_iter.h --- a/libcxx/include/__iterator/bounded_iter.h +++ b/libcxx/include/__iterator/bounded_iter.h @@ -78,7 +78,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit __bounded_iter( _Iterator __current, _Iterator __begin, _Iterator __end) : __current_(__current), __begin_(__begin), __end_(__end) { - _LIBCPP_ASSERT(__begin <= __end, "__bounded_iter(current, begin, end): [begin, end) is not a valid range"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __begin <= __end, "__bounded_iter(current, begin, end): [begin, end) is not a valid range"); } template @@ -89,19 +90,19 @@ // // These operations check that the iterator is dereferenceable, that is within [begin, end). _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator*() const _NOEXCEPT { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __in_bounds(__current_), "__bounded_iter::operator*: Attempt to dereference an out-of-range iterator"); return *__current_; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pointer operator->() const _NOEXCEPT { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __in_bounds(__current_), "__bounded_iter::operator->: Attempt to dereference an out-of-range iterator"); return std::__to_address(__current_); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 reference operator[](difference_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __in_bounds(__current_ + __n), "__bounded_iter::operator[]: Attempt to index an iterator out-of-range"); return __current_[__n]; } diff --git a/libcxx/include/__iterator/common_iterator.h b/libcxx/include/__iterator/common_iterator.h --- a/libcxx/include/__iterator/common_iterator.h +++ b/libcxx/include/__iterator/common_iterator.h @@ -72,7 +72,8 @@ requires convertible_to && convertible_to _LIBCPP_HIDE_FROM_ABI constexpr common_iterator(const common_iterator<_I2, _S2>& __other) : __hold_([&]() -> variant<_Iter, _Sent> { - _LIBCPP_ASSERT(!__other.__hold_.valueless_by_exception(), "Attempted to construct from a valueless common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__other.__hold_.valueless_by_exception(), + "Attempted to construct from a valueless common_iterator"); if (__other.__hold_.index() == 0) return variant<_Iter, _Sent>{in_place_index<0>, _VSTD::__unchecked_get<0>(__other.__hold_)}; return variant<_Iter, _Sent>{in_place_index<1>, _VSTD::__unchecked_get<1>(__other.__hold_)}; @@ -82,7 +83,8 @@ requires convertible_to && convertible_to && assignable_from<_Iter&, const _I2&> && assignable_from<_Sent&, const _S2&> _LIBCPP_HIDE_FROM_ABI common_iterator& operator=(const common_iterator<_I2, _S2>& __other) { - _LIBCPP_ASSERT(!__other.__hold_.valueless_by_exception(), "Attempted to assign from a valueless common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__other.__hold_.valueless_by_exception(), + "Attempted to assign from a valueless common_iterator"); auto __idx = __hold_.index(); auto __other_idx = __other.__hold_.index(); @@ -104,14 +106,16 @@ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() { - _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_), + "Attempted to dereference a non-dereferenceable common_iterator"); return *_VSTD::__unchecked_get<_Iter>(__hold_); } _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const requires __dereferenceable { - _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_), + "Attempted to dereference a non-dereferenceable common_iterator"); return *_VSTD::__unchecked_get<_Iter>(__hold_); } @@ -122,7 +126,8 @@ is_reference_v> || constructible_from, iter_reference_t<_I2>>) { - _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to dereference a non-dereferenceable common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_), + "Attempted to dereference a non-dereferenceable common_iterator"); if constexpr (is_pointer_v<_Iter> || requires(const _Iter& __i) { __i.operator->(); }) { return _VSTD::__unchecked_get<_Iter>(__hold_); } else if constexpr (is_reference_v>) { @@ -134,12 +139,14 @@ } _LIBCPP_HIDE_FROM_ABI common_iterator& operator++() { - _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_), + "Attempted to increment a non-dereferenceable common_iterator"); ++_VSTD::__unchecked_get<_Iter>(__hold_); return *this; } _LIBCPP_HIDE_FROM_ABI decltype(auto) operator++(int) { - _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__hold_), "Attempted to increment a non-dereferenceable common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__hold_), + "Attempted to increment a non-dereferenceable common_iterator"); if constexpr (forward_iterator<_Iter>) { auto __tmp = *this; ++*this; @@ -158,8 +165,10 @@ requires sentinel_for<_Sent, _I2> _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) { - _LIBCPP_ASSERT(!__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); - _LIBCPP_ASSERT(!__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__x.__hold_.valueless_by_exception(), + "Attempted to compare a valueless common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__y.__hold_.valueless_by_exception(), + "Attempted to compare a valueless common_iterator"); auto __x_index = __x.__hold_.index(); auto __y_index = __y.__hold_.index(); @@ -177,8 +186,10 @@ requires sentinel_for<_Sent, _I2> && equality_comparable_with<_Iter, _I2> _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) { - _LIBCPP_ASSERT(!__x.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); - _LIBCPP_ASSERT(!__y.__hold_.valueless_by_exception(), "Attempted to compare a valueless common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__x.__hold_.valueless_by_exception(), + "Attempted to compare a valueless common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__y.__hold_.valueless_by_exception(), + "Attempted to compare a valueless common_iterator"); auto __x_index = __x.__hold_.index(); auto __y_index = __y.__hold_.index(); @@ -199,8 +210,10 @@ requires sized_sentinel_for<_Sent, _I2> _LIBCPP_HIDE_FROM_ABI friend constexpr iter_difference_t<_I2> operator-(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) { - _LIBCPP_ASSERT(!__x.__hold_.valueless_by_exception(), "Attempted to subtract from a valueless common_iterator"); - _LIBCPP_ASSERT(!__y.__hold_.valueless_by_exception(), "Attempted to subtract a valueless common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__x.__hold_.valueless_by_exception(), + "Attempted to subtract from a valueless common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__y.__hold_.valueless_by_exception(), + "Attempted to subtract a valueless common_iterator"); auto __x_index = __x.__hold_.index(); auto __y_index = __y.__hold_.index(); @@ -221,7 +234,8 @@ noexcept(noexcept(ranges::iter_move(std::declval()))) requires input_iterator<_Iter> { - _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__i.__hold_), "Attempted to iter_move a non-dereferenceable common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__i.__hold_), + "Attempted to iter_move a non-dereferenceable common_iterator"); return ranges::iter_move( _VSTD::__unchecked_get<_Iter>(__i.__hold_)); } @@ -229,8 +243,10 @@ _LIBCPP_HIDE_FROM_ABI friend constexpr void iter_swap(const common_iterator& __x, const common_iterator<_I2, _S2>& __y) noexcept(noexcept(ranges::iter_swap(std::declval(), std::declval()))) { - _LIBCPP_ASSERT(std::holds_alternative<_Iter>(__x.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator"); - _LIBCPP_ASSERT(std::holds_alternative<_I2>(__y.__hold_), "Attempted to iter_swap a non-dereferenceable common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_Iter>(__x.__hold_), + "Attempted to iter_swap a non-dereferenceable common_iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(std::holds_alternative<_I2>(__y.__hold_), + "Attempted to iter_swap a non-dereferenceable common_iterator"); return ranges::iter_swap(_VSTD::__unchecked_get<_Iter>(__x.__hold_), _VSTD::__unchecked_get<_I2>(__y.__hold_)); } }; diff --git a/libcxx/include/__iterator/counted_iterator.h b/libcxx/include/__iterator/counted_iterator.h --- a/libcxx/include/__iterator/counted_iterator.h +++ b/libcxx/include/__iterator/counted_iterator.h @@ -83,7 +83,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator(_Iter __iter, iter_difference_t<_Iter> __n) : __current_(_VSTD::move(__iter)), __count_(__n) { - _LIBCPP_ASSERT(__n >= 0, "__n must not be negative."); + _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0, "__n must not be negative."); } template @@ -112,7 +112,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() { - _LIBCPP_ASSERT(__count_ > 0, "Iterator is equal to or past end."); + _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator is equal to or past end."); return *__current_; } @@ -120,7 +120,7 @@ constexpr decltype(auto) operator*() const requires __dereferenceable { - _LIBCPP_ASSERT(__count_ > 0, "Iterator is equal to or past end."); + _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator is equal to or past end."); return *__current_; } @@ -133,7 +133,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr counted_iterator& operator++() { - _LIBCPP_ASSERT(__count_ > 0, "Iterator already at or past end."); + _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end."); ++__current_; --__count_; return *this; @@ -141,7 +141,7 @@ _LIBCPP_HIDE_FROM_ABI decltype(auto) operator++(int) { - _LIBCPP_ASSERT(__count_ > 0, "Iterator already at or past end."); + _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end."); --__count_; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { return __current_++; } @@ -155,7 +155,7 @@ constexpr counted_iterator operator++(int) requires forward_iterator<_Iter> { - _LIBCPP_ASSERT(__count_ > 0, "Iterator already at or past end."); + _LIBCPP_ASSERT_UNCATEGORIZED(__count_ > 0, "Iterator already at or past end."); counted_iterator __tmp = *this; ++*this; return __tmp; @@ -198,7 +198,7 @@ constexpr counted_iterator& operator+=(iter_difference_t<_Iter> __n) requires random_access_iterator<_Iter> { - _LIBCPP_ASSERT(__n <= __count_, "Cannot advance iterator past end."); + _LIBCPP_ASSERT_UNCATEGORIZED(__n <= __count_, "Cannot advance iterator past end."); __current_ += __n; __count_ -= __n; return *this; @@ -237,9 +237,10 @@ constexpr counted_iterator& operator-=(iter_difference_t<_Iter> __n) requires random_access_iterator<_Iter> { - _LIBCPP_ASSERT(-__n <= __count_, "Attempt to subtract too large of a size: " - "counted_iterator would be decremented before the " - "first element of its range."); + _LIBCPP_ASSERT_UNCATEGORIZED(-__n <= __count_, + "Attempt to subtract too large of a size: " + "counted_iterator would be decremented before the " + "first element of its range."); __current_ -= __n; __count_ += __n; return *this; @@ -249,7 +250,7 @@ constexpr decltype(auto) operator[](iter_difference_t<_Iter> __n) const requires random_access_iterator<_Iter> { - _LIBCPP_ASSERT(__n < __count_, "Subscript argument must be less than size."); + _LIBCPP_ASSERT_UNCATEGORIZED(__n < __count_, "Subscript argument must be less than size."); return __current_[__n]; } @@ -280,7 +281,7 @@ noexcept(noexcept(ranges::iter_move(__i.__current_))) requires input_iterator<_Iter> { - _LIBCPP_ASSERT(__i.__count_ > 0, "Iterator must not be past end of range."); + _LIBCPP_ASSERT_UNCATEGORIZED(__i.__count_ > 0, "Iterator must not be past end of range."); return ranges::iter_move(__i.__current_); } @@ -289,8 +290,8 @@ friend constexpr void iter_swap(const counted_iterator& __x, const counted_iterator<_I2>& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) { - _LIBCPP_ASSERT(__x.__count_ > 0 && __y.__count_ > 0, - "Iterators must not be past end of range."); + _LIBCPP_ASSERT_UNCATEGORIZED(__x.__count_ > 0 && __y.__count_ > 0, + "Iterators must not be past end of range."); return ranges::iter_swap(__x.__current_, __y.__current_); } }; diff --git a/libcxx/include/__iterator/next.h b/libcxx/include/__iterator/next.h --- a/libcxx/include/__iterator/next.h +++ b/libcxx/include/__iterator/next.h @@ -28,8 +28,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 typename enable_if<__has_input_iterator_category<_InputIter>::value, _InputIter>::type next(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) { - _LIBCPP_ASSERT(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value, - "Attempt to next(it, n) with negative n on a non-bidirectional iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || __has_bidirectional_iterator_category<_InputIter>::value, + "Attempt to next(it, n) with negative n on a non-bidirectional iterator"); _VSTD::advance(__x, __n); return __x; diff --git a/libcxx/include/__iterator/prev.h b/libcxx/include/__iterator/prev.h --- a/libcxx/include/__iterator/prev.h +++ b/libcxx/include/__iterator/prev.h @@ -28,8 +28,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 typename enable_if<__has_input_iterator_category<_InputIter>::value, _InputIter>::type prev(_InputIter __x, typename iterator_traits<_InputIter>::difference_type __n = 1) { - _LIBCPP_ASSERT(__n <= 0 || __has_bidirectional_iterator_category<_InputIter>::value, - "Attempt to prev(it, n) with a positive n on a non-bidirectional iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n <= 0 || __has_bidirectional_iterator_category<_InputIter>::value, + "Attempt to prev(it, n) with a positive n on a non-bidirectional iterator"); _VSTD::advance(__x, -__n); return __x; } diff --git a/libcxx/include/__mdspan/extents.h b/libcxx/include/__mdspan/extents.h --- a/libcxx/include/__mdspan/extents.h +++ b/libcxx/include/__mdspan/extents.h @@ -174,8 +174,8 @@ } // Precondition check else - _LIBCPP_ASSERT(__values[__i] == static_cast<_TDynamic>(__static_val), - "extents construction: mismatch of provided arguments with static extents."); + _LIBCPP_ASSERT_UNCATEGORIZED(__values[__i] == static_cast<_TDynamic>(__static_val), + "extents construction: mismatch of provided arguments with static extents."); } } @@ -190,24 +190,24 @@ } // Precondition check else - _LIBCPP_ASSERT(static_cast<_TDynamic>(__vals[__i]) == static_cast<_TDynamic>(__static_val), - "extents construction: mismatch of provided arguments with static extents."); + _LIBCPP_ASSERT_UNCATEGORIZED(static_cast<_TDynamic>(__vals[__i]) == static_cast<_TDynamic>(__static_val), + "extents construction: mismatch of provided arguments with static extents."); } } // access functions _LIBCPP_HIDE_FROM_ABI static constexpr _TStatic __static_value(size_t __i) noexcept { - _LIBCPP_ASSERT(__i < __size_, "extents access: index must be less than rank"); + _LIBCPP_ASSERT_UNCATEGORIZED(__i < __size_, "extents access: index must be less than rank"); return _StaticValues::__get(__i); } _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic __value(size_t __i) const { - _LIBCPP_ASSERT(__i < __size_, "extents access: index must be less than rank"); + _LIBCPP_ASSERT_UNCATEGORIZED(__i < __size_, "extents access: index must be less than rank"); _TStatic __static_val = _StaticValues::__get(__i); return __static_val == _DynTag ? __dyn_vals_[_DynamicIdxMap::__get(__i)] : static_cast<_TDynamic>(__static_val); } _LIBCPP_HIDE_FROM_ABI constexpr _TDynamic operator[](size_t __i) const { - _LIBCPP_ASSERT(__i < __size_, "extents access: index must be less than rank"); + _LIBCPP_ASSERT_UNCATEGORIZED(__i < __size_, "extents access: index must be less than rank"); return __value(__i); } @@ -310,8 +310,8 @@ (sizeof...(_OtherIndexTypes) == __rank_ || sizeof...(_OtherIndexTypes) == __rank_dynamic_)) _LIBCPP_HIDE_FROM_ABI constexpr explicit extents(_OtherIndexTypes... __dynvals) noexcept : __vals_(static_cast(__dynvals)...) { - _LIBCPP_ASSERT(__mdspan_detail::__are_representable_as(__dynvals...), - "extents ctor: arguments must be representable as index_type and nonnegative"); + _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__are_representable_as(__dynvals...), + "extents ctor: arguments must be representable as index_type and nonnegative"); } template @@ -320,8 +320,8 @@ explicit(_Size != __rank_dynamic_) _LIBCPP_HIDE_FROM_ABI constexpr extents(const array<_OtherIndexType, _Size>& __exts) noexcept : __vals_(span(__exts)) { - _LIBCPP_ASSERT(__mdspan_detail::__are_representable_as(span(__exts)), - "extents ctor: arguments must be representable as index_type and nonnegative"); + _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__are_representable_as(span(__exts)), + "extents ctor: arguments must be representable as index_type and nonnegative"); } template @@ -330,8 +330,8 @@ explicit(_Size != __rank_dynamic_) _LIBCPP_HIDE_FROM_ABI constexpr extents(const span<_OtherIndexType, _Size>& __exts) noexcept : __vals_(__exts) { - _LIBCPP_ASSERT(__mdspan_detail::__are_representable_as(__exts), - "extents ctor: arguments must be representable as index_type and nonnegative"); + _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__are_representable_as(__exts), + "extents ctor: arguments must be representable as index_type and nonnegative"); } private: @@ -380,10 +380,10 @@ for (size_t __r = 0; __r < rank(); __r++) { if constexpr (static_cast>(numeric_limits::max()) < static_cast>(numeric_limits<_OtherIndexType>::max())) { - _LIBCPP_ASSERT(__mdspan_detail::__is_representable_as(__other.extent(__r)), - "extents ctor: arguments must be representable as index_type and nonnegative"); + _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_representable_as(__other.extent(__r)), + "extents ctor: arguments must be representable as index_type and nonnegative"); } - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( (_Values::__static_value(__r) == dynamic_extent) || (static_cast(__other.extent(__r)) == static_cast(_Values::__static_value(__r))), "extents construction: mismatch of provided arguments with static extents."); diff --git a/libcxx/include/__memory/assume_aligned.h b/libcxx/include/__memory/assume_aligned.h --- a/libcxx/include/__memory/assume_aligned.h +++ b/libcxx/include/__memory/assume_aligned.h @@ -34,7 +34,7 @@ if (is_constant_evaluated()) { return __ptr; } else { - _LIBCPP_ASSERT(reinterpret_cast(__ptr) % _Np == 0, "Alignment assumption is violated"); + _LIBCPP_ASSERT_UNCATEGORIZED(reinterpret_cast(__ptr) % _Np == 0, "Alignment assumption is violated"); return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Np)); } } diff --git a/libcxx/include/__memory/construct_at.h b/libcxx/include/__memory/construct_at.h --- a/libcxx/include/__memory/construct_at.h +++ b/libcxx/include/__memory/construct_at.h @@ -34,7 +34,7 @@ template ()) _Tp(std::declval<_Args>()...))> _LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __args) { - _LIBCPP_ASSERT(__location != nullptr, "null pointer given to construct_at"); + _LIBCPP_ASSERT_UNCATEGORIZED(__location != nullptr, "null pointer given to construct_at"); return ::new (std::__voidify(*__location)) _Tp(std::forward<_Args>(__args)...); } @@ -45,7 +45,7 @@ #if _LIBCPP_STD_VER >= 20 return std::construct_at(__location, std::forward<_Args>(__args)...); #else - return _LIBCPP_ASSERT(__location != nullptr, "null pointer given to construct_at"), + return _LIBCPP_ASSERT_UNCATEGORIZED(__location != nullptr, "null pointer given to construct_at"), ::new (std::__voidify(*__location)) _Tp(std::forward<_Args>(__args)...); #endif } @@ -62,7 +62,7 @@ template ::value, int>::type = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) { - _LIBCPP_ASSERT(__loc != nullptr, "null pointer given to destroy_at"); + _LIBCPP_ASSERT_UNCATEGORIZED(__loc != nullptr, "null pointer given to destroy_at"); __loc->~_Tp(); } @@ -70,7 +70,7 @@ template ::value, int>::type = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) { - _LIBCPP_ASSERT(__loc != nullptr, "null pointer given to destroy_at"); + _LIBCPP_ASSERT_UNCATEGORIZED(__loc != nullptr, "null pointer given to destroy_at"); std::__destroy(std::begin(*__loc), std::end(*__loc)); } #endif diff --git a/libcxx/include/__memory_resource/polymorphic_allocator.h b/libcxx/include/__memory_resource/polymorphic_allocator.h --- a/libcxx/include/__memory_resource/polymorphic_allocator.h +++ b/libcxx/include/__memory_resource/polymorphic_allocator.h @@ -69,7 +69,7 @@ } _LIBCPP_HIDE_FROM_ABI void deallocate(_ValueType* __p, size_t __n) { - _LIBCPP_ASSERT(__n <= __max_size(), "deallocate called for size which exceeds max_size()"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n <= __max_size(), "deallocate called for size which exceeds max_size()"); __res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType)); } diff --git a/libcxx/include/__node_handle b/libcxx/include/__node_handle --- a/libcxx/include/__node_handle +++ b/libcxx/include/__node_handle @@ -146,7 +146,7 @@ _LIBCPP_INLINE_VISIBILITY __basic_node_handle& operator=(__basic_node_handle&& __other) { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __alloc_ == _VSTD::nullopt || __alloc_traits::propagate_on_container_move_assignment::value || __alloc_ == __other.__alloc_, diff --git a/libcxx/include/__numeric/gcd_lcm.h b/libcxx/include/__numeric/gcd_lcm.h --- a/libcxx/include/__numeric/gcd_lcm.h +++ b/libcxx/include/__numeric/gcd_lcm.h @@ -87,7 +87,7 @@ using _Rp = common_type_t<_Tp,_Up>; _Rp __val1 = __ct_abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n); _Rp __val2 = __ct_abs<_Rp, _Up>()(__n); - _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); + _LIBCPP_ASSERT_UNCATEGORIZED((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); return __val1 * __val2; } 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 @@ -3011,8 +3011,8 @@ __first2, __last2, [__first1, __last1, __first2, __last2, &__comp](_RandomAccessIterator2 __i, _RandomAccessIterator2 __j) { - _LIBCPP_ASSERT(__j > __i, ""); - //_LIBCPP_ASSERT(__j - __i > 1, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__j > __i, ""); + //_LIBCPP_ASSERT_UNCATEGORIZED(__j - __i > 1, ""); // 1. moving boundaries to "consume" subsequence of equal elements auto __is_equal = [&__comp](_RandomAccessIterator2 __a, _RandomAccessIterator2 __b) -> bool { @@ -3035,8 +3035,8 @@ // 2. testing is __a subsequence of the second range included into the first range auto __b = std::lower_bound(__first1, __last1, *__i, __comp); - _LIBCPP_ASSERT(!__comp(*(__last1 - 1), *__b), ""); - _LIBCPP_ASSERT(!__comp(*(__j - 1), *__i), ""); + _LIBCPP_ASSERT_UNCATEGORIZED(!__comp(*(__last1 - 1), *__b), ""); + _LIBCPP_ASSERT_UNCATEGORIZED(!__comp(*(__j - 1), *__i), ""); return !std::includes(__b, __last1, __i, __j, __comp); }); }); @@ -3253,7 +3253,7 @@ } const auto __m2 = __left_bound_seq_2 - __first2; - _LIBCPP_ASSERT(__m1 == 0 || __m2 == 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__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 @@ -295,7 +295,7 @@ _RandomAccessIterator2 __d_first, BinaryOperation __op, /*is_vector=*/std::true_type) noexcept { - _LIBCPP_ASSERT(__first != __last, "Range cannot be empty"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first != __last, "Range cannot be empty"); typedef typename std::iterator_traits<_RandomAccessIterator1>::reference _ReferenceType1; typedef typename std::iterator_traits<_RandomAccessIterator2>::reference _ReferenceType2; @@ -333,7 +333,7 @@ _RandomAccessIterator1 __last, _RandomAccessIterator2 __d_first, _BinaryOperation __op) { - _LIBCPP_ASSERT(__first != __last, "range cannot be empty"); + _LIBCPP_ASSERT_UNCATEGORIZED(__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 @@ -527,7 +527,7 @@ __task* allocate_func_task(_Fn&& __f) { - _LIBCPP_ASSERT(_M_execute_data != nullptr, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_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)); @@ -572,7 +572,7 @@ make_additional_child_of(__task* __parent, _Fn&& __f) { auto __t = make_child_of(__parent, std::forward<_Fn>(__f)); - _LIBCPP_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__parent->_M_refcount.load(std::memory_order_relaxed) > 0, ""); ++__parent->_M_refcount; return __t; } @@ -593,7 +593,7 @@ inline void spawn(__task* __t) { - _LIBCPP_ASSERT(_M_execute_data != nullptr, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_M_execute_data != nullptr, ""); tbb::detail::d1::spawn(*__t, *_M_execute_data->context); } @@ -646,11 +646,11 @@ this->~__func_task(); - _LIBCPP_ASSERT(__parent != nullptr, ""); - _LIBCPP_ASSERT(__parent->_M_refcount.load(std::memory_order_relaxed) > 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__parent != nullptr, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__parent->_M_refcount.load(std::memory_order_relaxed) > 0, ""); if (--__parent->_M_refcount == 0) { - _LIBCPP_ASSERT(__next == nullptr, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__next == nullptr, ""); __alloc.deallocate(this, *__ed); return __parent; } @@ -862,20 +862,20 @@ { const auto __nx = (_M_xe - _M_xs); const auto __ny = (_M_ye - _M_ys); - _LIBCPP_ASSERT(__nx > 0 && __ny > 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__nx > 0 && __ny > 0, ""); - _LIBCPP_ASSERT(_x_orig == _y_orig, ""); - _LIBCPP_ASSERT(!is_partial(), ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_x_orig == _y_orig, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(!is_partial(), ""); if (_x_orig) { - _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), ""); + _LIBCPP_ASSERT_UNCATEGORIZED(std::is_sorted(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_comp), ""); + _LIBCPP_ASSERT_UNCATEGORIZED(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)); } - _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), ""); + _LIBCPP_ASSERT_UNCATEGORIZED(std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp), ""); + _LIBCPP_ASSERT_UNCATEGORIZED(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 @@ -883,7 +883,7 @@ { const auto __nx = (_M_xe - _M_xs); const auto __ny = (_M_ye - _M_ys); - _LIBCPP_ASSERT(__nx > 0 && __ny > 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__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); @@ -914,7 +914,7 @@ __task* merge_ranges(__task* __self) { - _LIBCPP_ASSERT(_x_orig == _y_orig, ""); //two merged subrange must be lie into the same buffer + _LIBCPP_ASSERT_UNCATEGORIZED(_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); @@ -930,15 +930,17 @@ _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()); - _LIBCPP_ASSERT(parent_merge(__self), ""); //not root merging task + _LIBCPP_ASSERT_UNCATEGORIZED(parent_merge(__self), ""); //not root merging task } //merge to "origin" else { - _LIBCPP_ASSERT(_x_orig == _y_orig, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_x_orig == _y_orig, ""); - _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), ""); + _LIBCPP_ASSERT_UNCATEGORIZED( + is_partial() || std::is_sorted(_M_z_beg + _M_xs, _M_z_beg + _M_xe, _M_comp), ""); + _LIBCPP_ASSERT_UNCATEGORIZED( + 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); @@ -955,8 +957,8 @@ __task* process_ranges(__task* __self) { - _LIBCPP_ASSERT(_x_orig == _y_orig, ""); - _LIBCPP_ASSERT(!_split, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_x_orig == _y_orig, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(!_split, ""); auto p = parent_merge(__self); @@ -1002,7 +1004,7 @@ __task* split_merging(__task* __self) { - _LIBCPP_ASSERT(_x_orig == _y_orig, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_x_orig == _y_orig, ""); const auto __nx = (_M_xe - _M_xs); const auto __ny = (_M_ye - _M_ys); @@ -1074,8 +1076,8 @@ { const _SizeType __nx = (_M_xe - _M_xs); const _SizeType __ny = (_M_ye - _M_ys); - _LIBCPP_ASSERT(__nx > 0, ""); - _LIBCPP_ASSERT(__nx > 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__nx > 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__nx > 0, ""); if (__nx < __ny) move_x_range(); @@ -1131,7 +1133,7 @@ if (__n <= __sort_cut_off) { _M_leaf_sort(_M_xs, _M_xe, _M_comp); - _LIBCPP_ASSERT(!_M_root, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(!_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 @@ -56,7 +56,7 @@ constexpr bool __same_move_seq = std::is_same<_MoveSequenceX, _MoveSequenceY>::value; auto __n = _M_nmerge; - _LIBCPP_ASSERT(__n > 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__n > 0, ""); auto __nx = __xe - __xs; //auto __ny = __ye - __ys; diff --git a/libcxx/include/__random/negative_binomial_distribution.h b/libcxx/include/__random/negative_binomial_distribution.h --- a/libcxx/include/__random/negative_binomial_distribution.h +++ b/libcxx/include/__random/negative_binomial_distribution.h @@ -136,8 +136,9 @@ else ++__f; } - _LIBCPP_ASSERT(__f >= 0, "std::negative_binomial_distribution should never produce negative values. " - "This is almost certainly a signed integer overflow issue on __f."); + _LIBCPP_ASSERT_UNCATEGORIZED(__f >= 0, + "std::negative_binomial_distribution should never produce negative values. " + "This is almost certainly a signed integer overflow issue on __f."); return __f; } return poisson_distribution(gamma_distribution diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h --- a/libcxx/include/__ranges/drop_view.h +++ b/libcxx/include/__ranges/drop_view.h @@ -78,7 +78,7 @@ : __count_(__count) , __base_(std::move(__base)) { - _LIBCPP_ASSERT(__count_ >= 0, "count must be greater than or equal to zero."); + _LIBCPP_ASSERT_UNCATEGORIZED(__count_ >= 0, "count must be greater than or equal to zero."); } _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& requires copy_constructible<_View> { return __base_; } diff --git a/libcxx/include/__ranges/drop_while_view.h b/libcxx/include/__ranges/drop_while_view.h --- a/libcxx/include/__ranges/drop_while_view.h +++ b/libcxx/include/__ranges/drop_while_view.h @@ -65,9 +65,10 @@ _LIBCPP_HIDE_FROM_ABI constexpr const _Pred& pred() const { return *__pred_; } _LIBCPP_HIDE_FROM_ABI constexpr auto begin() { - _LIBCPP_ASSERT(__pred_.__has_value(), - "drop_while_view needs to have a non-empty predicate before calling begin() -- did a previous " - "assignment to this drop_while_view fail?"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __pred_.__has_value(), + "drop_while_view needs to have a non-empty predicate before calling begin() -- did a previous " + "assignment to this drop_while_view fail?"); if constexpr (_UseCache) { if (!__cached_begin_.__has_value()) { __cached_begin_.__emplace(ranges::find_if_not(__base_, std::cref(*__pred_))); diff --git a/libcxx/include/__ranges/filter_view.h b/libcxx/include/__ranges/filter_view.h --- a/libcxx/include/__ranges/filter_view.h +++ b/libcxx/include/__ranges/filter_view.h @@ -82,7 +82,9 @@ _LIBCPP_HIDE_FROM_ABI constexpr __iterator begin() { - _LIBCPP_ASSERT(__pred_.__has_value(), "Trying to call begin() on a filter_view that does not have a valid predicate."); + _LIBCPP_ASSERT_UNCATEGORIZED( + __pred_.__has_value(), + "Trying to call begin() on a filter_view that does not have a valid predicate."); if constexpr (_UseCache) { if (!__cached_begin_.__has_value()) { __cached_begin_.__emplace(ranges::find_if(__base_, std::ref(*__pred_))); diff --git a/libcxx/include/__ranges/iota_view.h b/libcxx/include/__ranges/iota_view.h --- a/libcxx/include/__ranges/iota_view.h +++ b/libcxx/include/__ranges/iota_view.h @@ -319,8 +319,8 @@ : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) { // Validate the precondition if possible. if constexpr (totally_ordered_with<_Start, _BoundSentinel>) { - _LIBCPP_ASSERT(ranges::less_equal()(__value_, __bound_sentinel_), - "Precondition violated: value is greater than bound."); + _LIBCPP_ASSERT_UNCATEGORIZED(ranges::less_equal()(__value_, __bound_sentinel_), + "Precondition violated: value is greater than bound."); } } diff --git a/libcxx/include/__ranges/lazy_split_view.h b/libcxx/include/__ranges/lazy_split_view.h --- a/libcxx/include/__ranges/lazy_split_view.h +++ b/libcxx/include/__ranges/lazy_split_view.h @@ -280,7 +280,7 @@ _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __outer_iterator& __x, default_sentinel_t) { - _LIBCPP_ASSERT(__x.__parent_, "Cannot call comparison on a default-constructed iterator."); + _LIBCPP_ASSERT_UNCATEGORIZED(__x.__parent_, "Cannot call comparison on a default-constructed iterator."); return __x.__current() == ranges::end(__x.__parent_base()) && !__x.__trailing_empty_; } }; @@ -311,7 +311,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __is_done() const { - _LIBCPP_ASSERT(__i_.__parent_, "Cannot call comparison on a default-constructed iterator."); + _LIBCPP_ASSERT_UNCATEGORIZED(__i_.__parent_, "Cannot call comparison on a default-constructed iterator."); auto [__pcur, __pend] = ranges::subrange{__i_.__parent_->__pattern_}; auto __end = ranges::end(__i_.__parent_->__base_); diff --git a/libcxx/include/__ranges/subrange.h b/libcxx/include/__ranges/subrange.h --- a/libcxx/include/__ranges/subrange.h +++ b/libcxx/include/__ranges/subrange.h @@ -105,7 +105,7 @@ : __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n) { if constexpr (sized_sentinel_for<_Sent, _Iter>) - _LIBCPP_ASSERT((__end_ - __begin_) == static_cast>(__n), + _LIBCPP_ASSERT_UNCATEGORIZED((__end_ - __begin_) == static_cast>(__n), "std::ranges::subrange was passed an invalid size hint"); } diff --git a/libcxx/include/__ranges/take_view.h b/libcxx/include/__ranges/take_view.h --- a/libcxx/include/__ranges/take_view.h +++ b/libcxx/include/__ranges/take_view.h @@ -70,7 +70,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_view(_View __base, range_difference_t<_View> __count) : __base_(std::move(__base)), __count_(__count) { - _LIBCPP_ASSERT(__count >= 0, "count has to be greater than or equal to zero"); + _LIBCPP_ASSERT_UNCATEGORIZED(__count >= 0, "count has to be greater than or equal to zero"); } _LIBCPP_HIDE_FROM_ABI diff --git a/libcxx/include/__ranges/view_interface.h b/libcxx/include/__ranges/view_interface.h --- a/libcxx/include/__ranges/view_interface.h +++ b/libcxx/include/__ranges/view_interface.h @@ -118,7 +118,7 @@ constexpr decltype(auto) front() requires forward_range<_D2> { - _LIBCPP_ASSERT(!empty(), + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view."); return *ranges::begin(__derived()); } @@ -128,7 +128,7 @@ constexpr decltype(auto) front() const requires forward_range { - _LIBCPP_ASSERT(!empty(), + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "Precondition `!empty()` not satisfied. `.front()` called on an empty view."); return *ranges::begin(__derived()); } @@ -138,7 +138,7 @@ constexpr decltype(auto) back() requires bidirectional_range<_D2> && common_range<_D2> { - _LIBCPP_ASSERT(!empty(), + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view."); return *ranges::prev(ranges::end(__derived())); } @@ -148,7 +148,7 @@ constexpr decltype(auto) back() const requires bidirectional_range && common_range { - _LIBCPP_ASSERT(!empty(), + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "Precondition `!empty()` not satisfied. `.back()` called on an empty view."); return *ranges::prev(ranges::end(__derived())); } diff --git a/libcxx/include/__stop_token/intrusive_list_view.h b/libcxx/include/__stop_token/intrusive_list_view.h --- a/libcxx/include/__stop_token/intrusive_list_view.h +++ b/libcxx/include/__stop_token/intrusive_list_view.h @@ -67,7 +67,7 @@ __node->__next_->__prev_ = __node->__prev_; } } else { - _LIBCPP_ASSERT(__node == __head_, "Node to be removed has no prev node, so it has to be the head"); + _LIBCPP_ASSERT_UNCATEGORIZED(__node == __head_, "Node to be removed has no prev node, so it has to be the head"); __pop_front(); } } diff --git a/libcxx/include/__stop_token/stop_state.h b/libcxx/include/__stop_token/stop_state.h --- a/libcxx/include/__stop_token/stop_state.h +++ b/libcxx/include/__stop_token/stop_state.h @@ -69,7 +69,7 @@ _LIBCPP_HIDE_FROM_ABI __stop_state() noexcept = default; _LIBCPP_HIDE_FROM_ABI void __increment_stop_source_counter() noexcept { - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __state_.load(std::memory_order_relaxed) <= static_cast<__state_t>(~(1 << __stop_source_counter_shift)), "stop_source's counter reaches the maximum. Incrementing the counter will overflow"); __state_.fetch_add(1 << __stop_source_counter_shift, std::memory_order_relaxed); @@ -78,8 +78,9 @@ // We are not destroying the object after counter decrements to zero, nor do we have // operations depend on the ordering of decrementing the counter. relaxed is enough. _LIBCPP_HIDE_FROM_ABI void __decrement_stop_source_counter() noexcept { - _LIBCPP_ASSERT(__state_.load(std::memory_order_relaxed) >= static_cast<__state_t>(1 << __stop_source_counter_shift), - "stop_source's counter is 0. Decrementing the counter will underflow"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __state_.load(std::memory_order_relaxed) >= static_cast<__state_t>(1 << __stop_source_counter_shift), + "stop_source's counter is 0. Decrementing the counter will underflow"); __state_.fetch_sub(1 << __stop_source_counter_shift, std::memory_order_relaxed); } diff --git a/libcxx/include/__string/char_traits.h b/libcxx/include/__string/char_traits.h --- a/libcxx/include/__string/char_traits.h +++ b/libcxx/include/__string/char_traits.h @@ -142,7 +142,7 @@ static _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) { if (!__libcpp_is_constant_evaluated()) { - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); } char_type* __r = __s1; for (; __n; --__n, ++__s1, ++__s2) @@ -255,7 +255,7 @@ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); std::copy_n(__s2, __n, __s1); return __s1; } @@ -326,7 +326,7 @@ static inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); std::copy_n(__s2, __n, __s1); return __s1; } @@ -390,7 +390,7 @@ static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); std::copy_n(__s2, __n, __s1); return __s1; } @@ -474,7 +474,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT { if (!__libcpp_is_constant_evaluated()) - _LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range"); std::copy_n(__s2, __n, __s1); return __s1; } diff --git a/libcxx/include/__thread/thread.h b/libcxx/include/__thread/thread.h --- a/libcxx/include/__thread/thread.h +++ b/libcxx/include/__thread/thread.h @@ -108,7 +108,7 @@ void __thread_specific_ptr<_Tp>::set_pointer(pointer __p) { - _LIBCPP_ASSERT(get() == nullptr, + _LIBCPP_ASSERT_UNCATEGORIZED(get() == nullptr, "Attempting to overwrite thread local data"); std::__libcpp_tls_set(__key_, __p); } diff --git a/libcxx/include/__tree b/libcxx/include/__tree --- a/libcxx/include/__tree +++ b/libcxx/include/__tree @@ -169,7 +169,7 @@ _NodePtr __tree_min(_NodePtr __x) _NOEXCEPT { - _LIBCPP_ASSERT(__x != nullptr, "Root node shouldn't be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x != nullptr, "Root node shouldn't be null"); while (__x->__left_ != nullptr) __x = __x->__left_; return __x; @@ -181,7 +181,7 @@ _NodePtr __tree_max(_NodePtr __x) _NOEXCEPT { - _LIBCPP_ASSERT(__x != nullptr, "Root node shouldn't be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x != nullptr, "Root node shouldn't be null"); while (__x->__right_ != nullptr) __x = __x->__right_; return __x; @@ -192,7 +192,7 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_next(_NodePtr __x) _NOEXCEPT { - _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x != nullptr, "node shouldn't be null"); if (__x->__right_ != nullptr) return _VSTD::__tree_min(__x->__right_); while (!_VSTD::__tree_is_left_child(__x)) @@ -205,7 +205,7 @@ _EndNodePtr __tree_next_iter(_NodePtr __x) _NOEXCEPT { - _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x != nullptr, "node shouldn't be null"); if (__x->__right_ != nullptr) return static_cast<_EndNodePtr>(_VSTD::__tree_min(__x->__right_)); while (!_VSTD::__tree_is_left_child(__x)) @@ -220,7 +220,7 @@ _NodePtr __tree_prev_iter(_EndNodePtr __x) _NOEXCEPT { - _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x != nullptr, "node shouldn't be null"); if (__x->__left_ != nullptr) return _VSTD::__tree_max(__x->__left_); _NodePtr __xx = static_cast<_NodePtr>(__x); @@ -234,7 +234,7 @@ _LIBCPP_HIDE_FROM_ABI _NodePtr __tree_leaf(_NodePtr __x) _NOEXCEPT { - _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x != nullptr, "node shouldn't be null"); while (true) { if (__x->__left_ != nullptr) @@ -258,8 +258,8 @@ _LIBCPP_HIDE_FROM_ABI void __tree_left_rotate(_NodePtr __x) _NOEXCEPT { - _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); - _LIBCPP_ASSERT(__x->__right_ != nullptr, "node should have a right child"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x != nullptr, "node shouldn't be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x->__right_ != nullptr, "node should have a right child"); _NodePtr __y = __x->__right_; __x->__right_ = __y->__left_; if (__x->__right_ != nullptr) @@ -279,8 +279,8 @@ _LIBCPP_HIDE_FROM_ABI void __tree_right_rotate(_NodePtr __x) _NOEXCEPT { - _LIBCPP_ASSERT(__x != nullptr, "node shouldn't be null"); - _LIBCPP_ASSERT(__x->__left_ != nullptr, "node should have a left child"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x != nullptr, "node shouldn't be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x->__left_ != nullptr, "node should have a left child"); _NodePtr __y = __x->__left_; __x->__left_ = __y->__right_; if (__x->__left_ != nullptr) @@ -305,8 +305,8 @@ _LIBCPP_HIDE_FROM_ABI void __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT { - _LIBCPP_ASSERT(__root != nullptr, "Root of the tree shouldn't be null"); - _LIBCPP_ASSERT(__x != nullptr, "Can't attach null node to a leaf"); + _LIBCPP_ASSERT_UNCATEGORIZED(__root != nullptr, "Root of the tree shouldn't be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__x != nullptr, "Can't attach null node to a leaf"); __x->__is_black_ = __x == __root; while (__x != __root && !__x->__parent_unsafe()->__is_black_) { @@ -375,8 +375,8 @@ _LIBCPP_HIDE_FROM_ABI void __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT { - _LIBCPP_ASSERT(__root != nullptr, "Root node should not be null"); - _LIBCPP_ASSERT(__z != nullptr, "The node to remove should not be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__root != nullptr, "Root node should not be null"); + _LIBCPP_ASSERT_UNCATEGORIZED(__z != nullptr, "The node to remove should not be null"); _LIBCPP_DEBUG_ASSERT(std::__tree_invariant(__root), "The tree invariants should hold"); // __z will be removed from the tree. Client still needs to destruct/deallocate it // __y is either __z, or if __z has two children, __tree_next(__z). diff --git a/libcxx/include/__utility/exception_guard.h b/libcxx/include/__utility/exception_guard.h --- a/libcxx/include/__utility/exception_guard.h +++ b/libcxx/include/__utility/exception_guard.h @@ -112,7 +112,7 @@ } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG ~__exception_guard_noexceptions() { - _LIBCPP_ASSERT(__completed_, "__exception_guard not completed with exceptions disabled"); + _LIBCPP_ASSERT_UNCATEGORIZED(__completed_, "__exception_guard not completed with exceptions disabled"); } private: diff --git a/libcxx/include/__utility/is_pointer_in_range.h b/libcxx/include/__utility/is_pointer_in_range.h --- a/libcxx/include/__utility/is_pointer_in_range.h +++ b/libcxx/include/__utility/is_pointer_in_range.h @@ -35,7 +35,7 @@ "__is_pointer_in_range should not be called with member pointers"); if (__libcpp_is_constant_evaluated()) { - _LIBCPP_ASSERT(__builtin_constant_p(__begin <= __end), "__begin and __end do not form a range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__builtin_constant_p(__begin <= __end), "__begin and __end do not form a range"); // If this is not a constant during constant evaluation we know that __ptr is not part of the allocation where // [__begin, __end) is. diff --git a/libcxx/include/__utility/unreachable.h b/libcxx/include/__utility/unreachable.h --- a/libcxx/include/__utility/unreachable.h +++ b/libcxx/include/__utility/unreachable.h @@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() { - _LIBCPP_ASSERT(false, "std::unreachable() was reached"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "std::unreachable() was reached"); __builtin_unreachable(); } diff --git a/libcxx/include/array b/libcxx/include/array --- a/libcxx/include/array +++ b/libcxx/include/array @@ -228,12 +228,12 @@ // element access: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type __n) _NOEXCEPT { - _LIBCPP_ASSERT(__n < _Size, "out-of-bounds access in std::array"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n < _Size, "out-of-bounds access in std::array"); return __elems_[__n]; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference operator[](size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n < _Size, "out-of-bounds access in std::array"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n < _Size, "out-of-bounds access in std::array"); return __elems_[__n]; } @@ -341,13 +341,13 @@ // element access: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](size_type) _NOEXCEPT { - _LIBCPP_ASSERT(false, "cannot call array::operator[] on a zero-sized array"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array::operator[] on a zero-sized array"); __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference operator[](size_type) const _NOEXCEPT { - _LIBCPP_ASSERT(false, "cannot call array::operator[] on a zero-sized array"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array::operator[] on a zero-sized array"); __libcpp_unreachable(); } @@ -365,25 +365,25 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reference front() _NOEXCEPT { - _LIBCPP_ASSERT(false, "cannot call array::front() on a zero-sized array"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array::front() on a zero-sized array"); __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference front() const _NOEXCEPT { - _LIBCPP_ASSERT(false, "cannot call array::front() on a zero-sized array"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array::front() on a zero-sized array"); __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reference back() _NOEXCEPT { - _LIBCPP_ASSERT(false, "cannot call array::back() on a zero-sized array"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array::back() on a zero-sized array"); __libcpp_unreachable(); } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const_reference back() const _NOEXCEPT { - _LIBCPP_ASSERT(false, "cannot call array::back() on a zero-sized array"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array::back() on a zero-sized array"); __libcpp_unreachable(); } }; diff --git a/libcxx/include/deque b/libcxx/include/deque --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -2600,7 +2600,7 @@ void deque<_Tp, _Allocator>::pop_back() { - _LIBCPP_ASSERT(!empty(), "deque::pop_back called on an empty deque"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "deque::pop_back called on an empty deque"); size_type __old_sz = size(); size_type __old_start = __start_; allocator_type& __a = __alloc(); diff --git a/libcxx/include/experimental/memory_resource b/libcxx/include/experimental/memory_resource --- a/libcxx/include/experimental/memory_resource +++ b/libcxx/include/experimental/memory_resource @@ -95,7 +95,7 @@ inline _LIBCPP_INLINE_VISIBILITY size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT { - _LIBCPP_ASSERT(__s + __a > __s, "aligned allocation size overflows"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s + __a > __s, "aligned allocation size overflows"); return (__s + __a - 1) & ~(__a - 1); } @@ -197,8 +197,8 @@ _LIBCPP_INLINE_VISIBILITY void deallocate(_ValueType * __p, size_t __n) _NOEXCEPT { - _LIBCPP_ASSERT(__n <= __max_size(), - "deallocate called for size which exceeds max_size()"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n <= __max_size(), + "deallocate called for size which exceeds max_size()"); __res_->deallocate(__p, __n * sizeof(_ValueType), _LIBCPP_ALIGNOF(_ValueType)); } @@ -397,7 +397,7 @@ _LIBCPP_HIDE_FROM_ABI_VIRTUAL void do_deallocate(void * __p, size_t __bytes, size_t) override { - _LIBCPP_ASSERT(__bytes <= __max_size(), + _LIBCPP_ASSERT_UNCATEGORIZED(__bytes <= __max_size(), "do_deallocate called for size which exceeds the maximum allocation size"); size_t __s = __aligned_allocation_size(__bytes, _MaxAlign) / _MaxAlign; __alloc_.deallocate((_ValueType*)__p, __s); diff --git a/libcxx/include/fstream b/libcxx/include/fstream --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -750,8 +750,8 @@ else { if (__extbufend_ != __extbufnext_) { - _LIBCPP_ASSERT(__extbufnext_ != nullptr, "underflow moving from nullptr"); - _LIBCPP_ASSERT(__extbuf_ != nullptr, "underflow moving into nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__extbufnext_ != nullptr, "underflow moving from nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__extbuf_ != nullptr, "underflow moving into nullptr"); _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); } __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); diff --git a/libcxx/include/future b/libcxx/include/future --- a/libcxx/include/future +++ b/libcxx/include/future @@ -1397,7 +1397,7 @@ void promise<_Rp>::set_exception(exception_ptr __p) { - _LIBCPP_ASSERT( __p != nullptr, "promise::set_exception: received nullptr" ); + _LIBCPP_ASSERT_UNCATEGORIZED( __p != nullptr, "promise::set_exception: received nullptr" ); if (__state_ == nullptr) __throw_future_error(future_errc::no_state); __state_->set_exception(__p); @@ -1425,7 +1425,7 @@ void promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p) { - _LIBCPP_ASSERT( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" ); + _LIBCPP_ASSERT_UNCATEGORIZED( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" ); if (__state_ == nullptr) __throw_future_error(future_errc::no_state); __state_->set_exception_at_thread_exit(__p); @@ -1531,7 +1531,7 @@ void promise<_Rp&>::set_exception(exception_ptr __p) { - _LIBCPP_ASSERT( __p != nullptr, "promise::set_exception: received nullptr" ); + _LIBCPP_ASSERT_UNCATEGORIZED( __p != nullptr, "promise::set_exception: received nullptr" ); if (__state_ == nullptr) __throw_future_error(future_errc::no_state); __state_->set_exception(__p); @@ -1550,7 +1550,7 @@ void promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p) { - _LIBCPP_ASSERT( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" ); + _LIBCPP_ASSERT_UNCATEGORIZED( __p != nullptr, "promise::set_exception_at_thread_exit: received nullptr" ); if (__state_ == nullptr) __throw_future_error(future_errc::no_state); __state_->set_exception_at_thread_exit(__p); diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -764,10 +764,10 @@ __is_nothrow_swappable::value) #endif { - _LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value || - this->__node_alloc() == __c.__node_alloc(), - "list::swap: Either propagate_on_container_swap must be true" - " or the allocators must compare equal"); + _LIBCPP_ASSERT_UNCATEGORIZED(__alloc_traits::propagate_on_container_swap::value || + this->__node_alloc() == __c.__node_alloc(), + "list::swap: Either propagate_on_container_swap must be true" + " or the allocators must compare equal"); using _VSTD::swap; _VSTD::__swap_allocator(__node_alloc(), __c.__node_alloc()); swap(__sz(), __c.__sz()); @@ -970,25 +970,25 @@ _LIBCPP_INLINE_VISIBILITY reference front() { - _LIBCPP_ASSERT(!empty(), "list::front called on empty list"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "list::front called on empty list"); return base::__end_.__next_->__as_node()->__value_; } _LIBCPP_INLINE_VISIBILITY const_reference front() const { - _LIBCPP_ASSERT(!empty(), "list::front called on empty list"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "list::front called on empty list"); return base::__end_.__next_->__as_node()->__value_; } _LIBCPP_INLINE_VISIBILITY reference back() { - _LIBCPP_ASSERT(!empty(), "list::back called on empty list"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "list::back called on empty list"); return base::__end_.__prev_->__as_node()->__value_; } _LIBCPP_INLINE_VISIBILITY const_reference back() const { - _LIBCPP_ASSERT(!empty(), "list::back called on empty list"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "list::back called on empty list"); return base::__end_.__prev_->__as_node()->__value_; } @@ -1656,7 +1656,7 @@ void list<_Tp, _Alloc>::pop_front() { - _LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "list::pop_front() called with empty list"); __node_allocator& __na = base::__node_alloc(); __link_pointer __n = base::__end_.__next_; base::__unlink_nodes(__n, __n); @@ -1685,7 +1685,7 @@ void list<_Tp, _Alloc>::pop_back() { - _LIBCPP_ASSERT(!empty(), "list::pop_back() called on an empty list"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "list::pop_back() called on an empty list"); __node_allocator& __na = base::__node_alloc(); __link_pointer __n = base::__end_.__prev_; base::__unlink_nodes(__n, __n); @@ -1716,7 +1716,7 @@ { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "list::erase(iterator) called with an iterator not referring to this list"); - _LIBCPP_ASSERT(__p != end(), + _LIBCPP_ASSERT_UNCATEGORIZED(__p != end(), "list::erase(iterator) called with a non-dereferenceable iterator"); __node_allocator& __na = base::__node_alloc(); __link_pointer __n = __p.__ptr_; @@ -1887,8 +1887,8 @@ void list<_Tp, _Alloc>::splice(const_iterator __p, list& __c) { - _LIBCPP_ASSERT(this != _VSTD::addressof(__c), - "list::splice(iterator, list) called with this == &list"); + _LIBCPP_ASSERT_UNCATEGORIZED(this != _VSTD::addressof(__c), + "list::splice(iterator, list) called with this == &list"); _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(_VSTD::addressof(__p)) == this, "list::splice(iterator, list) called with an iterator not referring to this list"); if (!__c.empty()) diff --git a/libcxx/include/locale b/libcxx/include/locale --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -4010,8 +4010,8 @@ else { if (__extbufend_ != __extbufnext_) { - _LIBCPP_ASSERT(__extbufnext_ != nullptr, "underflow moving from nullptr"); - _LIBCPP_ASSERT(__extbuf_ != nullptr, "underflow moving into nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__extbufnext_ != nullptr, "underflow moving from nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__extbuf_ != nullptr, "underflow moving into nullptr"); _VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); } __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); diff --git a/libcxx/include/map b/libcxx/include/map --- a/libcxx/include/map +++ b/libcxx/include/map @@ -1398,7 +1398,7 @@ _LIBCPP_INLINE_VISIBILITY insert_return_type insert(node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to map::insert()"); return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(_VSTD::move(__nh)); @@ -1406,7 +1406,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __hint, node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to map::insert()"); return __tree_.template __node_handle_insert_unique( __hint.__i_, _VSTD::move(__nh)); @@ -1425,32 +1425,32 @@ _LIBCPP_INLINE_VISIBILITY void merge(map& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } template _LIBCPP_INLINE_VISIBILITY void merge(map&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } template _LIBCPP_INLINE_VISIBILITY void merge(multimap& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } template _LIBCPP_INLINE_VISIBILITY void merge(multimap&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } #endif @@ -2086,7 +2086,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to multimap::insert()"); return __tree_.template __node_handle_insert_multi( _VSTD::move(__nh)); @@ -2094,7 +2094,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __hint, node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to multimap::insert()"); return __tree_.template __node_handle_insert_multi( __hint.__i_, _VSTD::move(__nh)); @@ -2114,32 +2114,32 @@ _LIBCPP_INLINE_VISIBILITY void merge(multimap& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __tree_.__node_handle_merge_multi(__source.__tree_); } template _LIBCPP_INLINE_VISIBILITY void merge(multimap&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __tree_.__node_handle_merge_multi(__source.__tree_); } template _LIBCPP_INLINE_VISIBILITY void merge(map& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __tree_.__node_handle_merge_multi(__source.__tree_); } template _LIBCPP_INLINE_VISIBILITY void merge(map&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __tree_.__node_handle_merge_multi(__source.__tree_); } #endif diff --git a/libcxx/include/optional b/libcxx/include/optional --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -409,7 +409,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_Args&&... __args) { - _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); + _LIBCPP_ASSERT_UNCATEGORIZED(!has_value(), "__construct called for engaged __optional_storage"); #if _LIBCPP_STD_VER >= 20 _VSTD::construct_at(_VSTD::addressof(this->__val_), _VSTD::forward<_Args>(__args)...); #else @@ -504,7 +504,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_UArg&& __val) { - _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); + _LIBCPP_ASSERT_UNCATEGORIZED(!has_value(), "__construct called for engaged __optional_storage"); static_assert(__can_bind_reference<_UArg>(), "Attempted to construct a reference element in tuple from a " "possible temporary"); @@ -993,7 +993,7 @@ add_pointer_t operator->() const { - _LIBCPP_ASSERT(this->has_value(), "optional operator-> called on a disengaged value"); + _LIBCPP_ASSERT_UNCATEGORIZED(this->has_value(), "optional operator-> called on a disengaged value"); return _VSTD::addressof(this->__get()); } @@ -1002,7 +1002,7 @@ add_pointer_t operator->() { - _LIBCPP_ASSERT(this->has_value(), "optional operator-> called on a disengaged value"); + _LIBCPP_ASSERT_UNCATEGORIZED(this->has_value(), "optional operator-> called on a disengaged value"); return _VSTD::addressof(this->__get()); } @@ -1011,7 +1011,7 @@ const value_type& operator*() const& noexcept { - _LIBCPP_ASSERT(this->has_value(), "optional operator* called on a disengaged value"); + _LIBCPP_ASSERT_UNCATEGORIZED(this->has_value(), "optional operator* called on a disengaged value"); return this->__get(); } @@ -1020,7 +1020,7 @@ value_type& operator*() & noexcept { - _LIBCPP_ASSERT(this->has_value(), "optional operator* called on a disengaged value"); + _LIBCPP_ASSERT_UNCATEGORIZED(this->has_value(), "optional operator* called on a disengaged value"); return this->__get(); } @@ -1029,7 +1029,7 @@ value_type&& operator*() && noexcept { - _LIBCPP_ASSERT(this->has_value(), "optional operator* called on a disengaged value"); + _LIBCPP_ASSERT_UNCATEGORIZED(this->has_value(), "optional operator* called on a disengaged value"); return _VSTD::move(this->__get()); } @@ -1038,7 +1038,7 @@ const value_type&& operator*() const&& noexcept { - _LIBCPP_ASSERT(this->has_value(), "optional operator* called on a disengaged value"); + _LIBCPP_ASSERT_UNCATEGORIZED(this->has_value(), "optional operator* called on a disengaged value"); return _VSTD::move(this->__get()); } diff --git a/libcxx/include/regex b/libcxx/include/regex --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -5533,38 +5533,38 @@ _LIBCPP_INLINE_VISIBILITY difference_type length(size_type __sub = 0) const { - _LIBCPP_ASSERT(ready(), "match_results::length() called when not ready"); + _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::length() called when not ready"); return (*this)[__sub].length(); } _LIBCPP_INLINE_VISIBILITY difference_type position(size_type __sub = 0) const { - _LIBCPP_ASSERT(ready(), "match_results::position() called when not ready"); + _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::position() called when not ready"); return _VSTD::distance(__position_start_, (*this)[__sub].first); } _LIBCPP_INLINE_VISIBILITY string_type str(size_type __sub = 0) const { - _LIBCPP_ASSERT(ready(), "match_results::str() called when not ready"); + _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::str() called when not ready"); return (*this)[__sub].str(); } _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { - _LIBCPP_ASSERT(ready(), "match_results::operator[]() called when not ready"); + _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::operator[]() called when not ready"); return __n < __matches_.size() ? __matches_[__n] : __unmatched_; } _LIBCPP_INLINE_VISIBILITY const_reference prefix() const { - _LIBCPP_ASSERT(ready(), "match_results::prefix() called when not ready"); + _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::prefix() called when not ready"); return __prefix_; } _LIBCPP_INLINE_VISIBILITY const_reference suffix() const { - _LIBCPP_ASSERT(ready(), "match_results::suffix() called when not ready"); + _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::suffix() called when not ready"); return __suffix_; } @@ -5704,7 +5704,7 @@ const char_type* __fmt_first, const char_type* __fmt_last, regex_constants::match_flag_type __flags) const { - _LIBCPP_ASSERT(ready(), "match_results::format() called when not ready"); + _LIBCPP_ASSERT_UNCATEGORIZED(ready(), "match_results::format() called when not ready"); if (__flags & regex_constants::format_sed) { for (; __fmt_first != __fmt_last; ++__fmt_first) diff --git a/libcxx/include/set b/libcxx/include/set --- a/libcxx/include/set +++ b/libcxx/include/set @@ -781,7 +781,7 @@ _LIBCPP_INLINE_VISIBILITY insert_return_type insert(node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to set::insert()"); return __tree_.template __node_handle_insert_unique< node_type, insert_return_type>(_VSTD::move(__nh)); @@ -789,7 +789,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __hint, node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to set::insert()"); return __tree_.template __node_handle_insert_unique( __hint, _VSTD::move(__nh)); @@ -808,7 +808,7 @@ _LIBCPP_INLINE_VISIBILITY void merge(set& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } @@ -816,7 +816,7 @@ _LIBCPP_INLINE_VISIBILITY void merge(set&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } @@ -824,7 +824,7 @@ _LIBCPP_INLINE_VISIBILITY void merge(multiset& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } @@ -832,7 +832,7 @@ _LIBCPP_INLINE_VISIBILITY void merge(multiset&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_unique(__source.__tree_); } @@ -1329,7 +1329,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to multiset::insert()"); return __tree_.template __node_handle_insert_multi( _VSTD::move(__nh)); @@ -1337,7 +1337,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __hint, node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to multiset::insert()"); return __tree_.template __node_handle_insert_multi( __hint, _VSTD::move(__nh)); @@ -1356,7 +1356,7 @@ _LIBCPP_INLINE_VISIBILITY void merge(multiset& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } @@ -1364,7 +1364,7 @@ _LIBCPP_INLINE_VISIBILITY void merge(multiset&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } @@ -1372,7 +1372,7 @@ _LIBCPP_INLINE_VISIBILITY void merge(set& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } @@ -1380,7 +1380,7 @@ _LIBCPP_INLINE_VISIBILITY void merge(set&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), "merging container with incompatible allocator"); __tree_.__node_handle_merge_multi(__source.__tree_); } diff --git a/libcxx/include/span b/libcxx/include/span --- a/libcxx/include/span +++ b/libcxx/include/span @@ -235,7 +235,7 @@ constexpr explicit span(_It __first, size_type __count) : __data_{_VSTD::to_address(__first)} { (void)__count; - _LIBCPP_ASSERT(_Extent == __count, "size mismatch in span's constructor (iterator, len)"); + _LIBCPP_ASSERT_UNCATEGORIZED(_Extent == __count, "size mismatch in span's constructor (iterator, len)"); } template <__span_compatible_iterator _It, __span_compatible_sentinel_for<_It> _End> @@ -244,8 +244,8 @@ // [span.cons]/10 // Throws: When and what last - first throws. [[maybe_unused]] auto __dist = __last - __first; - _LIBCPP_ASSERT(__dist >= 0, "invalid range in span's constructor (iterator, sentinel)"); - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED(__dist >= 0, "invalid range in span's constructor (iterator, sentinel)"); + _LIBCPP_ASSERT_UNCATEGORIZED( __dist == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != extent"); } @@ -263,7 +263,7 @@ template <__span_compatible_range _Range> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(_Range&& __r) : __data_{ranges::data(__r)} { - _LIBCPP_ASSERT(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)"); + _LIBCPP_ASSERT_UNCATEGORIZED(ranges::size(__r) == _Extent, "size mismatch in span's constructor (range)"); } template <__span_array_convertible _OtherElementType> @@ -274,7 +274,9 @@ template <__span_array_convertible _OtherElementType> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(const span<_OtherElementType, dynamic_extent>& __other) noexcept - : __data_{__other.data()} { _LIBCPP_ASSERT(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); } + : __data_{__other.data()} { + _LIBCPP_ASSERT_UNCATEGORIZED(_Extent == __other.size(), "size mismatch in span's constructor (other span)"); + } // ~span() noexcept = default; @@ -298,14 +300,14 @@ _LIBCPP_INLINE_VISIBILITY constexpr span first(size_type __count) const noexcept { - _LIBCPP_ASSERT(__count <= size(), "span::first(count): count out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size(), "span::first(count): count out of range"); return {data(), __count}; } _LIBCPP_INLINE_VISIBILITY constexpr span last(size_type __count) const noexcept { - _LIBCPP_ASSERT(__count <= size(), "span::last(count): count out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size(), "span::last(count): count out of range"); return {data() + size() - __count, __count}; } @@ -326,10 +328,11 @@ constexpr span subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept { - _LIBCPP_ASSERT(__offset <= size(), "span::subspan(offset, count): offset out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__offset <= size(), "span::subspan(offset, count): offset out of range"); if (__count == dynamic_extent) return {data() + __offset, size() - __offset}; - _LIBCPP_ASSERT(__count <= size() - __offset, "span::subspan(offset, count): offset + count out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size() - __offset, + "span::subspan(offset, count): offset + count out of range"); return {data() + __offset, __count}; } @@ -339,19 +342,19 @@ _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept { - _LIBCPP_ASSERT(__idx < size(), "span::operator[](index): index out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__idx < size(), "span::operator[](index): index out of range"); return __data_[__idx]; } _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept { - _LIBCPP_ASSERT(!empty(), "span::front() on empty span"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "span::front() on empty span"); return __data_[0]; } _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept { - _LIBCPP_ASSERT(!empty(), "span::back() on empty span"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "span::back() on empty span"); return __data_[size()-1]; } @@ -421,7 +424,7 @@ template <__span_compatible_iterator _It, __span_compatible_sentinel_for<_It> _End> _LIBCPP_INLINE_VISIBILITY constexpr span(_It __first, _End __last) : __data_(_VSTD::to_address(__first)), __size_(__last - __first) { - _LIBCPP_ASSERT(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)"); + _LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >= 0, "invalid range in span's constructor (iterator, sentinel)"); } template @@ -452,7 +455,7 @@ _LIBCPP_INLINE_VISIBILITY constexpr span first() const noexcept { - _LIBCPP_ASSERT(_Count <= size(), "span::first(): Count out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(_Count <= size(), "span::first(): Count out of range"); return span{data(), _Count}; } @@ -460,21 +463,21 @@ _LIBCPP_INLINE_VISIBILITY constexpr span last() const noexcept { - _LIBCPP_ASSERT(_Count <= size(), "span::last(): Count out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(_Count <= size(), "span::last(): Count out of range"); return span{data() + size() - _Count, _Count}; } _LIBCPP_INLINE_VISIBILITY constexpr span first(size_type __count) const noexcept { - _LIBCPP_ASSERT(__count <= size(), "span::first(count): count out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size(), "span::first(count): count out of range"); return {data(), __count}; } _LIBCPP_INLINE_VISIBILITY constexpr span last (size_type __count) const noexcept { - _LIBCPP_ASSERT(__count <= size(), "span::last(count): count out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size(), "span::last(count): count out of range"); return {data() + size() - __count, __count}; } @@ -482,8 +485,9 @@ _LIBCPP_INLINE_VISIBILITY constexpr span subspan() const noexcept { - _LIBCPP_ASSERT(_Offset <= size(), "span::subspan(): Offset out of range"); - _LIBCPP_ASSERT(_Count == dynamic_extent || _Count <= size() - _Offset, "span::subspan(): Offset + Count out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(_Offset <= size(), "span::subspan(): Offset out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(_Count == dynamic_extent || _Count <= size() - _Offset, + "span::subspan(): Offset + Count out of range"); return span{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count}; } @@ -491,10 +495,11 @@ _LIBCPP_INLINE_VISIBILITY subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept { - _LIBCPP_ASSERT(__offset <= size(), "span::subspan(offset, count): offset out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__offset <= size(), "span::subspan(offset, count): offset out of range"); if (__count == dynamic_extent) return {data() + __offset, size() - __offset}; - _LIBCPP_ASSERT(__count <= size() - __offset, "span::subspan(offset, count): offset + count out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size() - __offset, + "span::subspan(offset, count): offset + count out of range"); return {data() + __offset, __count}; } @@ -504,19 +509,19 @@ _LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept { - _LIBCPP_ASSERT(__idx < size(), "span::operator[](index): index out of range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__idx < size(), "span::operator[](index): index out of range"); return __data_[__idx]; } _LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept { - _LIBCPP_ASSERT(!empty(), "span::front() on empty span"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "span::front() on empty span"); return __data_[0]; } _LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept { - _LIBCPP_ASSERT(!empty(), "span::back() on empty span"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "span::back() on empty span"); return __data_[size()-1]; } diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -911,7 +911,7 @@ template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) { - _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "basic_string(const char*) detected nullptr"); __init(__s, traits_type::length(__s)); std::__debug_db_insert_c(this); } @@ -919,7 +919,7 @@ template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, const _Allocator& __a) : __r_(__default_init_tag(), __a) { - _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); __init(__s, traits_type::length(__s)); std::__debug_db_insert_c(this); } @@ -930,7 +930,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n) : __r_(__default_init_tag(), __default_init_tag()) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr"); __init(__s, __n); std::__debug_db_insert_c(this); } @@ -938,7 +938,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, size_type __n, const _Allocator& __a) : __r_(__default_init_tag(), __a) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, + "basic_string(const char*, n, allocator) detected nullptr"); __init(__s, __n); std::__debug_db_insert_c(this); } @@ -1187,12 +1188,12 @@ bool empty() const _NOEXCEPT {return size() == 0;} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference operator[](size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); + _LIBCPP_ASSERT_UNCATEGORIZED(__pos <= size(), "string index out of bounds"); return *(data() + __pos); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference operator[](size_type __pos) _NOEXCEPT { - _LIBCPP_ASSERT(__pos <= size(), "string index out of bounds"); + _LIBCPP_ASSERT_UNCATEGORIZED(__pos <= size(), "string index out of bounds"); return *(__get_pointer() + __pos); } @@ -1279,22 +1280,22 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back(); _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference front() _NOEXCEPT { - _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "string::front(): string is empty"); return *__get_pointer(); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference front() const _NOEXCEPT { - _LIBCPP_ASSERT(!empty(), "string::front(): string is empty"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "string::front(): string is empty"); return *data(); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference back() _NOEXCEPT { - _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "string::back(): string is empty"); return *(__get_pointer() + size() - 1); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const _NOEXCEPT { - _LIBCPP_ASSERT(!empty(), "string::back(): string is empty"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "string::back(): string is empty"); return *(data() + size() - 1); } @@ -1742,14 +1743,16 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __set_short_size(size_type __s) _NOEXCEPT { - _LIBCPP_ASSERT(__s < __min_cap, "__s should never be greater than or equal to the short string capacity"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s < __min_cap, + "__s should never be greater than or equal to the short string capacity"); __r_.first().__s.__size_ = __s; __r_.first().__s.__is_long_ = false; } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type __get_short_size() const _NOEXCEPT { - _LIBCPP_ASSERT(!__r_.first().__s.__is_long_, "String has to be short when trying to get the short size"); + _LIBCPP_ASSERT_UNCATEGORIZED(!__r_.first().__s.__is_long_, + "String has to be short when trying to get the short size"); return __r_.first().__s.__size_; } @@ -2352,7 +2355,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s, size_type __n) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::assign received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string::assign received nullptr"); return (__builtin_constant_p(__n) && __fits_in_sso(__n)) ? __assign_short(__s, __n) : __assign_external(__s, __n); @@ -2541,7 +2544,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::assign received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::assign received nullptr"); return __builtin_constant_p(*__s) ? (__fits_in_sso(traits_type::length(__s)) ? __assign_short(__s, traits_type::length(__s)) @@ -2555,7 +2558,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s, size_type __n) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::append received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string::append received nullptr"); size_type __cap = capacity(); size_type __sz = size(); if (__cap - __sz >= __n) @@ -2710,7 +2713,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append(const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::append received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::append received nullptr"); return append(__s, traits_type::length(__s)); } @@ -2721,7 +2724,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s, size_type __n) { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::insert received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string::insert received nullptr"); size_type __sz = size(); if (__pos > __sz) __throw_out_of_range(); @@ -2855,7 +2858,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos, const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::insert received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::insert received nullptr"); return insert(__pos, __s, traits_type::length(__s)); } @@ -2898,7 +2901,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { - _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n2 == 0 || __s != nullptr, "string::replace received nullptr"); size_type __sz = size(); if (__pos > __sz) __throw_out_of_range(); @@ -3014,7 +3017,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s) { - _LIBCPP_ASSERT(__s != nullptr, "string::replace received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::replace received nullptr"); return replace(__pos, __n1, __s, traits_type::length(__s)); } @@ -3064,7 +3067,7 @@ "string::erase(iterator) called with an iterator not" " referring to this string"); - _LIBCPP_ASSERT(__pos != end(), "string::erase(iterator) called with a non-dereferenceable iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__pos != end(), "string::erase(iterator) called with a non-dereferenceable iterator"); iterator __b = begin(); size_type __r = static_cast(__pos - __b); erase(__r, 1); @@ -3080,7 +3083,7 @@ "string::erase(iterator, iterator) called with an iterator not" " referring to this string"); - _LIBCPP_ASSERT(__first <= __last, "string::erase(first, last) called with invalid range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "string::erase(first, last) called with invalid range"); iterator __b = begin(); size_type __r = static_cast(__first - __b); erase(__r, static_cast(__last - __first)); @@ -3092,7 +3095,7 @@ void basic_string<_CharT, _Traits, _Allocator>::pop_back() { - _LIBCPP_ASSERT(!empty(), "string::pop_back(): string is already empty"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "string::pop_back(): string is already empty"); __erase_to_end(size() - 1); } @@ -3283,7 +3286,7 @@ std::__debug_db_invalidate_all(&__str); std::__debug_db_swap(this, &__str); - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value || __alloc() == __str.__alloc(), "swapping non-equal allocators"); @@ -3309,7 +3312,7 @@ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string::find(): received nullptr"); return std::__str_find (data(), size(), __s, __pos, __n); } @@ -3341,7 +3344,7 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::find(): received nullptr"); return std::__str_find (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3365,7 +3368,7 @@ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::rfind(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string::rfind(): received nullptr"); return std::__str_rfind (data(), size(), __s, __pos, __n); } @@ -3397,7 +3400,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::rfind(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::rfind(): received nullptr"); return std::__str_rfind (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3421,7 +3424,7 @@ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string::find_first_of(): received nullptr"); return std::__str_find_first_of (data(), size(), __s, __pos, __n); } @@ -3453,7 +3456,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_first_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::find_first_of(): received nullptr"); return std::__str_find_first_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3476,7 +3479,7 @@ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string::find_last_of(): received nullptr"); return std::__str_find_last_of (data(), size(), __s, __pos, __n); } @@ -3508,7 +3511,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_last_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::find_last_of(): received nullptr"); return std::__str_find_last_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3531,7 +3534,7 @@ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string::find_first_not_of(): received nullptr"); return std::__str_find_first_not_of (data(), size(), __s, __pos, __n); } @@ -3563,7 +3566,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_first_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::find_first_not_of(): received nullptr"); return std::__str_find_first_not_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3587,7 +3590,7 @@ size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string::find_last_not_of(): received nullptr"); return std::__str_find_last_not_of (data(), size(), __s, __pos, __n); } @@ -3619,7 +3622,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __s, size_type __pos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::find_last_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::find_last_not_of(): received nullptr"); return std::__str_find_last_not_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -3671,7 +3674,7 @@ const value_type* __s, size_type __n2) const { - _LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n2 == 0 || __s != nullptr, "string::compare(): received nullptr"); size_type __sz = size(); if (__pos1 > __sz || __n2 == npos) __throw_out_of_range(); @@ -3736,7 +3739,7 @@ int basic_string<_CharT, _Traits, _Allocator>::compare(const value_type* __s) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::compare(): received nullptr"); return compare(0, npos, __s, traits_type::length(__s)); } @@ -3747,7 +3750,7 @@ size_type __n1, const value_type* __s) const { - _LIBCPP_ASSERT(__s != nullptr, "string::compare(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string::compare(): received nullptr"); return compare(__pos1, __n1, __s, traits_type::length(__s)); } @@ -3829,7 +3832,7 @@ const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT { typedef basic_string<_CharT, _Traits, _Allocator> _String; - _LIBCPP_ASSERT(__lhs != nullptr, "operator==(char*, basic_string): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__lhs != nullptr, "operator==(char*, basic_string): received nullptr"); size_t __lhs_len = _Traits::length(__lhs); if (__lhs_len != __rhs.size()) return false; return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0; @@ -3846,7 +3849,7 @@ return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); #else typedef basic_string<_CharT, _Traits, _Allocator> _String; - _LIBCPP_ASSERT(__rhs != nullptr, "operator==(basic_string, char*): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__rhs != nullptr, "operator==(basic_string, char*): received nullptr"); size_t __rhs_len = _Traits::length(__rhs); if (__rhs_len != __lhs.size()) return false; return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0; diff --git a/libcxx/include/string_view b/libcxx/include/string_view --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -261,7 +261,9 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT { // This needs to be a single statement for C++11 constexpr - return _LIBCPP_ASSERT(__s != nullptr, "null pointer passed to non-null argument of char_traits<...>::length"), _Traits::length(__s); + return _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, + "null pointer passed to non-null argument of char_traits<...>::length"), + _Traits::length(__s); } template @@ -307,8 +309,11 @@ : __data_(__s), __size_(__len) { #if _LIBCPP_STD_VER >= 14 - _LIBCPP_ASSERT(__len <= static_cast(numeric_limits::max()), "string_view::string_view(_CharT *, size_t): length does not fit in difference_type"); - _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __len <= static_cast(numeric_limits::max()), + "string_view::string_view(_CharT *, size_t): length does not fit in difference_type"); + _LIBCPP_ASSERT_UNCATEGORIZED(__len == 0 || __s != nullptr, + "string_view::string_view(_CharT *, size_t): received nullptr"); #endif } @@ -318,7 +323,8 @@ constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end) : __data_(_VSTD::to_address(__begin)), __size_(__end - __begin) { - _LIBCPP_ASSERT((__end - __begin) >= 0, "std::string_view::string_view(iterator, sentinel) received invalid range"); + _LIBCPP_ASSERT_UNCATEGORIZED((__end - __begin) >= 0, + "std::string_view::string_view(iterator, sentinel) received invalid range"); } #endif // _LIBCPP_STD_VER >= 20 @@ -399,7 +405,7 @@ // [string.view.access], element access _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __pos) const _NOEXCEPT { - return _LIBCPP_ASSERT(__pos < size(), "string_view[] index out of bounds"), __data_[__pos]; + return _LIBCPP_ASSERT_UNCATEGORIZED(__pos < size(), "string_view[] index out of bounds"), __data_[__pos]; } _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY @@ -413,13 +419,13 @@ _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_reference front() const _NOEXCEPT { - return _LIBCPP_ASSERT(!empty(), "string_view::front(): string is empty"), __data_[0]; + return _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "string_view::front(): string is empty"), __data_[0]; } _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_reference back() const _NOEXCEPT { - return _LIBCPP_ASSERT(!empty(), "string_view::back(): string is empty"), __data_[__size_-1]; + return _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "string_view::back(): string is empty"), __data_[__size_-1]; } _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY @@ -429,7 +435,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY void remove_prefix(size_type __n) _NOEXCEPT { - _LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n <= size(), "remove_prefix() can't remove more than size()"); __data_ += __n; __size_ -= __n; } @@ -437,7 +443,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY void remove_suffix(size_type __n) _NOEXCEPT { - _LIBCPP_ASSERT(__n <= size(), "remove_suffix() can't remove more than size()"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n <= size(), "remove_suffix() can't remove more than size()"); __size_ -= __n; } @@ -515,7 +521,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr"); return std::__str_find (data(), size(), __s.data(), __pos, __s.size()); } @@ -530,7 +536,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string_view::find(): received nullptr"); return std::__str_find (data(), size(), __s, __pos, __n); } @@ -538,7 +544,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find(const _CharT* __s, size_type __pos = 0) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string_view::find(): received nullptr"); return std::__str_find (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -547,7 +553,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type rfind(basic_string_view __s, size_type __pos = npos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s.size() == 0 || __s.data() != nullptr, "string_view::find(): received nullptr"); return std::__str_rfind (data(), size(), __s.data(), __pos, __s.size()); } @@ -562,7 +568,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type rfind(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string_view::rfind(): received nullptr"); return std::__str_rfind (data(), size(), __s, __pos, __n); } @@ -570,7 +576,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type rfind(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string_view::rfind(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string_view::rfind(): received nullptr"); return std::__str_rfind (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -579,7 +585,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_first_of(basic_string_view __s, size_type __pos = 0) const _NOEXCEPT { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s.size() == 0 || __s.data() != nullptr, + "string_view::find_first_of(): received nullptr"); return std::__str_find_first_of (data(), size(), __s.data(), __pos, __s.size()); } @@ -591,7 +598,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_first_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string_view::find_first_of(): received nullptr"); return std::__str_find_first_of (data(), size(), __s, __pos, __n); } @@ -599,7 +606,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_first_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string_view::find_first_of(): received nullptr"); return std::__str_find_first_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -608,7 +615,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_last_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s.size() == 0 || __s.data() != nullptr, + "string_view::find_last_of(): received nullptr"); return std::__str_find_last_of (data(), size(), __s.data(), __pos, __s.size()); } @@ -620,7 +628,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_last_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string_view::find_last_of(): received nullptr"); return std::__str_find_last_of (data(), size(), __s, __pos, __n); } @@ -628,7 +636,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_last_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string_view::find_last_of(): received nullptr"); return std::__str_find_last_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -637,7 +645,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(basic_string_view __s, size_type __pos=0) const _NOEXCEPT { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_first_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s.size() == 0 || __s.data() != nullptr, + "string_view::find_first_not_of(): received nullptr"); return std::__str_find_first_not_of (data(), size(), __s.data(), __pos, __s.size()); } @@ -652,7 +661,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string_view::find_first_not_of(): received nullptr"); return std::__str_find_first_not_of (data(), size(), __s, __pos, __n); } @@ -660,7 +669,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_first_not_of(const _CharT* __s, size_type __pos=0) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find_first_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string_view::find_first_not_of(): received nullptr"); return std::__str_find_first_not_of (data(), size(), __s, __pos, traits_type::length(__s)); } @@ -669,7 +678,8 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(basic_string_view __s, size_type __pos=npos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s.size() == 0 || __s.data() != nullptr, "string_view::find_last_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s.size() == 0 || __s.data() != nullptr, + "string_view::find_last_not_of(): received nullptr"); return std::__str_find_last_not_of (data(), size(), __s.data(), __pos, __s.size()); } @@ -684,7 +694,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n == 0 || __s != nullptr, "string_view::find_last_not_of(): received nullptr"); return std::__str_find_last_not_of (data(), size(), __s, __pos, __n); } @@ -692,7 +702,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY size_type find_last_not_of(const _CharT* __s, size_type __pos=npos) const _NOEXCEPT { - _LIBCPP_ASSERT(__s != nullptr, "string_view::find_last_not_of(): received nullptr"); + _LIBCPP_ASSERT_UNCATEGORIZED(__s != nullptr, "string_view::find_last_not_of(): received nullptr"); return std::__str_find_last_not_of (data(), size(), __s, __pos, traits_type::length(__s)); } diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -1374,7 +1374,7 @@ _LIBCPP_INLINE_VISIBILITY insert_return_type insert(node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to unordered_map::insert()"); return __table_.template __node_handle_insert_unique< node_type, insert_return_type>(_VSTD::move(__nh)); @@ -1382,7 +1382,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __hint, node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to unordered_map::insert()"); return __table_.template __node_handle_insert_unique( __hint.__i_, _VSTD::move(__nh)); @@ -1403,32 +1403,32 @@ _LIBCPP_INLINE_VISIBILITY void merge(unordered_map& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_unique(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_map&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_unique(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_multimap& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_unique(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_multimap&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_unique(__source.__table_); } #endif @@ -2165,7 +2165,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to unordered_multimap::insert()"); return __table_.template __node_handle_insert_multi( _VSTD::move(__nh)); @@ -2173,7 +2173,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __hint, node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to unordered_multimap::insert()"); return __table_.template __node_handle_insert_multi( __hint.__i_, _VSTD::move(__nh)); @@ -2194,32 +2194,32 @@ _LIBCPP_INLINE_VISIBILITY void merge(unordered_multimap& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_multi(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_multimap&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_multi(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_map& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_multi(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_map&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_multi(__source.__table_); } #endif diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -716,7 +716,7 @@ _LIBCPP_INLINE_VISIBILITY insert_return_type insert(node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to unordered_set::insert()"); return __table_.template __node_handle_insert_unique< node_type, insert_return_type>(_VSTD::move(__nh)); @@ -724,7 +724,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __h, node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to unordered_set::insert()"); return __table_.template __node_handle_insert_unique( __h, _VSTD::move(__nh)); @@ -744,32 +744,32 @@ _LIBCPP_INLINE_VISIBILITY void merge(unordered_set& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); __table_.__node_handle_merge_unique(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_set&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); __table_.__node_handle_merge_unique(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_multiset& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); __table_.__node_handle_merge_unique(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_multiset&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); __table_.__node_handle_merge_unique(__source.__table_); } #endif @@ -1347,7 +1347,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to unordered_multiset::insert()"); return __table_.template __node_handle_insert_multi( _VSTD::move(__nh)); @@ -1355,7 +1355,7 @@ _LIBCPP_INLINE_VISIBILITY iterator insert(const_iterator __hint, node_type&& __nh) { - _LIBCPP_ASSERT(__nh.empty() || __nh.get_allocator() == get_allocator(), + _LIBCPP_ASSERT_UNCATEGORIZED(__nh.empty() || __nh.get_allocator() == get_allocator(), "node_type with incompatible allocator passed to unordered_multiset::insert()"); return __table_.template __node_handle_insert_multi( __hint, _VSTD::move(__nh)); @@ -1376,32 +1376,32 @@ _LIBCPP_INLINE_VISIBILITY void merge(unordered_multiset& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_multi(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_multiset&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_multi(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_set& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_multi(__source.__table_); } template _LIBCPP_INLINE_VISIBILITY void merge(unordered_set&& __source) { - _LIBCPP_ASSERT(__source.get_allocator() == get_allocator(), - "merging container with incompatible allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__source.get_allocator() == get_allocator(), + "merging container with incompatible allocator"); return __table_.__node_handle_merge_multi(__source.__table_); } #endif diff --git a/libcxx/include/vector b/libcxx/include/vector --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -625,22 +625,22 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() _NOEXCEPT { - _LIBCPP_ASSERT(!empty(), "front() called on an empty vector"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "front() called on an empty vector"); return *this->__begin_; } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const _NOEXCEPT { - _LIBCPP_ASSERT(!empty(), "front() called on an empty vector"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "front() called on an empty vector"); return *this->__begin_; } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() _NOEXCEPT { - _LIBCPP_ASSERT(!empty(), "back() called on an empty vector"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "back() called on an empty vector"); return *(this->__end_ - 1); } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const _NOEXCEPT { - _LIBCPP_ASSERT(!empty(), "back() called on an empty vector"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "back() called on an empty vector"); return *(this->__end_ - 1); } @@ -1567,7 +1567,7 @@ typename vector<_Tp, _Allocator>::reference vector<_Tp, _Allocator>::operator[](size_type __n) _NOEXCEPT { - _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n < size(), "vector[] index out of bounds"); return this->__begin_[__n]; } @@ -1577,7 +1577,7 @@ typename vector<_Tp, _Allocator>::const_reference vector<_Tp, _Allocator>::operator[](size_type __n) const _NOEXCEPT { - _LIBCPP_ASSERT(__n < size(), "vector[] index out of bounds"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n < size(), "vector[] index out of bounds"); return this->__begin_[__n]; } @@ -1723,7 +1723,7 @@ void vector<_Tp, _Allocator>::pop_back() { - _LIBCPP_ASSERT(!empty(), "vector::pop_back called on an empty vector"); + _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "vector::pop_back called on an empty vector"); this->__destruct_at_end(this->__end_ - 1); } @@ -1735,7 +1735,7 @@ { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__position)) == this, "vector::erase(iterator) called with an iterator not referring to this vector"); - _LIBCPP_ASSERT(__position != end(), + _LIBCPP_ASSERT_UNCATEGORIZED(__position != end(), "vector::erase(iterator) called with a non-dereferenceable iterator"); difference_type __ps = __position - cbegin(); pointer __p = this->__begin_ + __ps; @@ -1755,7 +1755,7 @@ _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(std::addressof(__last)) == this, "vector::erase(iterator, iterator) called with an iterator not referring to this vector"); - _LIBCPP_ASSERT(__first <= __last, "vector::erase(first, last) called with invalid range"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first <= __last, "vector::erase(first, last) called with invalid range"); pointer __p = this->__begin_ + (__first - begin()); if (__first != __last) { this->__destruct_at_end(std::move(__p + (__last - __first), this->__end_, __p)); @@ -2064,10 +2064,10 @@ __is_nothrow_swappable::value) #endif { - _LIBCPP_ASSERT(__alloc_traits::propagate_on_container_swap::value || - this->__alloc() == __x.__alloc(), - "vector::swap: Either propagate_on_container_swap must be true" - " or the allocators must compare equal"); + _LIBCPP_ASSERT_UNCATEGORIZED(__alloc_traits::propagate_on_container_swap::value || + this->__alloc() == __x.__alloc(), + "vector::swap: Either propagate_on_container_swap must be true" + " or the allocators must compare equal"); std::swap(this->__begin_, __x.__begin_); std::swap(this->__end_, __x.__end_); std::swap(this->__end_cap(), __x.__end_cap()); @@ -3077,7 +3077,7 @@ template _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void vector::__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __ns) { - _LIBCPP_ASSERT(__ns >= 0, "invalid range specified"); + _LIBCPP_ASSERT_UNCATEGORIZED(__ns >= 0, "invalid range specified"); clear(); @@ -3277,7 +3277,7 @@ typename vector::iterator vector::__insert_with_size(const_iterator __position, _ForwardIterator __first, _Sentinel __last, difference_type __n_signed) { - _LIBCPP_ASSERT(__n_signed >= 0, "invalid range specified"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n_signed >= 0, "invalid range specified"); const size_type __n = static_cast(__n_signed); iterator __r; size_type __c = capacity(); diff --git a/libcxx/src/filesystem/directory_iterator.cpp b/libcxx/src/filesystem/directory_iterator.cpp --- a/libcxx/src/filesystem/directory_iterator.cpp +++ b/libcxx/src/filesystem/directory_iterator.cpp @@ -192,7 +192,7 @@ } directory_iterator& directory_iterator::__increment(error_code* ec) { - _LIBCPP_ASSERT(__imp_, "Attempting to increment an invalid iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__imp_, "Attempting to increment an invalid iterator"); ErrorHandler err("directory_iterator::operator++()", ec); error_code m_ec; @@ -206,7 +206,7 @@ } directory_entry const& directory_iterator::__dereference() const { - _LIBCPP_ASSERT(__imp_, "Attempting to dereference an invalid iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__imp_, "Attempting to dereference an invalid iterator"); return __imp_->__entry_; } @@ -235,7 +235,7 @@ } void recursive_directory_iterator::__pop(error_code* ec) { - _LIBCPP_ASSERT(__imp_, "Popping the end iterator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__imp_, "Popping the end iterator"); if (ec) ec->clear(); __imp_->__stack_.pop(); diff --git a/libcxx/src/filesystem/error.h b/libcxx/src/filesystem/error.h --- a/libcxx/src/filesystem/error.h +++ b/libcxx/src/filesystem/error.h @@ -99,7 +99,7 @@ #endif // _LIBCPP_WIN32API inline error_code capture_errno() { - _LIBCPP_ASSERT(errno != 0, "Expected errno to be non-zero"); + _LIBCPP_ASSERT_UNCATEGORIZED(errno != 0, "Expected errno to be non-zero"); return error_code(errno, generic_category()); } diff --git a/libcxx/src/filesystem/format_string.h b/libcxx/src/filesystem/format_string.h --- a/libcxx/src/filesystem/format_string.h +++ b/libcxx/src/filesystem/format_string.h @@ -47,7 +47,7 @@ size_t size_with_null = static_cast(ret) + 1; result.__resize_default_init(size_with_null - 1); ret = ::vsnprintf(&result[0], size_with_null, msg, ap); - _LIBCPP_ASSERT(static_cast(ret) == (size_with_null - 1), "TODO"); + _LIBCPP_ASSERT_UNCATEGORIZED(static_cast(ret) == (size_with_null - 1), "TODO"); } return result; } diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp --- a/libcxx/src/filesystem/operations.cpp +++ b/libcxx/src/filesystem/operations.cpp @@ -479,7 +479,7 @@ Deleter deleter = &::free; #else auto size = ::pathconf(".", _PC_PATH_MAX); - _LIBCPP_ASSERT(size >= 0, "pathconf returned a 0 as max size"); + _LIBCPP_ASSERT_UNCATEGORIZED(size >= 0, "pathconf returned a 0 as max size"); auto buff = unique_ptr(new path::value_type[size + 1]); path::value_type* ptr = buff.get(); @@ -627,7 +627,7 @@ const bool resolve_symlinks = !has_opt(perm_options::nofollow); const bool add_perms = has_opt(perm_options::add); const bool remove_perms = has_opt(perm_options::remove); - _LIBCPP_ASSERT( + _LIBCPP_ASSERT_UNCATEGORIZED( (add_perms + remove_perms + has_opt(perm_options::replace)) == 1, "One and only one of the perm_options constants replace, add, or remove " "is present in opts"); @@ -641,7 +641,7 @@ set_sym_perms = is_symlink(st); if (m_ec) return err.report(m_ec); - _LIBCPP_ASSERT(st.permissions() != perms::unknown, + _LIBCPP_ASSERT_UNCATEGORIZED(st.permissions() != perms::unknown, "Permissions unexpectedly unknown"); if (add_perms) prms |= st.permissions(); @@ -687,7 +687,7 @@ detail::SSizeT ret; if ((ret = detail::readlink(p.c_str(), buff.get(), size)) == -1) return err.report(capture_errno()); - _LIBCPP_ASSERT(ret > 0, "TODO"); + _LIBCPP_ASSERT_UNCATEGORIZED(ret > 0, "TODO"); if (static_cast(ret) >= size) return err.report(errc::value_too_large); buff[ret] = 0; diff --git a/libcxx/src/filesystem/posix_compat.h b/libcxx/src/filesystem/posix_compat.h --- a/libcxx/src/filesystem/posix_compat.h +++ b/libcxx/src/filesystem/posix_compat.h @@ -385,7 +385,7 @@ inline wchar_t *realpath(const wchar_t *path, wchar_t *resolved_name) { // Only expected to be used with us allocating the buffer. - _LIBCPP_ASSERT(resolved_name == nullptr, + _LIBCPP_ASSERT_UNCATEGORIZED(resolved_name == nullptr, "Windows realpath() assumes a null resolved_name"); WinHandle h(path, FILE_READ_ATTRIBUTES, 0); diff --git a/libcxx/src/include/ryu/common.h b/libcxx/src/include/ryu/common.h --- a/libcxx/src/include/ryu/common.h +++ b/libcxx/src/include/ryu/common.h @@ -52,7 +52,7 @@ // Function precondition: __v is not a 10-digit number. // (f2s: 9 digits are sufficient for round-tripping.) // (d2fixed: We print 9-digit blocks.) - _LIBCPP_ASSERT(__v < 1000000000, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__v < 1000000000, ""); if (__v >= 100000000) { return 9; } if (__v >= 10000000) { return 8; } if (__v >= 1000000) { return 7; } @@ -69,24 +69,24 @@ // This approximation works up to the point that the multiplication overflows at __e = 3529. // If the multiplication were done in 64 bits, it would fail at 5^4004 which is just greater // than 2^9297. - _LIBCPP_ASSERT(__e >= 0, ""); - _LIBCPP_ASSERT(__e <= 3528, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__e >= 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__e <= 3528, ""); return static_cast(((static_cast(__e) * 1217359) >> 19) + 1); } // Returns floor(log_10(2^__e)). [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline uint32_t __log10Pow2(const int32_t __e) { // The first value this approximation fails for is 2^1651 which is just greater than 10^297. - _LIBCPP_ASSERT(__e >= 0, ""); - _LIBCPP_ASSERT(__e <= 1650, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__e >= 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__e <= 1650, ""); return (static_cast(__e) * 78913) >> 18; } // Returns floor(log_10(5^__e)). [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline uint32_t __log10Pow5(const int32_t __e) { // The first value this approximation fails for is 5^2621 which is just greater than 10^1832. - _LIBCPP_ASSERT(__e >= 0, ""); - _LIBCPP_ASSERT(__e <= 2620, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__e >= 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__e <= 2620, ""); return (static_cast(__e) * 732923) >> 20; } diff --git a/libcxx/src/include/ryu/d2s_intrinsics.h b/libcxx/src/include/ryu/d2s_intrinsics.h --- a/libcxx/src/include/ryu/d2s_intrinsics.h +++ b/libcxx/src/include/ryu/d2s_intrinsics.h @@ -63,7 +63,7 @@ // (The shift value is in the range [49, 58].) // Check this here in case a future change requires larger shift // values. In this case this function needs to be adjusted. - _LIBCPP_ASSERT(__dist < 64, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__dist < 64, ""); return __shiftright128(__lo, __hi, static_cast(__dist)); } @@ -85,7 +85,7 @@ // (The shift value is in the range [49, 58].) // Check this here in case a future change requires larger shift // values. In this case this function needs to be adjusted. - _LIBCPP_ASSERT(__dist < 64, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__dist < 64, ""); auto __temp = __lo | ((unsigned __int128)__hi << 64); // For x64 128-bit shfits using the `shrd` instruction and two 64-bit // registers, the shift value is modulo 64. Thus the `& 63` is free. @@ -126,13 +126,13 @@ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline uint64_t __ryu_shiftright128(const uint64_t __lo, const uint64_t __hi, const uint32_t __dist) { // We don't need to handle the case __dist >= 64 here (see above). - _LIBCPP_ASSERT(__dist < 64, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__dist < 64, ""); #ifdef _LIBCPP_64_BIT - _LIBCPP_ASSERT(__dist > 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__dist > 0, ""); return (__hi << (64 - __dist)) | (__lo >> __dist); #else // ^^^ 64-bit ^^^ / vvv 32-bit vvv // Avoid a 64-bit shift by taking advantage of the range of shift values. - _LIBCPP_ASSERT(__dist >= 32, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__dist >= 32, ""); return (__hi << (64 - __dist)) | (static_cast(__lo >> 32) >> (__dist - 32)); #endif // ^^^ 32-bit ^^^ } @@ -227,7 +227,7 @@ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline uint32_t __pow5Factor(uint64_t __value) { uint32_t __count = 0; for (;;) { - _LIBCPP_ASSERT(__value != 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__value != 0, ""); const uint64_t __q = __div5(__value); const uint32_t __r = static_cast(__value) - 5 * static_cast(__q); if (__r != 0) { @@ -247,8 +247,8 @@ // Returns true if __value is divisible by 2^__p. [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline bool __multipleOfPowerOf2(const uint64_t __value, const uint32_t __p) { - _LIBCPP_ASSERT(__value != 0, ""); - _LIBCPP_ASSERT(__p < 64, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__value != 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__p < 64, ""); // __builtin_ctzll doesn't appear to be faster here. return (__value & ((1ull << __p) - 1)) == 0; } diff --git a/libcxx/src/include/to_chars_floating_point.h b/libcxx/src/include/to_chars_floating_point.h --- a/libcxx/src/include/to_chars_floating_point.h +++ b/libcxx/src/include/to_chars_floating_point.h @@ -269,7 +269,7 @@ // * Print the leading hexit, then mask it away. { const uint32_t _Nibble = static_cast(_Adjusted_mantissa >> _Adjusted_explicit_bits); - _LIBCPP_ASSERT(_Nibble < 3, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Nibble < 3, ""); const char _Leading_hexit = static_cast('0' + _Nibble); *_First++ = _Leading_hexit; @@ -288,12 +288,12 @@ int32_t _Number_of_bits_remaining = _Adjusted_explicit_bits; // 24 for float, 52 for double for (;;) { - _LIBCPP_ASSERT(_Number_of_bits_remaining >= 4, ""); - _LIBCPP_ASSERT(_Number_of_bits_remaining % 4 == 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Number_of_bits_remaining >= 4, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Number_of_bits_remaining % 4 == 0, ""); _Number_of_bits_remaining -= 4; const uint32_t _Nibble = static_cast(_Adjusted_mantissa >> _Number_of_bits_remaining); - _LIBCPP_ASSERT(_Nibble < 16, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Nibble < 16, ""); const char _Hexit = __itoa::_Charconv_digits[_Nibble]; *_First++ = _Hexit; @@ -415,12 +415,12 @@ // '0' hexits, the same condition works (as we print the final hexit and mask it away); we don't need to test // _Number_of_bits_remaining. do { - _LIBCPP_ASSERT(_Number_of_bits_remaining >= 4, ""); - _LIBCPP_ASSERT(_Number_of_bits_remaining % 4 == 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Number_of_bits_remaining >= 4, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Number_of_bits_remaining % 4 == 0, ""); _Number_of_bits_remaining -= 4; const uint32_t _Nibble = static_cast(_Adjusted_mantissa >> _Number_of_bits_remaining); - _LIBCPP_ASSERT(_Nibble < 16, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Nibble < 16, ""); const char _Hexit = __itoa::_Charconv_digits[_Nibble]; if (_First == _Last) { @@ -940,13 +940,13 @@ _Effective_precision = _VSTD::min(_Precision - (_Scientific_exponent_X + 1), _Max_fixed_precision); const to_chars_result _Buf_result = _Floating_to_chars_fixed_precision(_Buffer, _VSTD::end(_Buffer), _Value, _Effective_precision); - _LIBCPP_ASSERT(_Buf_result.ec == errc{}, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Buf_result.ec == errc{}, ""); _Significand_last = _Buf_result.ptr; } else { _Effective_precision = _VSTD::min(_Precision - 1, _Max_scientific_precision); const to_chars_result _Buf_result = _Floating_to_chars_scientific_precision(_Buffer, _VSTD::end(_Buffer), _Value, _Effective_precision); - _LIBCPP_ASSERT(_Buf_result.ec == errc{}, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Buf_result.ec == errc{}, ""); _Significand_last = _VSTD::find(_Buffer, _Buf_result.ptr, 'e'); _Exponent_first = _Significand_last; _Exponent_last = _Buf_result.ptr; @@ -992,10 +992,10 @@ char* _First, char* const _Last, _Floating _Value, const chars_format _Fmt, const int _Precision) noexcept { if constexpr (_Overload == _Floating_to_chars_overload::_Plain) { - _LIBCPP_ASSERT(_Fmt == chars_format{}, ""); // plain overload must pass chars_format{} internally + _LIBCPP_ASSERT_UNCATEGORIZED(_Fmt == chars_format{}, ""); // plain overload must pass chars_format{} internally } else { - _LIBCPP_ASSERT(_Fmt == chars_format::general || _Fmt == chars_format::scientific || _Fmt == chars_format::fixed - || _Fmt == chars_format::hex, + _LIBCPP_ASSERT_UNCATEGORIZED(_Fmt == chars_format::general || _Fmt == chars_format::scientific + || _Fmt == chars_format::fixed || _Fmt == chars_format::hex, "invalid format in to_chars()"); } diff --git a/libcxx/src/memory_resource.cpp b/libcxx/src/memory_resource.cpp --- a/libcxx/src/memory_resource.cpp +++ b/libcxx/src/memory_resource.cpp @@ -175,7 +175,7 @@ void unsynchronized_pool_resource::__adhoc_pool::__do_deallocate( memory_resource* upstream, void* p, size_t bytes, size_t align) { - _LIBCPP_ASSERT(__first_ != nullptr, "deallocating a block that was not allocated with this allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(__first_ != nullptr, "deallocating a block that was not allocated with this allocator"); if (__first_->__start_ == p) { __chunk_footer* next = __first_->__next_; upstream->deallocate(p, __first_->__allocation_size(), __first_->__align_); @@ -189,7 +189,7 @@ return; } } - _LIBCPP_ASSERT(false, "deallocating a block that was not allocated with this allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED(false, "deallocating a block that was not allocated with this allocator"); } } @@ -230,7 +230,7 @@ } void* __allocate_in_new_chunk(memory_resource* upstream, size_t block_size, size_t chunk_size) { - _LIBCPP_ASSERT(chunk_size % block_size == 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(chunk_size % block_size == 0, ""); static_assert(__default_alignment >= alignof(std::max_align_t), ""); static_assert(__default_alignment >= alignof(__chunk_footer), ""); static_assert(__default_alignment >= alignof(__vacancy_header), ""); @@ -401,7 +401,8 @@ if (i == __num_fixed_pools_) return __adhoc_pool_.__do_deallocate(__res_, p, bytes, align); else { - _LIBCPP_ASSERT(__fixed_pools_ != nullptr, "deallocating a block that was not allocated with this allocator"); + _LIBCPP_ASSERT_UNCATEGORIZED( + __fixed_pools_ != nullptr, "deallocating a block that was not allocated with this allocator"); __fixed_pools_[i].__evacuate(p); } } diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp --- a/libcxx/src/mutex.cpp +++ b/libcxx/src/mutex.cpp @@ -46,7 +46,7 @@ { int ec = __libcpp_mutex_unlock(&__m_); (void)ec; - _LIBCPP_ASSERT(ec == 0, "call to mutex::unlock failed"); + _LIBCPP_ASSERT_UNCATEGORIZED(ec == 0, "call to mutex::unlock failed"); } // recursive_mutex @@ -62,7 +62,7 @@ { int e = __libcpp_recursive_mutex_destroy(&__m_); (void)e; - _LIBCPP_ASSERT(e == 0, "call to ~recursive_mutex() failed"); + _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to ~recursive_mutex() failed"); } void @@ -78,7 +78,7 @@ { int e = __libcpp_recursive_mutex_unlock(&__m_); (void)e; - _LIBCPP_ASSERT(e == 0, "call to recursive_mutex::unlock() failed"); + _LIBCPP_ASSERT_UNCATEGORIZED(e == 0, "call to recursive_mutex::unlock() failed"); } bool diff --git a/libcxx/src/ryu/d2fixed.cpp b/libcxx/src/ryu/d2fixed.cpp --- a/libcxx/src/ryu/d2fixed.cpp +++ b/libcxx/src/ryu/d2fixed.cpp @@ -102,8 +102,8 @@ const uint64_t __s1low = __low2 + __high1 + __c1; // 128 const uint32_t __c2 = __s1low < __low2; // __high1 + __c1 can't overflow, so compare against __low2 const uint64_t __s1high = __high2 + __c2; // 192 - _LIBCPP_ASSERT(__j >= 128, ""); - _LIBCPP_ASSERT(__j <= 180, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__j >= 128, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__j <= 180, ""); #ifdef _LIBCPP_INTRINSIC128 const uint32_t __dist = static_cast(__j - 128); // __dist: [0, 52] const uint64_t __shiftedhigh = __s1high >> __dist; diff --git a/libcxx/src/ryu/d2s.cpp b/libcxx/src/ryu/d2s.cpp --- a/libcxx/src/ryu/d2s.cpp +++ b/libcxx/src/ryu/d2s.cpp @@ -154,7 +154,7 @@ // The average output length is 16.38 digits, so we check high-to-low. // Function precondition: __v is not an 18, 19, or 20-digit number. // (17 digits are sufficient for round-tripping.) - _LIBCPP_ASSERT(__v < 100000000000000000u, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__v < 100000000000000000u, ""); if (__v >= 10000000000000000u) { return 17; } if (__v >= 1000000000000000u) { return 16; } if (__v >= 100000000000000u) { return 15; } diff --git a/libcxx/src/ryu/f2s.cpp b/libcxx/src/ryu/f2s.cpp --- a/libcxx/src/ryu/f2s.cpp +++ b/libcxx/src/ryu/f2s.cpp @@ -86,7 +86,7 @@ [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline uint32_t __pow5Factor(uint32_t __value) { uint32_t __count = 0; for (;;) { - _LIBCPP_ASSERT(__value != 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__value != 0, ""); const uint32_t __q = __value / 5; const uint32_t __r = __value % 5; if (__r != 0) { @@ -105,14 +105,14 @@ // Returns true if __value is divisible by 2^__p. [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline bool __multipleOfPowerOf2(const uint32_t __value, const uint32_t __p) { - _LIBCPP_ASSERT(__value != 0, ""); - _LIBCPP_ASSERT(__p < 32, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__value != 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__p < 32, ""); // __builtin_ctz doesn't appear to be faster here. return (__value & ((1u << __p) - 1)) == 0; } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline uint32_t __mulShift(const uint32_t __m, const uint64_t __factor, const int32_t __shift) { - _LIBCPP_ASSERT(__shift > 32, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__shift > 32, ""); // The casts here help MSVC to avoid calls to the __allmul library // function. @@ -134,7 +134,7 @@ #else // ^^^ 32-bit ^^^ / vvv 64-bit vvv const uint64_t __sum = (__bits0 >> 32) + __bits1; const uint64_t __shiftedSum = __sum >> (__shift - 32); - _LIBCPP_ASSERT(__shiftedSum <= UINT32_MAX, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(__shiftedSum <= UINT32_MAX, ""); return static_cast(__shiftedSum); #endif // ^^^ 64-bit ^^^ } @@ -309,8 +309,8 @@ // Performance note: Long division appears to be faster than losslessly widening float to double and calling // __d2fixed_buffered_n(). If __f2fixed_buffered_n() is implemented, it might be faster than long division. - _LIBCPP_ASSERT(_Exponent2 > 0, ""); - _LIBCPP_ASSERT(_Exponent2 <= 104, ""); // because __ieeeExponent <= 254 + _LIBCPP_ASSERT_UNCATEGORIZED(_Exponent2 > 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Exponent2 <= 104, ""); // because __ieeeExponent <= 254 // Manually represent _Mantissa2 * 2^_Exponent2 as a large integer. _Mantissa2 is always 24 bits // (due to the implicit bit), while _Exponent2 indicates a shift of at most 104 bits. @@ -328,7 +328,7 @@ // _Maxidx is the index of the most significant nonzero element. uint32_t _Maxidx = ((24 + static_cast(_Exponent2) + 31) / 32) - 1; - _LIBCPP_ASSERT(_Maxidx < _Data_size, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Maxidx < _Data_size, ""); const uint32_t _Bit_shift = static_cast(_Exponent2) % 32; if (_Bit_shift <= 8) { // _Mantissa2's 24 bits don't cross an element boundary @@ -388,9 +388,9 @@ } } - _LIBCPP_ASSERT(_Data[0] != 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Data[0] != 0, ""); for (uint32_t _Idx = 1; _Idx < _Data_size; ++_Idx) { - _LIBCPP_ASSERT(_Data[_Idx] == 0, ""); + _LIBCPP_ASSERT_UNCATEGORIZED(_Data[_Idx] == 0, ""); } const uint32_t _Data_olength = _Data[0] >= 1000000000 ? 10 : __decimalLength9(_Data[0]); diff --git a/libcxx/src/string.cpp b/libcxx/src/string.cpp --- a/libcxx/src/string.cpp +++ b/libcxx/src/string.cpp @@ -357,7 +357,7 @@ constexpr size_t bufsize = numeric_limits::digits10 + 2; // +1 for minus, +1 for digits10 char buf[bufsize]; const auto res = to_chars(buf, buf + bufsize, v); - _LIBCPP_ASSERT(res.ec == errc(), "bufsize must be large enough to accomodate the value"); + _LIBCPP_ASSERT_UNCATEGORIZED(res.ec == errc(), "bufsize must be large enough to accomodate the value"); return S(buf, res.ptr); } diff --git a/libcxx/src/strstream.cpp b/libcxx/src/strstream.cpp --- a/libcxx/src/strstream.cpp +++ b/libcxx/src/strstream.cpp @@ -173,7 +173,7 @@ if (buf == nullptr) return int_type(EOF); if (old_size != 0) { - _LIBCPP_ASSERT(eback(), "overflow copying from NULL"); + _LIBCPP_ASSERT_UNCATEGORIZED(eback(), "overflow copying from NULL"); memcpy(buf, eback(), static_cast(old_size)); } ptrdiff_t ninp = gptr() - eback(); diff --git a/libcxx/src/support/ibm/xlocale_zos.cpp b/libcxx/src/support/ibm/xlocale_zos.cpp --- a/libcxx/src/support/ibm/xlocale_zos.cpp +++ b/libcxx/src/support/ibm/xlocale_zos.cpp @@ -111,7 +111,7 @@ tokenized.push_back(s); } - _LIBCPP_ASSERT(tokenized.size() >= _NCAT, "locale-name list is too short"); + _LIBCPP_ASSERT_UNCATEGORIZED(tokenized.size() >= _NCAT, "locale-name list is too short"); previous_loc->lc_collate = tokenized[LC_COLLATE]; previous_loc->lc_ctype = tokenized[LC_CTYPE]; diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp --- a/libcxx/src/system_error.cpp +++ b/libcxx/src/system_error.cpp @@ -103,7 +103,7 @@ if (new_errno == EINVAL) return ""; - _LIBCPP_ASSERT(new_errno == ERANGE, "unexpected error from ::strerror_r"); + _LIBCPP_ASSERT_UNCATEGORIZED(new_errno == ERANGE, "unexpected error from ::strerror_r"); // FIXME maybe? 'strerror_buff_size' is likely to exceed the // maximum error size so ERANGE shouldn't be returned. std::abort();