[ovs-dev] [PATCH ovs-dev, dpdk-latest 1/2] ovs-atomic: Rename memory_order -> ovs_memory_order

Ilya Maximets i.maximets at ovn.org
Mon Oct 12 15:22:57 UTC 2020


On 10/12/20 5:04 PM, Ilya Maximets wrote:
> On 10/12/20 4:37 PM, Gaëtan Rivet wrote:
>> On 12/10/20 14:04 +0000, Eli Britstein wrote:
>>> DPDK commit [1] uses function variables named "memory_order".
>>> Compilation fails with:
>>> error: declaration of 'memory_order' shadows a global declaration
>>> [-Werror=shadow]
>>>  rte_atomic_thread_fence(int memory_order)
>>> Rename enum memory_order to ovs_memory_order to avoid that conflict.
>>>
>>
>> Hi Eli,
>>
>> The C11 standard section 7.17.1.4 defines 'memory_order' as the
>> "enumerated type whose enumerators identify memory ordering constraints".
>> I think in this case this is a DPDK bug. Its API should be compatible
>> with the C standard.
> 
> I agree here.  And, also, OVS defines this enum only for cases where
> it is not defined by environment (e.g. stdatomic.h).  So, this patch will
> actually fail the build on systems where ovs-atomic-c11.h is chosen as
> an implementation for atomics, because it will not find ovs_memory_order
> type defined.  Basically, I can not build OVS locally with this patch
> applied because of this.

And yes, there still be warning since DPDK will shadow the definition that
comes from the stdatomic.h.

> 
>>
>>> [1] 672a15056380 ("eal: add wrapper for C11 atomic thread fence")
>>>
>>> Signed-off-by: Eli Britstein <elibr at nvidia.com>
>>> ---
>>
>> Regards,
>>
> 



More information about the dev mailing list