Hi,

The man-pages example program for the futex(2) page uses atomic_compare_exchange_strong(), but it seems to use it incorrectly, according to clang-tidy(1) (see below). I've neved used _Atomic, and so I'm not confident in fixing the program. Would you mind having a look at it and possibly sending a patch?

Thanks,

Alex

===

alx@asus5775:~/src/linux/man-pages/man-pages$ make tmp/src/man2/futex.2.d/futex.lint-c.clang-tidy.touch
LINT (clang-tidy)       tmp/src/man2/futex.2.d/futex.lint-c.clang-tidy.touch
Error while processing /home/alx/src/linux/man-pages/man-pages/tmp/src/man2/futex.2.d/futex.c. /home/alx/src/linux/man-pages/man-pages/tmp/src/man2/futex.2.d/futex.c:60:13: error: address argument to atomic operation must be a pointer to _Atomic type ('uint32_t *' (aka 'unsigned int *') invalid) [clang-diagnostic-error]
        if (atomic_compare_exchange_strong(futexp, &one, 0))
            ^
/usr/lib/llvm-14/lib/clang/14.0.6/include/stdatomic.h:135:67: note: expanded from macro 'atomic_compare_exchange_strong' #define atomic_compare_exchange_strong(object, expected, desired) __c11_atomic_compare_exchange_strong(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ^ ~~~~~~ /home/alx/src/linux/man-pages/man-pages/tmp/src/man2/futex.2.d/futex.c:84:9: error: address argument to atomic operation must be a pointer to _Atomic type ('uint32_t *' (aka 'unsigned int *') invalid) [clang-diagnostic-error]
    if (atomic_compare_exchange_strong(futexp, &zero, 1)) {
        ^
/usr/lib/llvm-14/lib/clang/14.0.6/include/stdatomic.h:135:67: note: expanded from macro 'atomic_compare_exchange_strong' #define atomic_compare_exchange_strong(object, expected, desired) __c11_atomic_compare_exchange_strong(object, expected, desired, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) ^ ~~~~~~ make: *** [lib/lint-c.mk:58: tmp/src/man2/futex.2.d/futex.lint-c.clang-tidy.touch] Error 1



--
Alejandro Colomar
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to