1
0
mirror of https://github.com/google/benchmark.git synced 2025-03-27 04:27:12 +08:00

Always use inline asm DoNotOptimize with clang. ()

* Always use inline asm DoNotOptimize with clang.

clang-cl masquerades as MSVC but not GCC, so it was using the
MSVC-compatible definitions of DoNotOptimize and ClobberMemory.
Presumably, it's better in general to use the targeted assembly for
this functionality (the codegen is different), but the specific issue
is that clang-cl deprecates the usage of _ReadWriteBarrier, and this
gets rid of that warning.

* triggering another AppVeyor run
This commit is contained in:
mwinterb 2017-10-09 15:19:01 -07:00 committed by Dominic Hamon
parent 819adb4cd1
commit f3cd636f18

View File

@ -290,10 +290,12 @@ BENCHMARK_UNUSED static int stream_init_anchor = InitializeStreams();
} // namespace internal
#if !defined(__GNUC__) || defined(__pnacl__) || defined(EMSCRIPTN)
#if (!defined(__GNUC__) && !defined(__clang__)) || defined(__pnacl__) || \
defined(EMSCRIPTN)
# define BENCHMARK_HAS_NO_INLINE_ASSEMBLY
#endif
// The DoNotOptimize(...) function can be used to prevent a value or
// expression from being optimized away by the compiler. This function is
// intended to add little to no overhead.