[libcxx-commits] [libcxx] 0f622bd - [libc++] Don't manually override NDEBUG in the dylib build
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Mar 9 07:05:50 PST 2022
Author: Louis Dionne
Date: 2022-03-09T10:05:38-05:00
New Revision: 0f622bd281bda627cb988024bb1d86768d411e01
URL: https://github.com/llvm/llvm-project/commit/0f622bd281bda627cb988024bb1d86768d411e01
DIFF: https://github.com/llvm/llvm-project/commit/0f622bd281bda627cb988024bb1d86768d411e01.diff
LOG: [libc++] Don't manually override NDEBUG in the dylib build
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.
Differential Revision: https://reviews.llvm.org/D121244
Added:
Modified:
libcxx/CMakeLists.txt
libcxx/benchmarks/algorithms.bench.cpp
Removed:
################################################################################
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index df7a63053a845..d4864a7eb7a96 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -675,8 +675,6 @@ if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXX_ENABLE_SHARED)
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)
diff --git a/libcxx/benchmarks/algorithms.bench.cpp b/libcxx/benchmarks/algorithms.bench.cpp
index e5dd37f06e6e5..b3724ecf23adb 100644
--- a/libcxx/benchmarks/algorithms.bench.cpp
+++ b/libcxx/benchmarks/algorithms.bench.cpp
@@ -151,7 +151,6 @@ void fillValues(std::vector<std::string>& V, size_t N, Order O) {
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;
More information about the libcxx-commits
mailing list