Fix benchmark warning: -Wdeprecated-declarations

/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) {
      |     ^~~~~~~~~~~~~
fix-osga-rotate-wildly
elsid 10 months ago
parent 8cc665ec43
commit da5ab2b2c9
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -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<PreparedNavMeshData>());
benchmark::DoNotOptimize(result);
}

Loading…
Cancel
Save