public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* man-pages futex(2) example program using _Atomic
@ 2022-08-17 13:37 Alejandro Colomar
  0 siblings, 0 replies; only message in thread
From: Alejandro Colomar @ 2022-08-17 13:37 UTC (permalink / raw)
  To: gcc


[-- Attachment #1.1: Type: text/plain, Size: 2216 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-17 13:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17 13:37 man-pages futex(2) example program using _Atomic Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).