From 68b18f309e743f8824c93616800ddaab64bba9e8 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Wed, 14 Feb 2024 16:26:06 -0800 Subject: [PATCH] Remove unused variables in mapillary/opensfm/opensfm/src/foundation/newton_raphson.h Summary: LLVM-15 has a warning `-Wunused-but-set-variable` which we treat as an error because it's so often diagnostic of a code issue. Unused variables can compromise readability or, worse, performance. This diff either (a) removes an unused variable and, possibly, it's associated code, or (b) qualifies the variable with `[[maybe_unused]]`, mostly in cases where the variable _is_ used, but, eg, in an `assert` statement that isn't present in production code. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: palmje Differential Revision: D53779594 fbshipit-source-id: a22fbbc945140165686a74c9d0c921983ca54451 --- opensfm/src/foundation/newton_raphson.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/opensfm/src/foundation/newton_raphson.h b/opensfm/src/foundation/newton_raphson.h index 47db76d5f..63b44e976 100644 --- a/opensfm/src/foundation/newton_raphson.h +++ b/opensfm/src/foundation/newton_raphson.h @@ -44,7 +44,6 @@ template struct FiniteDiff { static typename TypeTraits<1, 1>::Jacobian Derivative( const F& func, typename TypeTraits<1, 1>::Values& x) { - typename TypeTraits<1, 1>::Jacobian jacobian; constexpr auto eps = 1e-15; return (func(x + eps) - func(x)) / eps; } @@ -77,7 +76,6 @@ template > typename TypeTraits::Values NewtonRaphson( const F& func, const typename TypeTraits::Values& initial_value, int iterations, double tol = 1e-6) { - constexpr auto eps = std::numeric_limits::epsilon(); auto current_value = initial_value; for (int i = 0; i < iterations; ++i) { const auto at_current_value = func(current_value);