[upstream_utils] Remove patch that results in building with NDEBUG causing ODR issues (#8539)

Semiwrap / meson / robotpy define `NDEBUG` when building their software
in all modes, while `allwplib` only does it when building debug. This
causes the size of `DenseMap` to differ between the shared libraries
built here, and the extension modules built in `mostrobotpy`, causing
segfaults when you try to execute code that uses `DenseMap`. This is not
a problem with the robotpy code in `allwpilib`, because bazel uses the
exact same compiler flags when building the shared libraries and
pybind11 extensions.
This commit is contained in:
PJ Reiniger
2026-01-03 16:32:16 -05:00
committed by GitHub
parent 5a3f2ce13a
commit 32cd2ddf8e
37 changed files with 36 additions and 58 deletions

View File

@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tyler Veness <calcmogul@gmail.com>
Date: Tue, 18 Jun 2024 09:07:33 -0700
Subject: [PATCH 33/35] Add SmallVector erase_if()
---
llvm/include/llvm/ADT/SmallVector.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index b8981ab67322f7888ad63d953ba72dbfa53b2939..9a22c95aaf84d276b1c097c0997de3e6b04ea05e 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -1315,6 +1315,14 @@ template <typename Out, typename R> SmallVector<Out> to_vector_of(R &&Range) {
return {std::begin(Range), std::end(Range)};
}
+template <typename T, typename Pred>
+typename SmallVectorImpl<T>::size_type erase_if(
+ SmallVectorImpl<T>& c, Pred pred) {
+ const auto original_size = c.size();
+ c.erase(std::remove_if(c.begin(), c.end(), pred), c.end());
+ return original_size - c.size();
+}
+
} // end namespace llvm
namespace std {