From da5ab2b2c97ec2c284d035ef480099e8304f7479 Mon Sep 17 00:00:00 2001 From: elsid Date: Sun, 18 Feb 2024 14:22:07 +0100 Subject: [PATCH] Fix benchmark warning: -Wdeprecated-declarations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /home/elsid/dev/openmw/apps/benchmarks/detournavigator/navmeshtilescache.cpp: In function ‘void {anonymous}::getFromFilledCache(benchmark::State&)’: /home/elsid/dev/openmw/apps/benchmarks/detournavigator/navmeshtilescache.cpp:186:37: warning: ‘typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type benchmark::DoNotOptimize(const Tp&) [with Tp = DetourNavigator::NavMeshTilesCache::Value; typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type = void]’ is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Wdeprecated-declarations] 186 | benchmark::DoNotOptimize(result); | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ In file included from /home/elsid/dev/openmw/apps/benchmarks/detournavigator/navmeshtilescache.cpp:1: /home/elsid/dev/benchmark/build/gcc/release/install/include/benchmark/benchmark.h:507:5: note: declared here 507 | DoNotOptimize(Tp const& value) { | ^~~~~~~~~~~~~ --- apps/benchmarks/detournavigator/navmeshtilescache.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/benchmarks/detournavigator/navmeshtilescache.cpp b/apps/benchmarks/detournavigator/navmeshtilescache.cpp index 746739c856..26873d9a03 100644 --- a/apps/benchmarks/detournavigator/navmeshtilescache.cpp +++ b/apps/benchmarks/detournavigator/navmeshtilescache.cpp @@ -182,7 +182,7 @@ namespace for (auto _ : state) { const auto& key = keys[n++ % keys.size()]; - const auto result = cache.get(key.mAgentBounds, key.mTilePosition, key.mRecastMesh); + auto result = cache.get(key.mAgentBounds, key.mTilePosition, key.mRecastMesh); benchmark::DoNotOptimize(result); } } @@ -241,7 +241,7 @@ namespace while (state.KeepRunning()) { const auto& key = keys[n++ % keys.size()]; - const auto result = cache.set( + auto result = cache.set( key.mAgentBounds, key.mTilePosition, key.mRecastMesh, std::make_unique()); benchmark::DoNotOptimize(result); }