mbox series

[0/4] atomic: Friendlier assertions, avoidance of __sync

Message ID 20221024232435.3334600-1-richard.henderson@linaro.org
Headers show
Series atomic: Friendlier assertions, avoidance of __sync | expand

Message

Richard Henderson Oct. 24, 2022, 11:24 p.m. UTC
The current use of _Static_assert, via QEMU_BUILD_BUG_ON, requires
the user have #if conditionals to avoid the statement from appearing
in the preprocessed file at all.  Introduce a new primitive that
allows normal C conditionals and dead-code elimination.

Remove all use of __sync* builtins in favor of __atomic*.
We have required them since 47345e71247, last year, and
should have removed these at that point.  My bad.


r~


Richard Henderson (4):
  include/qemu/osdep: Add qemu_build_assert
  include/qemu/atomic: Use qemu_build_assert
  include/qemu/thread: Use qatomic_* functions
  include/qemu/atomic128: Avoid __sync_val_compare_and_swap_16

 include/qemu/atomic.h    | 16 ++++++++--------
 include/qemu/atomic128.h |  8 +-------
 include/qemu/osdep.h     |  8 ++++++++
 include/qemu/thread.h    |  8 ++++----
 meson.build              |  3 ++-
 5 files changed, 23 insertions(+), 20 deletions(-)

Comments

Paolo Bonzini Oct. 25, 2022, 12:43 p.m. UTC | #1
On 10/25/22 01:24, Richard Henderson wrote:
> The current use of _Static_assert, via QEMU_BUILD_BUG_ON, requires
> the user have #if conditionals to avoid the statement from appearing
> in the preprocessed file at all.  Introduce a new primitive that
> allows normal C conditionals and dead-code elimination.
> 
> Remove all use of __sync* builtins in favor of __atomic*.
> We have required them since 47345e71247, last year, and
> should have removed these at that point.  My bad.
> 
> 
> r~
> 
> 
> Richard Henderson (4):
>    include/qemu/osdep: Add qemu_build_assert
>    include/qemu/atomic: Use qemu_build_assert
>    include/qemu/thread: Use qatomic_* functions
>    include/qemu/atomic128: Avoid __sync_val_compare_and_swap_16
> 
>   include/qemu/atomic.h    | 16 ++++++++--------
>   include/qemu/atomic128.h |  8 +-------
>   include/qemu/osdep.h     |  8 ++++++++
>   include/qemu/thread.h    |  8 ++++----
>   meson.build              |  3 ++-
>   5 files changed, 23 insertions(+), 20 deletions(-)
> 

For patches 1-3,

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Paolo
Richard Henderson Oct. 25, 2022, 10:33 p.m. UTC | #2
On 10/25/22 22:43, Paolo Bonzini wrote:
> On 10/25/22 01:24, Richard Henderson wrote:
>> The current use of _Static_assert, via QEMU_BUILD_BUG_ON, requires
>> the user have #if conditionals to avoid the statement from appearing
>> in the preprocessed file at all.  Introduce a new primitive that
>> allows normal C conditionals and dead-code elimination.
>>
>> Remove all use of __sync* builtins in favor of __atomic*.
>> We have required them since 47345e71247, last year, and
>> should have removed these at that point.  My bad.
>>
>>
>> r~
>>
>>
>> Richard Henderson (4):
>>    include/qemu/osdep: Add qemu_build_assert
>>    include/qemu/atomic: Use qemu_build_assert
>>    include/qemu/thread: Use qatomic_* functions
>>    include/qemu/atomic128: Avoid __sync_val_compare_and_swap_16
>>
>>   include/qemu/atomic.h    | 16 ++++++++--------
>>   include/qemu/atomic128.h |  8 +-------
>>   include/qemu/osdep.h     |  8 ++++++++
>>   include/qemu/thread.h    |  8 ++++----
>>   meson.build              |  3 ++-
>>   5 files changed, 23 insertions(+), 20 deletions(-)
>>
> 
> For patches 1-3,
> 
> Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Queuing patches 1-3 to tcg-next.


r~