From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id DBCA03857C51; Thu, 21 Dec 2023 18:57:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBCA03857C51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1703185033; bh=sV6iKax10Rg2FE2EDZI1LF/NswdD5Zv7vYHBbH1MJnU=; h=From:To:Subject:Date:From; b=giyt3V9KCzteenKrv0k183EeyNn9EyZCSLXtqIAL+z9FURj72qdxwDD7PRW9141B+ UVJJUpc3jgwzq/oyhimn9k4IFz0WV/batG1GSqFRAZpcCS+vZ+/+/lKKo4yyArWZl4 iRZhTZ293GvGTrxBY3rgiRnT4daGIuXJ/uWn8sNM= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] linux: Adequate tst-clone3 to c11 atomics X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: e710a7706ce35559c8558128152eebe3abedeb5e X-Git-Newrev: 66f25b3a8b89589dba914d6f247b45b1ba8a7b26 Message-Id: <20231221185713.DBCA03857C51@sourceware.org> Date: Thu, 21 Dec 2023 18:57:13 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=66f25b3a8b89589dba914d6f247b45b1ba8a7b26 commit 66f25b3a8b89589dba914d6f247b45b1ba8a7b26 Author: Adhemerval Zanella Date: Fri Mar 25 11:27:46 2022 -0300 linux: Adequate tst-clone3 to c11 atomics Diff: --- sysdeps/unix/sysv/linux/tst-clone3-internal.c | 8 +++----- sysdeps/unix/sysv/linux/tst-clone3.c | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/sysdeps/unix/sysv/linux/tst-clone3-internal.c b/sysdeps/unix/sysv/linux/tst-clone3-internal.c index a88ce52cec..614488e7f8 100644 --- a/sysdeps/unix/sysv/linux/tst-clone3-internal.c +++ b/sysdeps/unix/sysv/linux/tst-clone3-internal.c @@ -45,16 +45,14 @@ f (void *a) implementation. */ #define wait_tid(ctid_ptr, ctid_val) \ do { \ - __typeof (*(ctid_ptr)) __tid; \ /* We need acquire MO here so that we synchronize with the \ kernel's store to 0 when the clone terminates. */ \ - while ((__tid = atomic_load_explicit (ctid_ptr, \ - memory_order_acquire)) != 0) \ + while (atomic_load_explicit (ctid_ptr, memory_order_acquire) != 0) \ futex_wait (ctid_ptr, ctid_val); \ } while (0) static inline int -futex_wait (int *futexp, int val) +futex_wait (_Atomic pid_t *futexp, int val) { #ifdef __NR_futex return syscall (__NR_futex, futexp, FUTEX_WAIT, val); @@ -75,7 +73,7 @@ do_test (void) /* Initialize with a known value. ctid is set to zero by the kernel after the cloned thread has exited. */ #define CTID_INIT_VAL 1 - pid_t ctid = CTID_INIT_VAL; + _Atomic pid_t ctid = CTID_INIT_VAL; pid_t tid; struct clone_args clone_args = diff --git a/sysdeps/unix/sysv/linux/tst-clone3.c b/sysdeps/unix/sysv/linux/tst-clone3.c index 87638e9578..c2b206fccb 100644 --- a/sysdeps/unix/sysv/linux/tst-clone3.c +++ b/sysdeps/unix/sysv/linux/tst-clone3.c @@ -45,16 +45,14 @@ f (void *a) implementation. */ #define wait_tid(ctid_ptr, ctid_val) \ do { \ - __typeof (*(ctid_ptr)) __tid; \ /* We need acquire MO here so that we synchronize with the \ kernel's store to 0 when the clone terminates. */ \ - while ((__tid = atomic_load_explicit (ctid_ptr, \ - memory_order_acquire)) != 0) \ + while (atomic_load_explicit (ctid_ptr, memory_order_acquire) != 0) \ futex_wait (ctid_ptr, ctid_val); \ } while (0) static inline int -futex_wait (int *futexp, int val) +futex_wait (_Atomic pid_t *futexp, int val) { #ifdef __NR_futex return syscall (__NR_futex, futexp, FUTEX_WAIT, val); @@ -75,7 +73,7 @@ do_test (void) /* Initialize with a known value. ctid is set to zero by the kernel after the cloned thread has exited. */ #define CTID_INIT_VAL 1 - pid_t ctid = CTID_INIT_VAL; + _Atomic pid_t ctid = CTID_INIT_VAL; pid_t tid; #ifdef __ia64__