[libcxx-commits] [PATCH] D125634: [libc++] Use _LIBCPP_ASSERT by default for _PSTL_ASSERTions

Jonathan Wakely via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 19 12:03:53 PDT 2022


jwakely added inline comments.


================
Comment at: pstl/include/pstl/internal/pstl_config.h:33-34
+#    define _PSTL_ASSERT(pred) _LIBCPP_ASSERT(pred, "")
+#elif defined(__GLIBCXX__)
+#    define _PSTL_ASSERT(pred) __glibcxx_assert(pred)
+#else
----------------
ldionne wrote:
> @jwakely @rodgert We'd like to remove `_PSTL_ASSERT` as a customization point and define it explicitly here instead, are you OK with that?
Makes sense to me in principle, although I think `__glibcxx_assert` is the wrong definition (even though that's what we use today).

I see several assertions in `parallel_backend_tbb.h` like `_PSTL_ASSERT(std::is_sorted(_M_x_beg + _M_xs, _M_x_beg + _M_xe, _M_comp));` which changes the complexity guarantees of the algo. That's not appropriate for `__glibcxx_assert`, but would be appropriate for the more heavyweight `_GLIBCXX_DEBUG_ASSERT`.

Maybe that should be fixed as a separate issue, as I assume that isn't appropriate for libc++ either.

We could introduce `_PSTL_DEBUG_ASSERT` for the more expensive assertions, and map that to `_LIBCPP_DEBUG_ASSERT` or `_GLIBCXX_DEBUG_ASSERT`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125634/new/

https://reviews.llvm.org/D125634



More information about the libcxx-commits mailing list