]> git.proxmox.com Git - mirror_qemu.git/commit
include/qemu/atomic: add compile time asserts
authorAlex Bennée <alex.bennee@linaro.org>
Mon, 4 Apr 2016 14:35:49 +0000 (15:35 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 5 Apr 2016 09:46:52 +0000 (11:46 +0200)
commitca47a926ad780d5cc91a205d25a859128cdf800e
treeabb3098a6ce88400688e8447174f53969a871d1b
parentccffff48c93c30733783b05cd1ef843a4c274653
include/qemu/atomic: add compile time asserts

To be safely portable no atomic access should be trying to do more than
the natural word width of the host. The most common abuse is trying to
atomically access 64 bit values on a 32 bit host.

This patch adds some QEMU_BUILD_BUG_ON to the __atomic instrinsic paths
to create a build failure if (sizeof(*ptr) > sizeof(void *)).

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <1459780549-12942-3-git-send-email-alex.bennee@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/atomic.h