C++20 report error at file rte_spinlock.h
Zhou, Xiangyun
xiangyun.zhou at intel.com
Tue Dec 13 07:11:06 CET 2022
Dear dpdk dev,
I'm using dpdk 21.11 LTS, when compile my program with CPP flag "-std=c++20", the compiler report below errors. After checking file rte_spinlock.h, I think the error report by compiler is valid, there should be a potential issue when using functions rte_spinlock_recursive_lock, rte_spinlock_recursive_unlock and rte_spinlock_recursive_trylock in multi-thread, we could either remove "volatile" definition to ask users to handle the multi-thread issue, or using atomic operatings instead of self-increment and self-decrement.
/home/dpdk/lib/eal/include/generic/rte_spinlock.h:221:12: error: increment of object of volatile-qualified type 'volatile int' is deprecated [-Werror,-Wdeprecated-volatile]
slr->count++;
^
/home/dpdk/lib/eal/include/generic/rte_spinlock.h:231:6: error: decrement of object of volatile-qualified type 'volatile int' is deprecated [-Werror,-Wdeprecated-volatile]
if (--(slr->count) == 0) {
^
/home/dpdk/lib/eal/include/generic/rte_spinlock.h:255:12: error: increment of object of volatile-qualified type 'volatile int' is deprecated [-Werror,-Wdeprecated-volatile]
slr->count++;
BR,
[A close up of a sign Description automatically generated]
Xiangyun Zhou
NPG SWE SWA
Intel Corporation | intel.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20221213/0ccf4f9e/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 6602 bytes
Desc: image001.png
URL: <http://mails.dpdk.org/archives/dev/attachments/20221213/0ccf4f9e/attachment-0001.png>
More information about the dev
mailing list