On 07/05/2015 16:43, Eric Blake wrote: > > I wonder if include/qemu/atomic.h could enhance the #define wrappers to > add no-op compile-time checking, something like (untested): > > #define atomic_add(ptr, n) do { \ > QEMU_BUILD_BUG_ON(sizeof(ptr) > sizeof(void*)); \ > __sync_fetch_and_add(ptr, 1); \ > } while (0)
Yes, though it would have to be a statement expression rather than a do...while. Paolo