include/qemu/atomic.h: default to __atomic functions
commita0aa44b488b3601415d55041e4619aef5f3a4ba8
authorAlex Bennée <alex.bennee@linaro.org>
Thu, 28 Jan 2016 10:15:17 +0000 (28 10:15 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 9 Feb 2016 14:45:26 +0000 (9 15:45 +0100)
treecc9b67aa6b6087f2997ef555f099a054e88bae93
parent977a82ab56daac83623d730174f47d5a7edd73c9
include/qemu/atomic.h: default to __atomic functions

The __atomic primitives have been available since GCC 4.7 and provide
a richer interface for describing memory ordering requirements. As a
bonus by using the primitives instead of hand-rolled functions we can
use tools such as the ThreadSanitizer which need the use of well
defined APIs for its analysis.

If we have __ATOMIC defines we exclusively use the __atomic primitives
for all our atomic access. Otherwise we fall back to the mixture of
__sync and hand-rolled barrier cases.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1453976119-24372-4-git-send-email-alex.bennee@linaro.org>
[Use __ATOMIC_SEQ_CST for atomic_mb_read/atomic_mb_set on !POWER. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/atomic.h