From 1ee414feb025d88deed810ffb8f07b10326fa056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 19 Feb 2024 17:14:49 +0100 Subject: [PATCH] Cleanup: avoid compiler warning when USE_BRUTE_FORCE_ASSERT is undefined Avoid 'unused variable' compiler warning when `USE_BRUTE_FORCE_ASSERT` is not defined, in release mode builds. No functional changes. --- source/blender/blenlib/intern/convexhull_2d.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/blender/blenlib/intern/convexhull_2d.cc b/source/blender/blenlib/intern/convexhull_2d.cc index 13e8fe2abf7..9f00245cd5a 100644 --- a/source/blender/blenlib/intern/convexhull_2d.cc +++ b/source/blender/blenlib/intern/convexhull_2d.cc @@ -232,6 +232,7 @@ int BLI_convexhull_2d(const float (*points)[2], const int points_num, int r_poin /** \name Comupte AABB Fitting Angle (For Assertion) * \{ */ +#if defined(USE_BRUTE_FORCE_ASSERT) && !defined(NDEBUG) static float convexhull_aabb_fit_hull_2d_brute_force(const float (*points_hull)[2], int points_hull_num) { @@ -275,6 +276,7 @@ static float convexhull_aabb_fit_hull_2d_brute_force(const float (*points_hull)[ return (area_best != FLT_MAX) ? float(atan2(sincos_best[0], sincos_best[1])) : 0.0f; } +#endif /** \} */ @@ -401,16 +403,13 @@ static float convexhull_aabb_fit_hull_2d(const float (*points_hull)[2], int poin const float angle = (area_best != FLT_MAX) ? float(atan2(sincos_best[0], sincos_best[1])) : 0.0f; -#ifdef USE_BRUTE_FORCE_ASSERT - if (true) -#else - if (false) -#endif +#if defined(USE_BRUTE_FORCE_ASSERT) && !defined(NDEBUG) { /* Ensure the optimized result matches the brute-force version. */ const float angle_test = convexhull_aabb_fit_hull_2d_brute_force(points_hull, points_hull_num); BLI_assert(angle == angle_test); } +#endif return angle; }