From 39d482ccebffc286ef80219c6bb8577452da10cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 5 Dec 2021 15:22:55 +0100 Subject: [PATCH] Math: fix Clang "unused but set" warnings in benchmarks. --- src/Magnum/Math/Test/FunctionsBenchmark.cpp | 8 ++++++++ src/Magnum/Math/Test/InterpolationBenchmark.cpp | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/Magnum/Math/Test/FunctionsBenchmark.cpp b/src/Magnum/Math/Test/FunctionsBenchmark.cpp index 24eb38aad..cd59e4908 100644 --- a/src/Magnum/Math/Test/FunctionsBenchmark.cpp +++ b/src/Magnum/Math/Test/FunctionsBenchmark.cpp @@ -201,6 +201,10 @@ void FunctionsBenchmark::sinCosSeparate() { } CORRADE_COMPARE_AS(a, 10.0f, Corrade::TestSuite::Compare::Greater); + + /* To avoid the whole loop being optimized away */ + CORRADE_VERIFY(sin == sin); + CORRADE_VERIFY(cos == cos); } void FunctionsBenchmark::sinCosCombined() { @@ -213,6 +217,10 @@ void FunctionsBenchmark::sinCosCombined() { } CORRADE_COMPARE_AS(a, 10.0f, Corrade::TestSuite::Compare::Greater); + + /* To avoid the whole loop being optimized away */ + CORRADE_VERIFY(sin == sin); + CORRADE_VERIFY(cos == cos); } diff --git a/src/Magnum/Math/Test/InterpolationBenchmark.cpp b/src/Magnum/Math/Test/InterpolationBenchmark.cpp index 024404837..442bc9826 100644 --- a/src/Magnum/Math/Test/InterpolationBenchmark.cpp +++ b/src/Magnum/Math/Test/InterpolationBenchmark.cpp @@ -70,6 +70,9 @@ void InterpolationBenchmark::baseline() { } CORRADE_VERIFY(!c.isNormalized()); + + /* To avoid "unused but set" warnings */ + CORRADE_VERIFY(t == t); } void InterpolationBenchmark::quaternionLerp() {