On 4 October 2016 at 16:47, Alex Bennée <alex.ben...@linaro.org> wrote:
>
> Richard Henderson <r...@twiddle.net> writes:
>>
>> +#########################################
>> +# See if 64-bit atomic operations are supported.
>> +# Note that without __atomic builtins, we can only
>> +# assume atomic loads/stores max at pointer size.
>> +
>> +cat > $TMPC << EOF
>> +#include <stdint.h>
>> +int main(void)
>> +{
>> +  uint64_t x = 0, y = 0;
>> +#ifdef __ATOMIC_RELAXED
>> +  y = __atomic_load_8(&x, 0);
>> +  __atomic_store_8(&x, y, 0);
>> +  __atomic_compare_exchange_8(&x, &y, x, 0, 0, 0);
>> +  __atomic_exchange_8(&x, y, 0);
>> +  __atomic_fetch_add_8(&x, y, 0);
>> +#else
>> +  char is_host64[sizeof(void *) >= sizeof(uint64_t) ? 1 : -1];
> <snip>
>
> This breaks with --enable-werror (and my Travis images):
>
> config-temp/qemu-conf.c: In function ‘main’:
> config-temp/qemu-conf.c:12:8: error: unused variable ‘is_host64’ 
> [-Werror=unused-variable]
>
> I'm not sure what the best fix is here? Pass -no-werror to the test compile?

I would write this as:

#define QEMU_BUILD_BUG_ON(x) \
    typedef char glue(qemu_build_bug_on__,__LINE__)[(x)?-1:1]
__attribute__((unused));
QEMU_BUILD_BUG_ON(sizeof(void *) >= sizeof(uint64_t))

which is (more or less) what we do for the existing
"is size_t the same as GLIB_SIZEOF_SIZE_T" test.

thanks
-- PMM

Reply via email to