public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: gcc@gcc.gnu.org
Subject: man-pages futex(2) example program using _Atomic
Date: Wed, 17 Aug 2022 15:37:13 +0200	[thread overview]
Message-ID: <25694931-8796-dcdd-3a24-40776758709b@gmail.com> (raw)


[-- 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 --]

                 reply	other threads:[~2022-08-17 13:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25694931-8796-dcdd-3a24-40776758709b@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).