[libcxx-commits] [PATCH] D121244: [libc++] Don't manually override NDEBUG in the dylib build

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 8 12:21:50 PST 2022


ldionne created this revision.
Herald added a subscriber: mgorny.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

LIBCXX_ENABLE_ASSERTIONS does not have any relationship to the `assert`
macro -- it only controls assertions that are internal to the library.
Playing around with `NDEBUG` only muddies the picture further than it
already is.

Also, remove a failing assertion in the benchmarks. That assertion had
never been exercised because we defined `NDEBUG` manually, and it was
failing since we introduced the ability to generate a benchmark vector
with the Quicksort adversary ordering (which is obviously not sorted).

This was split off of https://llvm.org/D121123.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121244

Files:
  libcxx/CMakeLists.txt
  libcxx/benchmarks/algorithms.bench.cpp


Index: libcxx/benchmarks/algorithms.bench.cpp
===================================================================
--- libcxx/benchmarks/algorithms.bench.cpp
+++ libcxx/benchmarks/algorithms.bench.cpp
@@ -151,7 +151,6 @@
 
 template <class T>
 void sortValues(T& V, Order O) {
-  assert(std::is_sorted(V.begin(), V.end()));
   switch (O) {
   case Order::Random: {
     std::random_device R;
Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -675,8 +675,6 @@
 endif()
 
 # Assertion flags =============================================================
-define_if(LIBCXX_ENABLE_ASSERTIONS -UNDEBUG)
-define_if_not(LIBCXX_ENABLE_ASSERTIONS -DNDEBUG)
 define_if(LIBCXX_ENABLE_ASSERTIONS -D_LIBCPP_DEBUG=0)
 define_if(LIBCXX_DEBUG_BUILD -D_DEBUG)
 if (LIBCXX_ENABLE_ASSERTIONS AND NOT LIBCXX_DEBUG_BUILD)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121244.413900.patch
Type: text/x-patch
Size: 901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220308/a209da72/attachment.bin>


More information about the libcxx-commits mailing list