aboutsummaryrefslogtreecommitdiff
path: root/src/tests/core/core_timing.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-08-03 11:12:52 -0400
committerLioncash <mathew1800@gmail.com>2020-08-03 11:12:55 -0400
commit2745697bcc2dc2b0c7144cf33c713973b59412ee (patch)
treee20db1ee75529fbc6b081640076b920b1b1fb589 /src/tests/core/core_timing.cpp
parentecaac59acd7983333b84984ebc4de3748ac4548c (diff)
tests/core_timing: Remove pragma optimize(off)
I made a review comment about this in the PR that this was introduced in (#3955, commit 4df46e052579925c27e178ef61eadfb5adbffac2), 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.
Diffstat (limited to 'src/tests/core/core_timing.cpp')
-rw-r--r--src/tests/core/core_timing.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/tests/core/core_timing.cpp b/src/tests/core/core_timing.cpp
index 022b26e6d5..b354591523 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]") {