summaryrefslogtreecommitdiff
path: root/test/support/test_macros.h
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-03-11 00:07:08 +0000
committerEric Fiselier <eric@efcs.ca>2017-03-11 00:07:08 +0000
commit76880f55bf22de77f45db5fc9ebe66c63c7e0a16 (patch)
treef9d0a35c85118acc73dc95d1bc9368388d350317 /test/support/test_macros.h
parent3b7c1348ca31918186362fa75cd14c33ec2e72f4 (diff)
Fix DoNotOptimize on MSVC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@297532 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/support/test_macros.h')
-rw-r--r--test/support/test_macros.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/support/test_macros.h b/test/support/test_macros.h
index cec5f5a5e..75b7885f8 100644
--- a/test/support/test_macros.h
+++ b/test/support/test_macros.h
@@ -188,9 +188,11 @@ inline void DoNotOptimize(Tp const& value) {
asm volatile("" : : "g"(value) : "memory");
}
#else
+#include <intrin.h>
template <class Tp>
-inline void DoNotOptimize(Tp const&) {
- // FIXME: Do something here...
+inline void DoNotOptimize(Tp const& value) {
+ const volatile void* volatile = __builtin_addressof(value);
+ _ReadWriteBarrier();
}
#endif