[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] lockable: add QemuLockable
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] lockable: add QemuLockable |
Date: |
Sat, 3 Feb 2018 12:44:20 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 |
On 02/03/2018 07:39 AM, Paolo Bonzini wrote:
> +/* This function gives an error if an invalid, non-NULL pointer type is
> passed
> + * to QEMU_MAKE_LOCKABLE. For optimized builds, we can rely on dead-code
> elimination
> + * from the compiler, and give the errors already at link time.
> + */
> +#ifdef __OPTIMIZE__
> +void unknown_lock_type(void *);
> +#else
> +static inline void unknown_lock_type(void *unused)
> +{
> + abort();
> +}
Since you're using __builtin_choose_expr, I'm surprised you would need to test
__OPTIMZE__. The nature of the builtin is such that it *must* eliminate the
other branch; otherwise the types don't even match up.
It might be worth using __attribute__((error("message"))) on the function too.
Otherwise,
Reviewed-by: Richard Henderson <address@hidden>
r~
- [Qemu-devel] [PATCH v5 0/5] coroutine-lock: polymorphic CoQueue, Paolo Bonzini, 2018/02/03
- [Qemu-devel] [PATCH 1/5] test-coroutine: add simple CoMutex test, Paolo Bonzini, 2018/02/03
- [Qemu-devel] [PATCH 3/5] coroutine-lock: convert CoQueue to use QemuLockable, Paolo Bonzini, 2018/02/03
- [Qemu-devel] [PATCH 2/5] lockable: add QemuLockable, Paolo Bonzini, 2018/02/03
- Re: [Qemu-devel] [PATCH 2/5] lockable: add QemuLockable,
Richard Henderson <=
- [Qemu-devel] [PATCH 5/5] curl: convert to CoQueue, Paolo Bonzini, 2018/02/03
- [Qemu-devel] [PATCH 4/5] coroutine-lock: make qemu_co_enter_next thread-safe, Paolo Bonzini, 2018/02/03
- Re: [Qemu-devel] [PATCH v5 0/5] coroutine-lock: polymorphic CoQueue, Stefan Hajnoczi, 2018/02/05
- Re: [Qemu-devel] [PATCH v5 0/5] coroutine-lock: polymorphic CoQueue, Fam Zheng, 2018/02/07