benchmark icon indicating copy to clipboard operation
benchmark copied to clipboard

_ReadWriteBarrier() is deprecated in MSVC 2015 (possibly earlier)

Open staffantj opened this issue 7 years ago • 2 comments

With the library being rebased on C++11, we should be using std::atomic_thread_fence instead per https://docs.microsoft.com/en-us/cpp/intrinsics/readwritebarrier?view=vs-2015

On the assumption that the fence is only being used to prevent read/write re-ordering, it should be sufficient / equivalent to use std::memory_order_acq_rel.

staffantj avatar Dec 20 '18 15:12 staffantj

Would be good to provide more complete error message. Can you link to the line where _ReadWriteFence is used? I do not find anything:

googlebenchmark$ grep -r _ReadWriteFence
$

LebedevRI avatar Dec 20 '18 15:12 LebedevRI

Apologies, I typo'd the subject, hopefully fixed now.

It occurs at, for instance, in master: https://github.com/google/benchmark/blob/4528c76b718acc9b57956f63069c699ae21edcab/include/benchmark/benchmark.h#L337

There's no compiler error / warning message that I've seen, merely the documentation on the microsoft site, I came across the issue whilst looking at gcc / msvc differences for an in-house documentation effort.

staffantj avatar Dec 20 '18 16:12 staffantj