qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] qemu/atomic.h: prefix qemu_ to solve <stdatomic.h> collision


From: David Hildenbrand
Subject: Re: [PATCH] qemu/atomic.h: prefix qemu_ to solve <stdatomic.h> collisions
Date: Tue, 22 Sep 2020 08:45:02 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

On 22.09.20 08:27, Paolo Bonzini wrote:
> On 21/09/20 18:23, Stefan Hajnoczi wrote:
>> clang's C11 atomic_fetch_*() functions only take a C11 atomic type
>> pointer argument. QEMU uses direct types (int, etc) and this causes a
>> compiler error when a QEMU code calls these functions in a source file
>> that also included <stdatomic.h> via a system header file:
>>
>>   $ CC=clang CXX=clang++ ./configure ... && make
>>   ../util/async.c:79:17: error: address argument to atomic operation must be 
>> a pointer to _Atomic type ('unsigned int *' invalid)
>>
>> Avoid using atomic_*() names in QEMU's atomic.h since that namespace is
>> used by <stdatomic.h>. Prefix QEMU's APIs with qemu_ so that atomic.h
>> and <stdatomic.h> can co-exist.
>>
>> This patch was generated using:
>>
>>   $ git diff | grep -o '\<atomic_[a-z0-9_]\+' | sort -u 
>> >/tmp/changed_identifiers
>>   $ for identifier in $(</tmp/changed_identifiers64); do \
>>        sed -i "s%\<$identifier\>%qemu_$identifier%" $(git grep -l 
>> "\<$identifier\>") \
>>     done
> 
> It's certainly a good idea but it's quite verbose.
> 
> What about using atomic__* as the prefix?  It is not very common in QEMU
> but there are some cases (and I cannot think of anything better).
> 

aqomic_*, lol :)

> Paolo
> 


-- 
Thanks,

David / dhildenb




reply via email to

[Prev in Thread] Current Thread [Next in Thread]