Re: [PATCH 6/8] include/qemu/lockable: Use _Generic instead of QEMU_GENERIC

2021-06-14 Thread Richard Henderson
On 6/14/21 4:14 AM, Paolo Bonzini wrote: On 12/06/21 01:33, Richard Henderson wrote: - unknown_lock_type)) +/* Auxiliary macros to simplify QEMU_MAKE_LOCABLE.  */ +#define QEMU_LOCK_FUNC(x) ((QemuLockUnlockFunc *)  \ +    _Generic((x), QemuMutex *: qemu_mutex_lock,    \ +

Re: [PATCH 6/8] include/qemu/lockable: Use _Generic instead of QEMU_GENERIC

2021-06-14 Thread Paolo Bonzini
On 12/06/21 01:33, Richard Henderson wrote: - unknown_lock_type)) +/* Auxiliary macros to simplify QEMU_MAKE_LOCABLE. */ +#define QEMU_LOCK_FUNC(x) ((QemuLockUnlockFunc *) \ +_Generic((x), QemuMutex *: qemu_mutex_lock,\ + QemuRecMutex *: qemu_rec

[PATCH 6/8] include/qemu/lockable: Use _Generic instead of QEMU_GENERIC

2021-06-11 Thread Richard Henderson
From: Richard Henderson This is both more and less complicated than our expansion using __builtin_choose_expr and __builtin_types_compatible_p. The expansion through QEMU_MAKE_LOCKABLE_ doesn't work because we're not emumerating all of the types within the same _Generic, which results in errors