From f53c6813d5f4d23c2a4c6f12cf881cdc493e34d5 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Fri, 28 Apr 2023 20:51:22 -0700 Subject: [PATCH] [wpimath] Patch Eigen warnings (#5290) --- ...ix-warnings-Wunused-but-set-variable.patch | 68 +++++++++++++++++++ upstream_utils/update_eigen.py | 6 +- .../Eigen/src/SparseCore/TriangularSolver.h | 4 +- .../src/SparseLU/SparseLU_heap_relax_snode.h | 5 -- 4 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 upstream_utils/eigen_patches/0003-Eigen-Sparse-fix-warnings-Wunused-but-set-variable.patch diff --git a/upstream_utils/eigen_patches/0003-Eigen-Sparse-fix-warnings-Wunused-but-set-variable.patch b/upstream_utils/eigen_patches/0003-Eigen-Sparse-fix-warnings-Wunused-but-set-variable.patch new file mode 100644 index 0000000000..f16a38f4b9 --- /dev/null +++ b/upstream_utils/eigen_patches/0003-Eigen-Sparse-fix-warnings-Wunused-but-set-variable.patch @@ -0,0 +1,68 @@ +From 7846c7387c1cb09cef7329630012ea1aefe64cf9 Mon Sep 17 00:00:00 2001 +From: Laurent Rineau +Date: Tue, 11 Oct 2022 17:37:04 +0000 +Subject: [PATCH] Eigen/Sparse: fix warnings -Wunused-but-set-variable + +--- + Eigen/src/SparseCore/TriangularSolver.h | 4 ++-- + Eigen/src/SparseLU/SparseLU_heap_relax_snode.h | 5 ----- + 2 files changed, 2 insertions(+), 7 deletions(-) + +diff --git a/Eigen/src/SparseCore/TriangularSolver.h b/Eigen/src/SparseCore/TriangularSolver.h +index 79c867c25..a9fbeebc1 100644 +--- a/Eigen/src/SparseCore/TriangularSolver.h ++++ b/Eigen/src/SparseCore/TriangularSolver.h +@@ -272,11 +272,11 @@ struct sparse_solve_triangular_sparse_selector + } + + +- Index count = 0; ++// Index count = 0; + // FIXME compute a reference value to filter zeros + for (typename AmbiVector::Iterator it(tempVector/*,1e-12*/); it; ++it) + { +- ++ count; ++// ++ count; + // std::cerr << "fill " << it.index() << ", " << col << "\n"; + // std::cout << it.value() << " "; + // FIXME use insertBack +diff --git a/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h b/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +index 7bed85de5..2a8d80b24 100644 +--- a/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h ++++ b/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +@@ -77,8 +77,6 @@ void SparseLUImpl::heap_relax_snode (const Index n, IndexVe + // Identify the relaxed supernodes by postorder traversal of the etree + Index snode_start; // beginning of a snode + StorageIndex k; +- Index nsuper_et_post = 0; // Number of relaxed snodes in postordered etree +- Index nsuper_et = 0; // Number of relaxed snodes in the original etree + StorageIndex l; + for (j = 0; j < n; ) + { +@@ -90,7 +88,6 @@ void SparseLUImpl::heap_relax_snode (const Index n, IndexVe + parent = et(j); + } + // Found a supernode in postordered etree, j is the last column +- ++nsuper_et_post; + k = StorageIndex(n); + for (Index i = snode_start; i <= j; ++i) + k = (std::min)(k, inv_post(i)); +@@ -99,7 +96,6 @@ void SparseLUImpl::heap_relax_snode (const Index n, IndexVe + { + // This is also a supernode in the original etree + relax_end(k) = l; // Record last column +- ++nsuper_et; + } + else + { +@@ -109,7 +105,6 @@ void SparseLUImpl::heap_relax_snode (const Index n, IndexVe + if (descendants(i) == 0) + { + relax_end(l) = l; +- ++nsuper_et; + } + } + } +-- +2.40.0 + diff --git a/upstream_utils/update_eigen.py b/upstream_utils/update_eigen.py index 96ebc002fe..66b4b4c7d4 100755 --- a/upstream_utils/update_eigen.py +++ b/upstream_utils/update_eigen.py @@ -105,7 +105,11 @@ def main(): # Apply patches to upstream Git repo os.chdir(upstream_root) - for f in ["0001-Disable-warnings.patch", "0002-Intellisense-fix.patch"]: + for f in [ + "0001-Disable-warnings.patch", + "0002-Intellisense-fix.patch", + "0003-Eigen-Sparse-fix-warnings-Wunused-but-set-variable.patch", + ]: git_am(os.path.join(wpilib_root, "upstream_utils/eigen_patches", f)) # Delete old install diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseCore/TriangularSolver.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseCore/TriangularSolver.h index f9c56ba798..7cb2c2665f 100644 --- a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseCore/TriangularSolver.h +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseCore/TriangularSolver.h @@ -270,11 +270,11 @@ struct sparse_solve_triangular_sparse_selector } - Index count = 0; +// Index count = 0; // FIXME compute a reference value to filter zeros for (typename AmbiVector::Iterator it(tempVector/*,1e-12*/); it; ++it) { - ++ count; +// ++ count; // std::cerr << "fill " << it.index() << ", " << col << "\n"; // std::cout << it.value() << " "; // FIXME use insertBack diff --git a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h index 6f75d500e5..7aecbcad8e 100644 --- a/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +++ b/wpimath/src/main/native/thirdparty/eigen/include/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h @@ -75,8 +75,6 @@ void SparseLUImpl::heap_relax_snode (const Index n, IndexVe // Identify the relaxed supernodes by postorder traversal of the etree Index snode_start; // beginning of a snode StorageIndex k; - Index nsuper_et_post = 0; // Number of relaxed snodes in postordered etree - Index nsuper_et = 0; // Number of relaxed snodes in the original etree StorageIndex l; for (j = 0; j < n; ) { @@ -88,7 +86,6 @@ void SparseLUImpl::heap_relax_snode (const Index n, IndexVe parent = et(j); } // Found a supernode in postordered etree, j is the last column - ++nsuper_et_post; k = StorageIndex(n); for (Index i = snode_start; i <= j; ++i) k = (std::min)(k, inv_post(i)); @@ -97,7 +94,6 @@ void SparseLUImpl::heap_relax_snode (const Index n, IndexVe { // This is also a supernode in the original etree relax_end(k) = l; // Record last column - ++nsuper_et; } else { @@ -107,7 +103,6 @@ void SparseLUImpl::heap_relax_snode (const Index n, IndexVe if (descendants(i) == 0) { relax_end(l) = l; - ++nsuper_et; } } }