From: Alexandre Oliva <oliva@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>,
Mike Stump <mikestump@comcast.net>
Subject: [PATCH] testsuite: tsan: add fallback overload for pthread_cond_clockwait
Date: Wed, 08 Nov 2023 22:49:47 -0300 [thread overview]
Message-ID: <orfs1fhf0k.fsf@lxoliva.fsfla.org> (raw)
LTS GNU/Linux distros from 2018, still in use, don't have
pthread_cond_clockwait. There's no trivial way to detect it so as to
make the test conditional, but there's an easy enough way to silence
the fail due to lack of the function in libc, and that has nothing to
do with the false positive that this is testing against.
Regstrapped on x86_64-linux-gnu, also tested with gcc-13 on i686- and
x86_64-, on distros that offer and that lack pthread_cond_clockwait. Ok
to install?
for gcc/testsuite/ChangeLog
* g++.dg/tsan/pthread_cond_clockwait.C: Add fallback overload.
---
gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C
index 82d6a5c8329ed..b43f3ebf80e2c 100644
--- a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C
+++ b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C
@@ -4,6 +4,19 @@
#include <pthread.h>
+// This overloaded version should only be selected on targets that
+// don't have a pthread_cond_clockwait in pthread.h, and it will wait
+// indefinitely for the cond_signal that, in this testcase, ought to
+// be delivered.
+static inline int
+pthread_cond_clockwait (pthread_cond_t *cv,
+ pthread_mutex_t *mtx,
+ __clockid_t,
+ void const /* struct timespec */ *)
+{
+ return pthread_cond_wait (cv, mtx);
+}
+
pthread_cond_t cv;
pthread_mutex_t mtx;
--
Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/
Free Software Activist GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive
next reply other threads:[~2023-11-09 1:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-09 1:49 Alexandre Oliva [this message]
2023-11-09 21:47 ` Mike Stump
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=orfs1fhf0k.fsf@lxoliva.fsfla.org \
--to=oliva@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mikestump@comcast.net \
--cc=ro@CeBiTec.Uni-Bielefeld.DE \
/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).