From e1ab72a0eabff336b0f7a76410e64b7ed65269d8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 3 Aug 2020 11:12:52 -0400 Subject: tests/core_timing: Remove pragma optimize(off) I made a review comment about this in the PR that this was introduced in (#3955, commit 71c4779211dc081a3b2dd4af52edad5748e7a7f5), but it seems to have been missed. We shouldn't be using this pragma here because it's MSVC specific. This causes warnings on other compilers. The test it's surrounding is *extremely* dubious, but for the sake of silencing warnings on other compilers, we can mark "placebo" as volatile and be on with it. --- src/tests/core/core_timing.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/tests/core/core_timing.cpp b/src/tests/core/core_timing.cpp index 022b26e6d..b35459152 100644 --- a/src/tests/core/core_timing.cpp +++ b/src/tests/core/core_timing.cpp @@ -46,20 +46,16 @@ struct ScopeInit final { Core::Timing::CoreTiming core_timing; }; -#pragma optimize("", off) - u64 TestTimerSpeed(Core::Timing::CoreTiming& core_timing) { - u64 start = core_timing.GetGlobalTimeNs().count(); - u64 placebo = 0; + const u64 start = core_timing.GetGlobalTimeNs().count(); + volatile u64 placebo = 0; for (std::size_t i = 0; i < 1000; i++) { - placebo += core_timing.GetGlobalTimeNs().count(); + placebo = placebo + core_timing.GetGlobalTimeNs().count(); } - u64 end = core_timing.GetGlobalTimeNs().count(); - return (end - start); + const u64 end = core_timing.GetGlobalTimeNs().count(); + return end - start; } -#pragma optimize("", on) - } // Anonymous namespace TEST_CASE("CoreTiming[BasicOrder]", "[core]") { -- cgit v1.2.3