[libcxx-commits] [libcxx] cd0ad42 - [libc++][hardening][NFC] Introduce `_LIBCPP_ASSERT_UNCATEGORIZED`.
via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 28 15:10:47 PDT 2023
Author: varconst
Date: 2023-06-28T15:10:31-07:00
New Revision: cd0ad4216cb962f160b1b0054df6f72ce6f9f766
URL: https://github.com/llvm/llvm-project/commit/cd0ad4216cb962f160b1b0054df6f72ce6f9f766
DIFF: https://github.com/llvm/llvm-project/commit/cd0ad4216cb962f160b1b0054df6f72ce6f9f766.diff
LOG: [libc++][hardening][NFC] Introduce `_LIBCPP_ASSERT_UNCATEGORIZED`.
Replace most uses of `_LIBCPP_ASSERT` with
`_LIBCPP_ASSERT_UNCATEGORIZED`.
This is done as a prerequisite to introducing hardened mode to libc++.
The idea is to make enabling assertions an opt-in with (somewhat)
fine-grained controls over which categories of assertions are enabled.
The vast majority of assertions are currently uncategorized; the new
macro will allow turning on `_LIBCPP_ASSERT` (the underlying mechanism
for all kinds of assertions) without enabling all the uncategorized
assertions (in the future; this patch preserves the current behavior).
Differential Revision: https://reviews.llvm.org/D153816
Added:
Modified:
libcxx/include/__algorithm/clamp.h
libcxx/include/__algorithm/pop_heap.h
libcxx/include/__algorithm/ranges_clamp.h
libcxx/include/__algorithm/ranges_max.h
libcxx/include/__algorithm/ranges_min.h
libcxx/include/__algorithm/ranges_minmax.h
libcxx/include/__algorithm/sample.h
libcxx/include/__algorithm/sift_down.h
libcxx/include/__algorithm/sort.h
libcxx/include/__assert
libcxx/include/__bit/bit_ceil.h
libcxx/include/__charconv/from_chars_integral.h
libcxx/include/__charconv/to_chars_base_10.h
libcxx/include/__charconv/to_chars_integral.h
libcxx/include/__charconv/traits.h
libcxx/include/__chrono/parser_std_format_spec.h
libcxx/include/__coroutine/coroutine_handle.h
libcxx/include/__debug_utils/strict_weak_ordering_check.h
libcxx/include/__expected/expected.h
libcxx/include/__filesystem/directory_iterator.h
libcxx/include/__filesystem/path_iterator.h
libcxx/include/__format/buffer.h
libcxx/include/__format/format_arg.h
libcxx/include/__format/format_string.h
libcxx/include/__format/formatter_bool.h
libcxx/include/__format/formatter_floating_point.h
libcxx/include/__format/formatter_integral.h
libcxx/include/__format/formatter_output.h
libcxx/include/__format/formatter_string.h
libcxx/include/__format/parser_std_format_spec.h
libcxx/include/__format/range_formatter.h
libcxx/include/__format/unicode.h
libcxx/include/__functional/function.h
libcxx/include/__hash_table
libcxx/include/__iterator/advance.h
libcxx/include/__iterator/bounded_iter.h
libcxx/include/__iterator/common_iterator.h
libcxx/include/__iterator/counted_iterator.h
libcxx/include/__iterator/next.h
libcxx/include/__iterator/prev.h
libcxx/include/__mdspan/extents.h
libcxx/include/__memory/assume_aligned.h
libcxx/include/__memory/construct_at.h
libcxx/include/__memory_resource/polymorphic_allocator.h
libcxx/include/__node_handle
libcxx/include/__numeric/gcd_lcm.h
libcxx/include/__pstl/internal/algorithm_impl.h
libcxx/include/__pstl/internal/numeric_impl.h
libcxx/include/__pstl/internal/parallel_backend_tbb.h
libcxx/include/__pstl/internal/parallel_backend_utils.h
libcxx/include/__random/negative_binomial_distribution.h
libcxx/include/__ranges/drop_view.h
libcxx/include/__ranges/drop_while_view.h
libcxx/include/__ranges/filter_view.h
libcxx/include/__ranges/iota_view.h
libcxx/include/__ranges/lazy_split_view.h
libcxx/include/__ranges/subrange.h
libcxx/include/__ranges/take_view.h
libcxx/include/__ranges/view_interface.h
libcxx/include/__stop_token/intrusive_list_view.h
libcxx/include/__stop_token/stop_state.h
libcxx/include/__string/char_traits.h
libcxx/include/__thread/thread.h
libcxx/include/__tree
libcxx/include/__utility/exception_guard.h
libcxx/include/__utility/is_pointer_in_range.h
libcxx/include/__utility/unreachable.h
libcxx/include/array
libcxx/include/deque
libcxx/include/experimental/memory_resource
libcxx/include/fstream
libcxx/include/future
libcxx/include/list
libcxx/include/locale
libcxx/include/map
libcxx/include/optional
libcxx/include/regex
libcxx/include/set
libcxx/include/span
libcxx/include/string
libcxx/include/string_view
libcxx/include/unordered_map
libcxx/include/unordered_set
libcxx/include/vector
libcxx/src/filesystem/directory_iterator.cpp
libcxx/src/filesystem/error.h
libcxx/src/filesystem/format_string.h
libcxx/src/filesystem/operations.cpp
libcxx/src/filesystem/posix_compat.h
libcxx/src/include/ryu/common.h
libcxx/src/include/ryu/d2s_intrinsics.h
libcxx/src/include/to_chars_floating_point.h
libcxx/src/memory_resource.cpp
libcxx/src/mutex.cpp
libcxx/src/ryu/d2fixed.cpp
libcxx/src/ryu/d2s.cpp
libcxx/src/ryu/f2s.cpp
libcxx/src/string.cpp
libcxx/src/strstream.cpp
libcxx/src/support/ibm/xlocale_zos.cpp
libcxx/src/system_error.cpp
Removed:
################################################################################
diff --git a/libcxx/include/__algorithm/clamp.h b/libcxx/include/__algorithm/clamp.h
index ce5740584acfb..31deb4fd94aa1 100644
--- a/libcxx/include/__algorithm/clamp.h
+++ b/libcxx/include/__algorithm/clamp.h
@@ -26,7 +26,7 @@ _LIBCPP_INLINE_VISIBILITY constexpr
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
index 1dda2689320ab..89ac62950fdda 100644
--- a/libcxx/include/__algorithm/pop_heap.h
+++ b/libcxx/include/__algorithm/pop_heap.h
@@ -31,7 +31,7 @@ template <class _AlgPolicy, class _Compare, class _RandomAccessIterator>
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14
void __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare& __comp,
typename iterator_traits<_RandomAccessIterator>::
diff erence_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
index 45bbebb97ef87..9613f7f37720a 100644
--- a/libcxx/include/__algorithm/ranges_clamp.h
+++ b/libcxx/include/__algorithm/ranges_clamp.h
@@ -34,8 +34,8 @@ struct __fn {
indirect_strict_weak_order<projected<const _Type*, _Proj>> _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
index 321cac56e29b0..5cc418d3393ce 100644
--- a/libcxx/include/__algorithm/ranges_max.h
+++ b/libcxx/include/__algorithm/ranges_max.h
@@ -54,7 +54,7 @@ struct __fn {
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _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 @@ struct __fn {
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<range_value_t<_Rp>>) {
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
index 63161396d9097..be15b4536734d 100644
--- a/libcxx/include/__algorithm/ranges_min.h
+++ b/libcxx/include/__algorithm/ranges_min.h
@@ -53,7 +53,7 @@ struct __fn {
indirect_strict_weak_order<projected<const _Tp*, _Proj>> _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 @@ struct __fn {
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<range_value_t<_Rp>>) {
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
index 9a8bd9b10d636..a5b5cf9bd0ab9 100644
--- a/libcxx/include/__algorithm/ranges_minmax.h
+++ b/libcxx/include/__algorithm/ranges_minmax.h
@@ -65,7 +65,7 @@ struct __fn {
indirect_strict_weak_order<projected<const _Type*, _Proj>> _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 @@ struct __fn {
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
index 8769d494e28f2..c7a1898e5308b 100644
--- a/libcxx/include/__algorithm/sample.h
+++ b/libcxx/include/__algorithm/sample.h
@@ -77,7 +77,7 @@ _LIBCPP_INLINE_VISIBILITY
_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 __
diff erence_type<_PopulationIterator>;
diff --git a/libcxx/include/__algorithm/sift_down.h b/libcxx/include/__algorithm/sift_down.h
index e3972fb6f46e5..2e57f95b30c81 100644
--- a/libcxx/include/__algorithm/sift_down.h
+++ b/libcxx/include/__algorithm/sift_down.h
@@ -83,7 +83,7 @@ __floyd_sift_down(_RandomAccessIterator __first, _Compare&& __comp,
typename iterator_traits<_RandomAccessIterator>::
diff erence_type __len)
{
using
diff erence_type = typename iterator_traits<_RandomAccessIterator>::
diff erence_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
index c56215b9cbd41..049cf3dfffedf 100644
--- a/libcxx/include/__algorithm/sort.h
+++ b/libcxx/include/__algorithm/sort.h
@@ -296,7 +296,9 @@ __insertion_sort_unguarded(_RandomAccessIterator const __first, _RandomAccessIte
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 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
using _Ops = _IterOps<_AlgPolicy>;
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type;
typedef typename std::iterator_traits<_RandomAccessIterator>::
diff erence_type
diff erence_type;
- _LIBCPP_ASSERT(__last - __first >=
diff erence_type(3), "");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >=
diff erence_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 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
// 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 @@ __bitset_partition(_RandomAccessIterator __first, _RandomAccessIterator __last,
// 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 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
using _Ops = _IterOps<_AlgPolicy>;
typedef typename iterator_traits<_RandomAccessIterator>::
diff erence_type
diff erence_type;
typedef typename std::iterator_traits<_RandomAccessIterator>::value_type value_type;
- _LIBCPP_ASSERT(__last - __first >=
diff erence_type(3), "");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__last - __first >=
diff erence_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 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
// 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 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
} 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 @@ __partition_with_equals_on_right(_RandomAccessIterator __first, _RandomAccessIte
_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 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter
// 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 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter
// 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 @@ __partition_with_equals_on_left(_RandomAccessIterator __first, _RandomAccessIter
_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
index 277f12367991e..cb712e3d89823 100644
--- 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
index f6bcb3511026c..706d446359dd9 100644
--- a/libcxx/include/__bit/bit_ceil.h
+++ b/libcxx/include/__bit/bit_ceil.h
@@ -28,7 +28,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr _Tp bit_ceil(_Tp __t) noex
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
index 990aa21741b5a..acfdf4b30da7b 100644
--- a/libcxx/include/__charconv/from_chars_integral.h
+++ b/libcxx/include/__charconv/from_chars_integral.h
@@ -227,7 +227,7 @@ from_chars(const char* __first, const char* __last, _Tp& __value) {
template <typename _Tp, typename enable_if<is_integral<_Tp>::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
index 028ff3352b65a..33c512e20f04c 100644
--- a/libcxx/include/__charconv/to_chars_base_10.h
+++ b/libcxx/include/__charconv/to_chars_base_10.h
@@ -132,13 +132,13 @@ __base_10_u64(char* __buffer, uint64_t __value) noexcept {
/// 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<uint64_t>::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
index 6c726c088f495..28fac7524cf36 100644
--- a/libcxx/include/__charconv/to_chars_integral.h
+++ b/libcxx/include/__charconv/to_chars_integral.h
@@ -246,7 +246,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value) {
template <typename _Tp>
_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 @@ to_chars(char* __first, char* __last, _Tp __value) {
template <typename _Tp, typename enable_if<is_integral<_Tp>::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
index 505a0b1ac1429..d3884b560dfd7 100644
--- a/libcxx/include/__charconv/traits.h
+++ b/libcxx/include/__charconv/traits.h
@@ -101,11 +101,11 @@ struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__u
/// 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<uint64_t>::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<uint64_t>(__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
index fb6528a476a75..b4526cadf2f78 100644
--- a/libcxx/include/__chrono/parser_std_format_spec.h
+++ b/libcxx/include/__chrono/parser_std_format_spec.h
@@ -160,9 +160,10 @@ class _LIBCPP_TEMPLATE_VIS __parser_chrono {
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
index 2135111e46a2b..7a4eff745eb7a 100644
--- a/libcxx/include/__coroutine/coroutine_handle.h
+++ b/libcxx/include/__coroutine/coroutine_handle.h
@@ -63,7 +63,7 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
_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 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
_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 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_handle {
_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 @@ struct _LIBCPP_TEMPLATE_VIS coroutine_handle {
_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
index cfdc434081543..99200ad65eac9 100644
--- a/libcxx/include/__debug_utils/strict_weak_ordering_check.h
+++ b/libcxx/include/__debug_utils/strict_weak_ordering_check.h
@@ -31,8 +31,9 @@ __check_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccess
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_strict_weak_ordering_sorted(_RandomAccessIterator __first, _RandomAccess
// 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
index 668e23f21c71b..ffb7263feb507 100644
--- a/libcxx/include/__expected/expected.h
+++ b/libcxx/include/__expected/expected.h
@@ -522,32 +522,32 @@ class expected {
// [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 @@ class expected {
}
_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 @@ class expected<_Tp, _Err> {
_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 @@ class expected<_Tp, _Err> {
}
_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
index 903fe2393d98a..632c2c806369b 100644
--- a/libcxx/include/__filesystem/directory_iterator.h
+++ b/libcxx/include/__filesystem/directory_iterator.h
@@ -83,7 +83,7 @@ class directory_iterator {
_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
index 60ab31892ce54..9961b46cf81c0 100644
--- a/libcxx/include/__filesystem/path_iterator.h
+++ b/libcxx/include/__filesystem/path_iterator.h
@@ -67,10 +67,10 @@ class _LIBCPP_EXPORTED_FROM_ABI path::iterator {
_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 @@ class _LIBCPP_EXPORTED_FROM_ABI path::iterator {
_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
index e74ca8f579d42..59455a4b7feb2 100644
--- a/libcxx/include/__format/buffer.h
+++ b/libcxx/include/__format/buffer.h
@@ -115,7 +115,7 @@ class _LIBCPP_TEMPLATE_VIS __output_buffer {
// 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 @@ class _LIBCPP_TEMPLATE_VIS __output_buffer {
/// 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<size_t>(__last - __first);
__flush_on_overflow(__n);
@@ -144,7 +144,7 @@ class _LIBCPP_TEMPLATE_VIS __output_buffer {
// 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 @@ class _LIBCPP_TEMPLATE_VIS __output_buffer {
// 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 @@ class _LIBCPP_TEMPLATE_VIS __retarget_buffer {
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<size_t>(__last - __first);
if (__size_ + __n >= __capacity_)
@@ -611,7 +611,7 @@ class _LIBCPP_TEMPLATE_VIS __retarget_buffer {
_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
index 271404bdd703b..e544450abf612 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -85,7 +85,7 @@ constexpr bool __use_packed_format_arg_store(size_t __size) { return __size <= _
_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
index 4d787ca9c30c7..c728cf2ebced2 100644
--- a/libcxx/include/__format/format_string.h
+++ b/libcxx/include/__format/format_string.h
@@ -66,8 +66,9 @@ template <contiguous_iterator _Iterator>
_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
index e95a216bb3e7e..26ee1dae5f96c 100644
--- a/libcxx/include/__format/formatter_bool.h
+++ b/libcxx/include/__format/formatter_bool.h
@@ -64,7 +64,7 @@ struct _LIBCPP_TEMPLATE_VIS formatter<bool, _CharT> {
static_cast<unsigned>(__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
index a699f403ecb28..4fd01f70aea13 100644
--- a/libcxx/include/__format/formatter_floating_point.h
+++ b/libcxx/include/__format/formatter_floating_point.h
@@ -56,21 +56,21 @@ namespace __formatter {
template <floating_point _Tp>
_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 <floating_point _Tp>
_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 <floating_point _Tp>
_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 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_default(const __float_buffe
__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 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_hexadecimal_lower_case(cons
}
// 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 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(const
__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 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_scientific_lower_case(const
}
// 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 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_fixed(const __float_buffer<
__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 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer_general_lower_case(__float_
}
// 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 @@ _LIBCPP_HIDE_FROM_ABI __float_result __format_buffer(
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
index 657c9bd151db9..fe2e1ee73c298 100644
--- a/libcxx/include/__format/formatter_integral.h
+++ b/libcxx/include/__format/formatter_integral.h
@@ -85,9 +85,9 @@ _LIBCPP_HIDE_FROM_ABI inline char* __insert_sign(char* __buf, bool __negative, _
* regardless whether the @c std::numpunct's type is @c char or @c wchar_t.
*/
_LIBCPP_HIDE_FROM_ABI inline string __determine_grouping(ptr
diff _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 @@ _LIBCPP_HIDE_FROM_ABI char* __to_buffer(char* __first, char* __last, _Tp __value
// 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 @@ __format_integer(_Tp __value,
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
index 85f45779ff33e..6798c4b33f97d 100644
--- a/libcxx/include/__format/formatter_output.h
+++ b/libcxx/include/__format/formatter_output.h
@@ -72,8 +72,8 @@ struct _LIBCPP_EXPORTED_FROM_ABI __padding_size_result {
_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 @@ _LIBCPP_HIDE_FROM_ABI _OutIt __write_using_decimal_separators(_OutIt __out_it, c
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 @@ __write(_Iterator __first,
output_iterator<const iter_value_t<_Iterator>&> auto __out_it,
__format_spec::__parsed_specifications<_ParserCharT> __specs,
ptr
diff _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 @@ __write(_Iterator __first,
_Iterator __last,
output_iterator<const iter_value_t<_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 @@ _LIBCPP_HIDE_FROM_ABI auto __write_transformed(const _CharT* __first, const _Cha
output_iterator<const _CharT&> 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");
ptr
diff _t __size = __last - __first;
if (__size >= __specs.__width_)
@@ -365,8 +365,9 @@ _LIBCPP_HIDE_FROM_ABI auto __write_using_trailing_zeros(
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 @@ _LIBCPP_HIDE_FROM_ABI auto __write_string_no_precision(
basic_string_view<_CharT> __str,
output_iterator<const _CharT&> 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 @@ __write_escaped_code_unit(basic_string<_CharT>& __str, char32_t __value, const _
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
index 142e1d3626f6e..bfda5c3da6754 100644
--- a/libcxx/include/__format/formatter_string.h
+++ b/libcxx/include/__format/formatter_string.h
@@ -65,8 +65,8 @@ struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT>
template <class _FormatContext>
_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
index 35facba4e0183..be7d171f7940b 100644
--- a/libcxx/include/__format/parser_std_format_spec.h
+++ b/libcxx/include/__format/parser_std_format_spec.h
@@ -443,9 +443,9 @@ class _LIBCPP_TEMPLATE_VIS __parser {
|| (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 @@ class _LIBCPP_TEMPLATE_VIS __parser {
template <contiguous_iterator _Iterator>
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 @@ class _LIBCPP_TEMPLATE_VIS __parser {
// range-fill and tuple-fill are identical
template <contiguous_iterator _Iterator>
_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 @@ class _LIBCPP_TEMPLATE_VIS __parser {
__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
index 8c3fbd7b43b39..2c8f5c1fa5d3c 100644
--- a/libcxx/include/__format/range_formatter.h
+++ b/libcxx/include/__format/range_formatter.h
@@ -263,8 +263,9 @@ struct _LIBCPP_TEMPLATE_VIS range_formatter {
__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
index f7ff2aba455f7..5a748fa7ab050 100644
--- a/libcxx/include/__format/unicode.h
+++ b/libcxx/include/__format/unicode.h
@@ -155,7 +155,7 @@ class __code_point_view<char> {
// - 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 @@ class __code_point_view<wchar_t> {
_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<char32_t>(*__first_++);
if constexpr (sizeof(wchar_t) == 2) {
@@ -307,8 +307,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool __at_extended_grapheme_cluster_break(
// *** 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 @@ class __extended_grapheme_cluster_view {
};
_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 @@ class __code_point_view {
_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<char32_t>(*__first_++)};
}
diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 30582ce28843d..124be82fe4ebf 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -923,7 +923,7 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
{ }
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 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
}
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
index 78ace76e4a1b1..308e54cb6e544 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -1194,7 +1194,7 @@ public:
_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 @@ public:
}
_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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p)
_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 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
_NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::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 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
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
index c5f3c500d3740..176ec539a6003 100644
--- a/libcxx/include/__iterator/advance.h
+++ b/libcxx/include/__iterator/advance.h
@@ -63,8 +63,8 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
void advance(_InputIter& __i, _Distance __orig_n) {
typedef typename iterator_traits<_InputIter>::
diff erence_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 @@ struct __fn {
template <input_or_output_iterator _Ip>
_LIBCPP_HIDE_FROM_ABI
constexpr void operator()(_Ip& __i, iter_
diff erence_t<_Ip> __n) const {
- _LIBCPP_ASSERT(__n >= 0 || bidirectional_iterator<_Ip>,
- "If `n < 0`, then `bidirectional_iterator<I>` must be true.");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__n >= 0 || bidirectional_iterator<_Ip>,
+ "If `n < 0`, then `bidirectional_iterator<I>` must be true.");
// If `I` models `random_access_iterator`, equivalent to `i += n`.
if constexpr (random_access_iterator<_Ip>) {
@@ -147,8 +147,8 @@ struct __fn {
template <input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
_LIBCPP_HIDE_FROM_ABI constexpr iter_
diff erence_t<_Ip> operator()(_Ip& __i, iter_
diff erence_t<_Ip> __n,
_Sp __bound_sentinel) const {
- _LIBCPP_ASSERT((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>),
- "If `n < 0`, then `bidirectional_iterator<I> && same_as<I, S>` must be true.");
+ _LIBCPP_ASSERT_UNCATEGORIZED((__n >= 0) || (bidirectional_iterator<_Ip> && same_as<_Ip, _Sp>),
+ "If `n < 0`, then `bidirectional_iterator<I> && same_as<I, S>` must be true.");
// If `S` and `I` model `sized_sentinel_for<S, I>`:
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
index 329fd924d7c72..b74cb7439e58c 100644
--- a/libcxx/include/__iterator/bounded_iter.h
+++ b/libcxx/include/__iterator/bounded_iter.h
@@ -78,7 +78,8 @@ struct __bounded_iter {
_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 <class _It>
@@ -89,19 +90,19 @@ struct __bounded_iter {
//
// 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[](
diff erence_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
index e1d114ab95279..75e2400b9ed58 100644
--- a/libcxx/include/__iterator/common_iterator.h
+++ b/libcxx/include/__iterator/common_iterator.h
@@ -72,7 +72,8 @@ class common_iterator {
requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent>
_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 @@ class common_iterator {
requires convertible_to<const _I2&, _Iter> && convertible_to<const _S2&, _Sent> &&
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 @@ class common_iterator {
_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<const _Iter>
{
- _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 @@ class common_iterator {
is_reference_v<iter_reference_t<_I2>> ||
constructible_from<iter_value_t<_I2>, 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<iter_reference_t<_Iter>>) {
@@ -134,12 +139,14 @@ class common_iterator {
}
_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 @@ class common_iterator {
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 @@ class common_iterator {
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 @@ class common_iterator {
requires sized_sentinel_for<_Sent, _I2>
_LIBCPP_HIDE_FROM_ABI
friend constexpr iter_
diff erence_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 @@ class common_iterator {
noexcept(noexcept(ranges::iter_move(std::declval<const _Iter&>())))
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 @@ class common_iterator {
_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<const _Iter&>(), std::declval<const _I2&>())))
{
- _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
index ad69a5c90e68d..13cf7a8f7e205 100644
--- a/libcxx/include/__iterator/counted_iterator.h
+++ b/libcxx/include/__iterator/counted_iterator.h
@@ -83,7 +83,7 @@ class counted_iterator
_LIBCPP_HIDE_FROM_ABI
constexpr counted_iterator(_Iter __iter, iter_
diff erence_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<class _I2>
@@ -112,7 +112,7 @@ class counted_iterator
_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 @@ class counted_iterator
constexpr decltype(auto) operator*() const
requires __dereferenceable<const _Iter>
{
- _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 @@ class counted_iterator
_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 @@ class counted_iterator
_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 @@ class counted_iterator
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 @@ class counted_iterator
constexpr counted_iterator& operator+=(iter_
diff erence_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 @@ class counted_iterator
constexpr counted_iterator& operator-=(iter_
diff erence_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 @@ class counted_iterator
constexpr decltype(auto) operator[](iter_
diff erence_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 @@ class counted_iterator
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 @@ class counted_iterator
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
index 6cb63ecc879b1..5aba095dc485b 100644
--- a/libcxx/include/__iterator/next.h
+++ b/libcxx/include/__iterator/next.h
@@ -28,8 +28,8 @@ template <class _InputIter>
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>::
diff erence_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
index d3f1071d5e23d..d31cd8e49bbfd 100644
--- a/libcxx/include/__iterator/prev.h
+++ b/libcxx/include/__iterator/prev.h
@@ -28,8 +28,8 @@ template <class _InputIter>
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>::
diff erence_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
index e31e43493f46a..03db92b9ef650 100644
--- a/libcxx/include/__mdspan/extents.h
+++ b/libcxx/include/__mdspan/extents.h
@@ -174,8 +174,8 @@ struct __maybe_static_array {
}
// 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 @@ struct __maybe_static_array {
}
// 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 @@ class extents {
(sizeof...(_OtherIndexTypes) == __rank_ || sizeof...(_OtherIndexTypes) == __rank_dynamic_))
_LIBCPP_HIDE_FROM_ABI constexpr explicit extents(_OtherIndexTypes... __dynvals) noexcept
: __vals_(static_cast<index_type>(__dynvals)...) {
- _LIBCPP_ASSERT(__mdspan_detail::__are_representable_as<index_type>(__dynvals...),
- "extents ctor: arguments must be representable as index_type and nonnegative");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__are_representable_as<index_type>(__dynvals...),
+ "extents ctor: arguments must be representable as index_type and nonnegative");
}
template <class _OtherIndexType, size_t _Size>
@@ -320,8 +320,8 @@ class extents {
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<index_type>(span(__exts)),
- "extents ctor: arguments must be representable as index_type and nonnegative");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__are_representable_as<index_type>(span(__exts)),
+ "extents ctor: arguments must be representable as index_type and nonnegative");
}
template <class _OtherIndexType, size_t _Size>
@@ -330,8 +330,8 @@ class extents {
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<index_type>(__exts),
- "extents ctor: arguments must be representable as index_type and nonnegative");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__are_representable_as<index_type>(__exts),
+ "extents ctor: arguments must be representable as index_type and nonnegative");
}
private:
@@ -380,10 +380,10 @@ class extents {
for (size_t __r = 0; __r < rank(); __r++) {
if constexpr (static_cast<make_unsigned_t<index_type>>(numeric_limits<index_type>::max()) <
static_cast<make_unsigned_t<_OtherIndexType>>(numeric_limits<_OtherIndexType>::max())) {
- _LIBCPP_ASSERT(__mdspan_detail::__is_representable_as<index_type>(__other.extent(__r)),
- "extents ctor: arguments must be representable as index_type and nonnegative");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__mdspan_detail::__is_representable_as<index_type>(__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<index_type>(__other.extent(__r)) == static_cast<index_type>(_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
index 1f505f5928dd8..00c2928dcce04 100644
--- a/libcxx/include/__memory/assume_aligned.h
+++ b/libcxx/include/__memory/assume_aligned.h
@@ -34,7 +34,7 @@ constexpr _Tp* assume_aligned(_Tp* __ptr) {
if (is_constant_evaluated()) {
return __ptr;
} else {
- _LIBCPP_ASSERT(reinterpret_cast<uintptr_t>(__ptr) % _Np == 0, "Alignment assumption is violated");
+ _LIBCPP_ASSERT_UNCATEGORIZED(reinterpret_cast<uintptr_t>(__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
index 14923a1bbf7f5..4bab3be53bcb7 100644
--- a/libcxx/include/__memory/construct_at.h
+++ b/libcxx/include/__memory/construct_at.h
@@ -34,7 +34,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _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 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __construct_at(_Tp* __location, _Ar
#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 @@ _ForwardIterator __destroy(_ForwardIterator, _ForwardIterator);
template <class _Tp, typename enable_if<!is_array<_Tp>::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 @@ void __destroy_at(_Tp* __loc) {
template <class _Tp, typename enable_if<is_array<_Tp>::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
index 77a2847dbcb1a..8fcce65ad2f4b 100644
--- a/libcxx/include/__memory_resource/polymorphic_allocator.h
+++ b/libcxx/include/__memory_resource/polymorphic_allocator.h
@@ -69,7 +69,7 @@ class _LIBCPP_AVAILABILITY_PMR _LIBCPP_TEMPLATE_VIS polymorphic_allocator {
}
_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
index d9c2374d35770..b3a42b469d4af 100644
--- a/libcxx/include/__node_handle
+++ b/libcxx/include/__node_handle
@@ -146,7 +146,7 @@ public:
_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
index 7139a7ec5de6a..1e5ab5713d7f2 100644
--- a/libcxx/include/__numeric/gcd_lcm.h
+++ b/libcxx/include/__numeric/gcd_lcm.h
@@ -87,7 +87,7 @@ lcm(_Tp __m, _Up __n)
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
index 99cff2b114131..72043ebbf7623 100644
--- a/libcxx/include/__pstl/internal/algorithm_impl.h
+++ b/libcxx/include/__pstl/internal/algorithm_impl.h
@@ -3011,8 +3011,8 @@ bool __pattern_includes(
__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 @@ bool __pattern_includes(
// 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 @@ _OutputIterator __parallel_set_union_op(
}
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
index 4b7ed16d7e309..484f26ade22c7 100644
--- a/libcxx/include/__pstl/internal/numeric_impl.h
+++ b/libcxx/include/__pstl/internal/numeric_impl.h
@@ -295,7 +295,7 @@ _RandomAccessIterator2 __brick_adjacent_
diff erence(
_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 @@ _RandomAccessIterator2 __pattern_adjacent_
diff erence(
_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
index 41fe9d846017d..6a9a05ddd61f5 100644
--- a/libcxx/include/__pstl/internal/parallel_backend_tbb.h
+++ b/libcxx/include/__pstl/internal/parallel_backend_tbb.h
@@ -527,7 +527,7 @@ class __task : public tbb::detail::d1::task
__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<typename std::decay<_Fn>::type>>(*_M_execute_data, std::forward<_Fn>(__f));
@@ -572,7 +572,7 @@ class __task : public tbb::detail::d1::task
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 @@ class __task : public tbb::detail::d1::task
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 @@ class __func_task : public __task
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 @@ class __merge_func
{
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 @@ class __merge_func
{
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 @@ class __merge_func
__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 @@ class __merge_func
_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 @@ class __merge_func
__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 @@ class __merge_func
__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 @@ operator()(__task* __self)
{
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 @@ __stable_sort_func<_RandomAccessIterator1, _RandomAccessIterator2, _Compare, _Le
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
index 032a0479ec7e9..8adcdb71f8678 100644
--- a/libcxx/include/__pstl/internal/parallel_backend_utils.h
+++ b/libcxx/include/__pstl/internal/parallel_backend_utils.h
@@ -56,7 +56,7 @@ struct __serial_move_merge
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
index 450ff097917c9..21942710feb2a 100644
--- a/libcxx/include/__random/negative_binomial_distribution.h
+++ b/libcxx/include/__random/negative_binomial_distribution.h
@@ -136,8 +136,9 @@ negative_binomial_distribution<_IntType>::operator()(_URNG& __urng, const param_
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<result_type>(gamma_distribution<double>
diff --git a/libcxx/include/__ranges/drop_view.h b/libcxx/include/__ranges/drop_view.h
index 0df8ab46bf387..cdf00cadeea94 100644
--- a/libcxx/include/__ranges/drop_view.h
+++ b/libcxx/include/__ranges/drop_view.h
@@ -78,7 +78,7 @@ namespace ranges {
: __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
index 2f5fdb5f8a1cf..677b5bc66d442 100644
--- a/libcxx/include/__ranges/drop_while_view.h
+++ b/libcxx/include/__ranges/drop_while_view.h
@@ -65,9 +65,10 @@ class drop_while_view : public view_interface<drop_while_view<_View, _Pred>> {
_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
index 77c3553955dc7..fa9fd431098b2 100644
--- a/libcxx/include/__ranges/filter_view.h
+++ b/libcxx/include/__ranges/filter_view.h
@@ -82,7 +82,9 @@ namespace ranges {
_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
index a08fde2ab6507..f372688abfdaf 100644
--- a/libcxx/include/__ranges/iota_view.h
+++ b/libcxx/include/__ranges/iota_view.h
@@ -319,8 +319,8 @@ namespace ranges {
: __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
index 186a0af320f14..04182a530fc5a 100644
--- a/libcxx/include/__ranges/lazy_split_view.h
+++ b/libcxx/include/__ranges/lazy_split_view.h
@@ -280,7 +280,7 @@ class lazy_split_view : public view_interface<lazy_split_view<_View, _Pattern>>
_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 @@ class lazy_split_view : public view_interface<lazy_split_view<_View, _Pattern>>
_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
index a51364de66051..b2b91de3ecc79 100644
--- a/libcxx/include/__ranges/subrange.h
+++ b/libcxx/include/__ranges/subrange.h
@@ -105,7 +105,7 @@ namespace ranges {
: __begin_(std::move(__iter)), __end_(std::move(__sent)), __size_(__n)
{
if constexpr (sized_sentinel_for<_Sent, _Iter>)
- _LIBCPP_ASSERT((__end_ - __begin_) == static_cast<iter_
diff erence_t<_Iter>>(__n),
+ _LIBCPP_ASSERT_UNCATEGORIZED((__end_ - __begin_) == static_cast<iter_
diff erence_t<_Iter>>(__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
index 111e7e5ba2516..34978a7da8da1 100644
--- a/libcxx/include/__ranges/take_view.h
+++ b/libcxx/include/__ranges/take_view.h
@@ -70,7 +70,7 @@ class take_view : public view_interface<take_view<_View>> {
_LIBCPP_HIDE_FROM_ABI
constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_view(_View __base, range_
diff erence_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
index 0a14d0df297ec..e548355d29a4d 100644
--- a/libcxx/include/__ranges/view_interface.h
+++ b/libcxx/include/__ranges/view_interface.h
@@ -118,7 +118,7 @@ class view_interface {
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 @@ class view_interface {
constexpr decltype(auto) front() const
requires forward_range<const _D2>
{
- _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 @@ class view_interface {
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 @@ class view_interface {
constexpr decltype(auto) back() const
requires bidirectional_range<const _D2> && common_range<const _D2>
{
- _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
index 88c8f7e29be8b..4b63955e0d13c 100644
--- a/libcxx/include/__stop_token/intrusive_list_view.h
+++ b/libcxx/include/__stop_token/intrusive_list_view.h
@@ -67,7 +67,7 @@ struct __intrusive_list_view {
__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
index 95d563cc14c2d..9103bb1961599 100644
--- a/libcxx/include/__stop_token/stop_state.h
+++ b/libcxx/include/__stop_token/stop_state.h
@@ -69,7 +69,7 @@ class __stop_state {
_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 @@ class __stop_state {
// 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
index 5c441df98c934..a61c70c2a4f67 100644
--- a/libcxx/include/__string/char_traits.h
+++ b/libcxx/include/__string/char_traits.h
@@ -142,7 +142,7 @@ struct _LIBCPP_DEPRECATED_("char_traits<T> for T not equal to char, wchar_t, cha
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 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>
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 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
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 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
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 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char16_t>
_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
index 88b4ede89ae15..2b329fd55010d 100644
--- a/libcxx/include/__thread/thread.h
+++ b/libcxx/include/__thread/thread.h
@@ -108,7 +108,7 @@ template <class _Tp>
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
index 25c86ca01a963..713e070a6186a 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -169,7 +169,7 @@ inline _LIBCPP_INLINE_VISIBILITY
_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 @@ inline _LIBCPP_INLINE_VISIBILITY
_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 @@ template <class _NodePtr>
_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 @@ inline _LIBCPP_INLINE_VISIBILITY
_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 @@ inline _LIBCPP_INLINE_VISIBILITY
_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 @@ template <class _NodePtr>
_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 @@ template <class _NodePtr>
_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 @@ template <class _NodePtr>
_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 @@ template <class _NodePtr>
_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 @@ template <class _NodePtr>
_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
index 1db8f8af1bf02..8d411820967ac 100644
--- a/libcxx/include/__utility/exception_guard.h
+++ b/libcxx/include/__utility/exception_guard.h
@@ -112,7 +112,7 @@ struct __exception_guard_noexceptions {
}
_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
index 84e833deb3e07..e8f07a02b8f53 100644
--- a/libcxx/include/__utility/is_pointer_in_range.h
+++ b/libcxx/include/__utility/is_pointer_in_range.h
@@ -35,7 +35,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address
"__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
index bd1c6bea04bad..4a21b74b19739 100644
--- 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
index 5a8a1acca4755..e4cd9b9ba5d1b 100644
--- a/libcxx/include/array
+++ b/libcxx/include/array
@@ -228,12 +228,12 @@ struct _LIBCPP_TEMPLATE_VIS array
// 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<T, N>");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__n < _Size, "out-of-bounds access in std::array<T, N>");
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<T, N>");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__n < _Size, "out-of-bounds access in std::array<T, N>");
return __elems_[__n];
}
@@ -341,13 +341,13 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
// element access:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
reference operator[](size_type) _NOEXCEPT {
- _LIBCPP_ASSERT(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
+ _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array<T, 0>::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<T, 0>::operator[] on a zero-sized array");
+ _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array<T, 0>::operator[] on a zero-sized array");
__libcpp_unreachable();
}
@@ -365,25 +365,25 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
reference front() _NOEXCEPT {
- _LIBCPP_ASSERT(false, "cannot call array<T, 0>::front() on a zero-sized array");
+ _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array<T, 0>::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<T, 0>::front() on a zero-sized array");
+ _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array<T, 0>::front() on a zero-sized array");
__libcpp_unreachable();
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17
reference back() _NOEXCEPT {
- _LIBCPP_ASSERT(false, "cannot call array<T, 0>::back() on a zero-sized array");
+ _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array<T, 0>::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<T, 0>::back() on a zero-sized array");
+ _LIBCPP_ASSERT_UNCATEGORIZED(false, "cannot call array<T, 0>::back() on a zero-sized array");
__libcpp_unreachable();
}
};
diff --git a/libcxx/include/deque b/libcxx/include/deque
index 2b5e60a889754..230bae75e6619 100644
--- a/libcxx/include/deque
+++ b/libcxx/include/deque
@@ -2600,7 +2600,7 @@ template <class _Tp, class _Allocator>
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
index a939b73546e3b..8ae8322ae1a63 100644
--- a/libcxx/include/experimental/memory_resource
+++ b/libcxx/include/experimental/memory_resource
@@ -95,7 +95,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
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 @@ public:
_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 @@ private:
_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
index 837f672e5ae5b..d30575e22a466 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -750,8 +750,8 @@ basic_filebuf<_CharT, _Traits>::underflow()
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
index ca3b5fde9bf47..273e4175e604b 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -1397,7 +1397,7 @@ template <class _Rp>
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 @@ template <class _Rp>
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 @@ template <class _Rp>
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 @@ template <class _Rp>
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
index 0ba7475ef32cb..6dcc676249352 100644
--- a/libcxx/include/list
+++ b/libcxx/include/list
@@ -764,10 +764,10 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
__is_nothrow_swappable<allocator_type>::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 @@ public:
_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 @@ template <class _Tp, class _Alloc>
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 @@ template <class _Tp, class _Alloc>
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 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
{
_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 @@ template <class _Tp, class _Alloc>
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
index ef7b3ea985f52..48339a23082f3 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -4010,8 +4010,8 @@ _LIBCPP_SUPPRESS_DEPRECATED_POP
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
index 6fb1d22570b41..6cc331c7b0507 100644
--- a/libcxx/include/map
+++ b/libcxx/include/map
@@ -1398,7 +1398,7 @@ public:
_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 @@ public:
_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<node_type>(
__hint.__i_, _VSTD::move(__nh));
@@ -1425,32 +1425,32 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __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 <class _Compare2>
_LIBCPP_INLINE_VISIBILITY
void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __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 <class _Compare2>
_LIBCPP_INLINE_VISIBILITY
void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __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 <class _Compare2>
_LIBCPP_INLINE_VISIBILITY
void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __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 @@ public:
_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<node_type>(
_VSTD::move(__nh));
@@ -2094,7 +2094,7 @@ public:
_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<node_type>(
__hint.__i_, _VSTD::move(__nh));
@@ -2114,32 +2114,32 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>& __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 <class _Compare2>
_LIBCPP_INLINE_VISIBILITY
void merge(multimap<key_type, mapped_type, _Compare2, allocator_type>&& __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 <class _Compare2>
_LIBCPP_INLINE_VISIBILITY
void merge(map<key_type, mapped_type, _Compare2, allocator_type>& __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 <class _Compare2>
_LIBCPP_INLINE_VISIBILITY
void merge(map<key_type, mapped_type, _Compare2, allocator_type>&& __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
index 18c47326c7882..17dd870bfe5d3 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -409,7 +409,7 @@ struct __optional_storage_base : __optional_destruct_base<_Tp>
_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 @@ struct __optional_storage_base<_Tp, true>
_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 @@ public:
add_pointer_t<value_type const>
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 @@ public:
add_pointer_t<value_type>
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 @@ public:
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 @@ public:
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 @@ public:
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 @@ public:
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
index d72c5e1c0be8d..fd364cbf5e7a8 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -5533,38 +5533,38 @@ public:
_LIBCPP_INLINE_VISIBILITY
diff erence_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
diff erence_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 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_i
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
index 49b351304506e..76489e896a056 100644
--- a/libcxx/include/set
+++ b/libcxx/include/set
@@ -781,7 +781,7 @@ public:
_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 @@ public:
_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<node_type>(
__hint, _VSTD::move(__nh));
@@ -808,7 +808,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(set<key_type, _Compare2, allocator_type>& __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 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(set<key_type, _Compare2, allocator_type>&& __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 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(multiset<key_type, _Compare2, allocator_type>& __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 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(multiset<key_type, _Compare2, allocator_type>&& __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 @@ public:
_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<node_type>(
_VSTD::move(__nh));
@@ -1337,7 +1337,7 @@ public:
_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<node_type>(
__hint, _VSTD::move(__nh));
@@ -1356,7 +1356,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(multiset<key_type, _Compare2, allocator_type>& __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 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(multiset<key_type, _Compare2, allocator_type>&& __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 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(set<key_type, _Compare2, allocator_type>& __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 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(set<key_type, _Compare2, allocator_type>&& __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
index 723cbf4f1d3f1..79aba599b163b 100644
--- a/libcxx/include/span
+++ b/libcxx/include/span
@@ -235,7 +235,7 @@ public:
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<element_type> _It, __span_compatible_sentinel_for<_It> _End>
@@ -244,8 +244,8 @@ public:
// [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 @@ public:
template <__span_compatible_range<element_type> _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<element_type> _OtherElementType>
@@ -274,7 +274,9 @@ public:
template <__span_array_convertible<element_type> _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 @@ public:
_LIBCPP_INLINE_VISIBILITY
constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
{
- _LIBCPP_ASSERT(__count <= size(), "span<T, N>::first(count): count out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size(), "span<T, N>::first(count): count out of range");
return {data(), __count};
}
_LIBCPP_INLINE_VISIBILITY
constexpr span<element_type, dynamic_extent> last(size_type __count) const noexcept
{
- _LIBCPP_ASSERT(__count <= size(), "span<T, N>::last(count): count out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size(), "span<T, N>::last(count): count out of range");
return {data() + size() - __count, __count};
}
@@ -326,10 +328,11 @@ public:
constexpr span<element_type, dynamic_extent>
subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
{
- _LIBCPP_ASSERT(__offset <= size(), "span<T, N>::subspan(offset, count): offset out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__offset <= size(), "span<T, N>::subspan(offset, count): offset out of range");
if (__count == dynamic_extent)
return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT(__count <= size() - __offset, "span<T, N>::subspan(offset, count): offset + count out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size() - __offset,
+ "span<T, N>::subspan(offset, count): offset + count out of range");
return {data() + __offset, __count};
}
@@ -339,19 +342,19 @@ public:
_LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
{
- _LIBCPP_ASSERT(__idx < size(), "span<T, N>::operator[](index): index out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__idx < size(), "span<T, N>::operator[](index): index out of range");
return __data_[__idx];
}
_LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
{
- _LIBCPP_ASSERT(!empty(), "span<T, N>::front() on empty span");
+ _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "span<T, N>::front() on empty span");
return __data_[0];
}
_LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
{
- _LIBCPP_ASSERT(!empty(), "span<T, N>::back() on empty span");
+ _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "span<T, N>::back() on empty span");
return __data_[size()-1];
}
@@ -421,7 +424,7 @@ public:
template <__span_compatible_iterator<element_type> _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 <size_t _Sz>
@@ -452,7 +455,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
constexpr span<element_type, _Count> first() const noexcept
{
- _LIBCPP_ASSERT(_Count <= size(), "span<T>::first<Count>(): Count out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(_Count <= size(), "span<T>::first<Count>(): Count out of range");
return span<element_type, _Count>{data(), _Count};
}
@@ -460,21 +463,21 @@ public:
_LIBCPP_INLINE_VISIBILITY
constexpr span<element_type, _Count> last() const noexcept
{
- _LIBCPP_ASSERT(_Count <= size(), "span<T>::last<Count>(): Count out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(_Count <= size(), "span<T>::last<Count>(): Count out of range");
return span<element_type, _Count>{data() + size() - _Count, _Count};
}
_LIBCPP_INLINE_VISIBILITY
constexpr span<element_type, dynamic_extent> first(size_type __count) const noexcept
{
- _LIBCPP_ASSERT(__count <= size(), "span<T>::first(count): count out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size(), "span<T>::first(count): count out of range");
return {data(), __count};
}
_LIBCPP_INLINE_VISIBILITY
constexpr span<element_type, dynamic_extent> last (size_type __count) const noexcept
{
- _LIBCPP_ASSERT(__count <= size(), "span<T>::last(count): count out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size(), "span<T>::last(count): count out of range");
return {data() + size() - __count, __count};
}
@@ -482,8 +485,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
constexpr span<element_type, _Count> subspan() const noexcept
{
- _LIBCPP_ASSERT(_Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset out of range");
- _LIBCPP_ASSERT(_Count == dynamic_extent || _Count <= size() - _Offset, "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(_Offset <= size(), "span<T>::subspan<Offset, Count>(): Offset out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(_Count == dynamic_extent || _Count <= size() - _Offset,
+ "span<T>::subspan<Offset, Count>(): Offset + Count out of range");
return span<element_type, _Count>{data() + _Offset, _Count == dynamic_extent ? size() - _Offset : _Count};
}
@@ -491,10 +495,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
subspan(size_type __offset, size_type __count = dynamic_extent) const noexcept
{
- _LIBCPP_ASSERT(__offset <= size(), "span<T>::subspan(offset, count): offset out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__offset <= size(), "span<T>::subspan(offset, count): offset out of range");
if (__count == dynamic_extent)
return {data() + __offset, size() - __offset};
- _LIBCPP_ASSERT(__count <= size() - __offset, "span<T>::subspan(offset, count): offset + count out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__count <= size() - __offset,
+ "span<T>::subspan(offset, count): offset + count out of range");
return {data() + __offset, __count};
}
@@ -504,19 +509,19 @@ public:
_LIBCPP_INLINE_VISIBILITY constexpr reference operator[](size_type __idx) const noexcept
{
- _LIBCPP_ASSERT(__idx < size(), "span<T>::operator[](index): index out of range");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__idx < size(), "span<T>::operator[](index): index out of range");
return __data_[__idx];
}
_LIBCPP_INLINE_VISIBILITY constexpr reference front() const noexcept
{
- _LIBCPP_ASSERT(!empty(), "span<T>::front() on empty span");
+ _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "span<T>::front() on empty span");
return __data_[0];
}
_LIBCPP_INLINE_VISIBILITY constexpr reference back() const noexcept
{
- _LIBCPP_ASSERT(!empty(), "span<T>::back() on empty span");
+ _LIBCPP_ASSERT_UNCATEGORIZED(!empty(), "span<T>::back() on empty span");
return __data_[size()-1];
}
diff --git a/libcxx/include/string b/libcxx/include/string
index 70dbce2aaa2e5..b92cd5d732c34 100644
--- a/libcxx/include/string
+++ b/libcxx/include/string
@@ -911,7 +911,7 @@ public:
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 @@ public:
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 @@ public:
_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 @@ public:
_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 @@ public:
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 @@ public:
_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 @@ private:
_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 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
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 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
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 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
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 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
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 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
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 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
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>&
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 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
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 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
"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<size_type>(__pos - __b);
erase(__r, 1);
@@ -3080,7 +3083,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i
"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<size_type>(__first - __b);
erase(__r, static_cast<size_type>(__last - __first));
@@ -3092,7 +3095,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20
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 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
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 @@ basic_string<_CharT, _Traits, _Allocator>::find(const value_type* __s,
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3341,7 +3344,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3365,7 +3368,7 @@ basic_string<_CharT, _Traits, _Allocator>::rfind(const value_type* __s,
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3397,7 +3400,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3421,7 +3424,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_of(const value_type* __s,
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3453,7 +3456,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3476,7 +3479,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_of(const value_type* __s,
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3508,7 +3511,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3531,7 +3534,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const value_type* _
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3563,7 +3566,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3587,7 +3590,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const value_type* __
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -3619,7 +3622,7 @@ typename basic_string<_CharT, _Traits, _Allocator>::size_type
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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -3671,7 +3674,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
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 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20
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 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
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 @@ operator==(const _CharT* __lhs,
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 @@ operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
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
index a7d04ca9845be..7d0edb8fca424 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -261,7 +261,9 @@ template <class _Traits>
_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<class _CharT, class _Traits>
@@ -307,8 +309,11 @@ public:
: __data_(__s), __size_(__len)
{
#if _LIBCPP_STD_VER >= 14
- _LIBCPP_ASSERT(__len <= static_cast<size_type>(numeric_limits<
diff erence_type>::max()), "string_view::string_view(_CharT *, size_t): length does not fit in
diff erence_type");
- _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr");
+ _LIBCPP_ASSERT_UNCATEGORIZED(
+ __len <= static_cast<size_type>(numeric_limits<
diff erence_type>::max()),
+ "string_view::string_view(_CharT *, size_t): length does not fit in
diff erence_type");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__len == 0 || __s != nullptr,
+ "string_view::string_view(_CharT *, size_t): received nullptr");
#endif
}
@@ -318,7 +323,8 @@ public:
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 @@ public:
// [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 @@ public:
_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 @@ public:
_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 @@ public:
_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 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
@@ -530,7 +536,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -538,7 +544,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -547,7 +553,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
@@ -562,7 +568,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -570,7 +576,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -579,7 +585,8 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
@@ -591,7 +598,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -599,7 +606,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -608,7 +615,8 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
@@ -620,7 +628,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -628,7 +636,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -637,7 +645,8 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
@@ -652,7 +661,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -660,7 +669,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
@@ -669,7 +678,8 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s.data(), __pos, __s.size());
}
@@ -684,7 +694,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, __n);
}
@@ -692,7 +702,7 @@ public:
_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<value_type, size_type, traits_type, npos>
(data(), size(), __s, __pos, traits_type::length(__s));
}
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index a162dea0767ab..c8305a5a85d6e 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -1374,7 +1374,7 @@ public:
_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 @@ public:
_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<node_type>(
__hint.__i_, _VSTD::move(__nh));
@@ -1403,32 +1403,32 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __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 <class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __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 <class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __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 <class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __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 @@ private:
_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<node_type>(
_VSTD::move(__nh));
@@ -2173,7 +2173,7 @@ private:
_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<node_type>(
__hint.__i_, _VSTD::move(__nh));
@@ -2194,32 +2194,32 @@ private:
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>& __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 <class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_multimap<key_type, mapped_type, _H2, _P2, allocator_type>&& __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 <class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>& __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 <class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_map<key_type, mapped_type, _H2, _P2, allocator_type>&& __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
index 21fb8d7bdfede..883b4bf759ad5 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -716,7 +716,7 @@ public:
_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 @@ public:
_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<node_type>(
__h, _VSTD::move(__nh));
@@ -744,32 +744,32 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __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<class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __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<class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __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<class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __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 @@ public:
_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<node_type>(
_VSTD::move(__nh));
@@ -1355,7 +1355,7 @@ public:
_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<node_type>(
__hint, _VSTD::move(__nh));
@@ -1376,32 +1376,32 @@ public:
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>& __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 <class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_multiset<key_type, _H2, _P2, allocator_type>&& __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 <class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_set<key_type, _H2, _P2, allocator_type>& __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 <class _H2, class _P2>
_LIBCPP_INLINE_VISIBILITY
void merge(unordered_set<key_type, _H2, _P2, allocator_type>&& __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
index d636dd68e6ab3..d4e1ec405b18a 100644
--- a/libcxx/include/vector
+++ b/libcxx/include/vector
@@ -625,22 +625,22 @@ public:
_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 @@ inline _LIBCPP_HIDE_FROM_ABI
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 @@ inline _LIBCPP_HIDE_FROM_ABI
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 @@ inline
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 @@ vector<_Tp, _Allocator>::erase(const_iterator __position)
{
_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");
diff erence_type __ps = __position - cbegin();
pointer __p = this->__begin_ + __ps;
@@ -1755,7 +1755,7 @@ vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last)
_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 @@ vector<_Tp, _Allocator>::swap(vector& __x)
__is_nothrow_swappable<allocator_type>::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 <class _Allocator>
template <class _ForwardIterator, class _Sentinel>
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
void vector<bool, _Allocator>::__assign_with_size(_ForwardIterator __first, _Sentinel __last,
diff erence_type __ns) {
- _LIBCPP_ASSERT(__ns >= 0, "invalid range specified");
+ _LIBCPP_ASSERT_UNCATEGORIZED(__ns >= 0, "invalid range specified");
clear();
@@ -3277,7 +3277,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI
typename vector<bool, _Allocator>::iterator
vector<bool, _Allocator>::__insert_with_size(const_iterator __position, _ForwardIterator __first, _Sentinel __last,
diff erence_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<size_type>(__n_signed);
iterator __r;
size_type __c = capacity();
diff --git a/libcxx/src/filesystem/directory_iterator.cpp b/libcxx/src/filesystem/directory_iterator.cpp
index 4a7e01b09655f..151fb2fb621af 100644
--- a/libcxx/src/filesystem/directory_iterator.cpp
+++ b/libcxx/src/filesystem/directory_iterator.cpp
@@ -192,7 +192,7 @@ directory_iterator::directory_iterator(const path& p, error_code* ec,
}
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<void> err("directory_iterator::operator++()", ec);
error_code m_ec;
@@ -206,7 +206,7 @@ directory_iterator& directory_iterator::__increment(error_code* ec) {
}
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 @@ recursive_directory_iterator::recursive_directory_iterator(
}
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
index 4bfcbcd985c29..965e0eadcd0dc 100644
--- a/libcxx/src/filesystem/error.h
+++ b/libcxx/src/filesystem/error.h
@@ -99,7 +99,7 @@ inline errc __win_err_to_errc(int err) {
#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
index 84d4ada93be51..215d42421b2a0 100644
--- a/libcxx/src/filesystem/format_string.h
+++ b/libcxx/src/filesystem/format_string.h
@@ -47,7 +47,7 @@ inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 0) string vformat_string(const ch
size_t size_with_null = static_cast<size_t>(ret) + 1;
result.__resize_default_init(size_with_null - 1);
ret = ::vsnprintf(&result[0], size_with_null, msg, ap);
- _LIBCPP_ASSERT(static_cast<size_t>(ret) == (size_with_null - 1), "TODO");
+ _LIBCPP_ASSERT_UNCATEGORIZED(static_cast<size_t>(ret) == (size_with_null - 1), "TODO");
}
return result;
}
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index 971783307a53d..63a119aa983e3 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -479,7 +479,7 @@ path __current_path(error_code* ec) {
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<path::value_type[]>(new path::value_type[size + 1]);
path::value_type* ptr = buff.get();
@@ -627,7 +627,7 @@ void __permissions(const path& p, perms prms, perm_options opts,
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 @@ void __permissions(const path& p, perms prms, perm_options opts,
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 @@ path __read_symlink(const path& p, error_code* ec) {
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<size_t>(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
index 57e4eb36204da..58bfa02430893 100644
--- a/libcxx/src/filesystem/posix_compat.h
+++ b/libcxx/src/filesystem/posix_compat.h
@@ -385,7 +385,7 @@ inline wchar_t *getcwd(wchar_t *buff, size_t size) { return _wgetcwd(buff, size)
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
index 4503e6d35ac2c..23cb7d3b773bd 100644
--- a/libcxx/src/include/ryu/common.h
+++ b/libcxx/src/include/ryu/common.h
@@ -52,7 +52,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// 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 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// 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<int32_t>(((static_cast<uint32_t>(__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<uint32_t>(__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<uint32_t>(__e) * 732923) >> 20;
}
diff --git a/libcxx/src/include/ryu/d2s_intrinsics.h b/libcxx/src/include/ryu/d2s_intrinsics.h
index 762763f9b92cf..7697c32ff6e93 100644
--- a/libcxx/src/include/ryu/d2s_intrinsics.h
+++ b/libcxx/src/include/ryu/d2s_intrinsics.h
@@ -63,7 +63,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// (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<unsigned char>(__dist));
}
@@ -85,7 +85,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// (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 @@ _LIBCPP_BEGIN_NAMESPACE_STD
[[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<uint32_t>(__lo >> 32) >> (__dist - 32));
#endif // ^^^ 32-bit ^^^
}
@@ -227,7 +227,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
[[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<uint32_t>(__value) - 5 * static_cast<uint32_t>(__q);
if (__r != 0) {
@@ -247,8 +247,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// 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
index b99d790f65c79..e2409338b9d1d 100644
--- a/libcxx/src/include/to_chars_floating_point.h
+++ b/libcxx/src/include/to_chars_floating_point.h
@@ -269,7 +269,7 @@ to_chars_result _Floating_to_chars_hex_precision(
// * Print the leading hexit, then mask it away.
{
const uint32_t _Nibble = static_cast<uint32_t>(_Adjusted_mantissa >> _Adjusted_explicit_bits);
- _LIBCPP_ASSERT(_Nibble < 3, "");
+ _LIBCPP_ASSERT_UNCATEGORIZED(_Nibble < 3, "");
const char _Leading_hexit = static_cast<char>('0' + _Nibble);
*_First++ = _Leading_hexit;
@@ -288,12 +288,12 @@ to_chars_result _Floating_to_chars_hex_precision(
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<uint32_t>(_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 @@ to_chars_result _Floating_to_chars_hex_shortest(
// '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<uint32_t>(_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 @@ to_chars_result _Floating_to_chars_general_precision(
_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 @@ to_chars_result _Floating_to_chars(
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
index 7f7127746130e..3a80b84efae44 100644
--- a/libcxx/src/memory_resource.cpp
+++ b/libcxx/src/memory_resource.cpp
@@ -175,7 +175,7 @@ void* unsynchronized_pool_resource::__adhoc_pool::__do_allocate(memory_resource*
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 @@ void unsynchronized_pool_resource::__adhoc_pool::__do_deallocate(
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 @@ class unsynchronized_pool_resource::__fixed_pool {
}
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 @@ void unsynchronized_pool_resource::do_deallocate(void* p, size_t bytes, size_t a
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
index 9469dcf6c4560..0cb5d0c4517ff 100644
--- a/libcxx/src/mutex.cpp
+++ b/libcxx/src/mutex.cpp
@@ -46,7 +46,7 @@ mutex::unlock() noexcept
{
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 @@ recursive_mutex::~recursive_mutex()
{
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 @@ recursive_mutex::unlock() noexcept
{
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
index e03f1a7707a3e..3ae515d1dcccb 100644
--- a/libcxx/src/ryu/d2fixed.cpp
+++ b/libcxx/src/ryu/d2fixed.cpp
@@ -102,8 +102,8 @@ inline constexpr int __POW10_ADDITIONAL_BITS = 120;
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<uint32_t>(__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
index ede260713ddf8..86d0b61848be7 100644
--- a/libcxx/src/ryu/d2s.cpp
+++ b/libcxx/src/ryu/d2s.cpp
@@ -154,7 +154,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// 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
index db93a48656a6a..7470dc63d748e 100644
--- a/libcxx/src/ryu/f2s.cpp
+++ b/libcxx/src/ryu/f2s.cpp
@@ -86,7 +86,7 @@ inline constexpr uint64_t __FLOAT_POW5_SPLIT[47] = {
[[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 @@ inline constexpr uint64_t __FLOAT_POW5_SPLIT[47] = {
// 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 @@ inline constexpr uint64_t __FLOAT_POW5_SPLIT[47] = {
#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<uint32_t>(__shiftedSum);
#endif // ^^^ 64-bit ^^^
}
@@ -309,8 +309,8 @@ struct __floating_decimal_32 {
// 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 @@ struct __floating_decimal_32 {
// _Maxidx is the index of the most significant nonzero element.
uint32_t _Maxidx = ((24 + static_cast<uint32_t>(_Exponent2) + 31) / 32) - 1;
- _LIBCPP_ASSERT(_Maxidx < _Data_size, "");
+ _LIBCPP_ASSERT_UNCATEGORIZED(_Maxidx < _Data_size, "");
const uint32_t _Bit_shift = static_cast<uint32_t>(_Exponent2) % 32;
if (_Bit_shift <= 8) { // _Mantissa2's 24 bits don't cross an element boundary
@@ -388,9 +388,9 @@ struct __floating_decimal_32 {
}
}
- _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
index b18dcceb37c0d..01313e68181bc 100644
--- a/libcxx/src/string.cpp
+++ b/libcxx/src/string.cpp
@@ -357,7 +357,7 @@ S i_to_string(V v) {
constexpr size_t bufsize = numeric_limits<V>::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
index 87c235a97a29c..bc56cafa8f803 100644
--- a/libcxx/src/strstream.cpp
+++ b/libcxx/src/strstream.cpp
@@ -173,7 +173,7 @@ strstreambuf::overflow(int_type __c)
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<size_t>(old_size));
}
ptr
diff _t ninp = gptr() - eback();
diff --git a/libcxx/src/support/ibm/xlocale_zos.cpp b/libcxx/src/support/ibm/xlocale_zos.cpp
index a3f9558a0611f..034a5b966052b 100644
--- a/libcxx/src/support/ibm/xlocale_zos.cpp
+++ b/libcxx/src/support/ibm/xlocale_zos.cpp
@@ -111,7 +111,7 @@ locale_t uselocale(locale_t newloc) {
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
index 190abfd703ab2..1502c7de6ba55 100644
--- a/libcxx/src/system_error.cpp
+++ b/libcxx/src/system_error.cpp
@@ -103,7 +103,7 @@ handle_strerror_r_return(int strerror_return, char *buffer) {
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();
More information about the libcxx-commits
mailing list