diff options
author | Alexandre Oliva <oliva@adacore.com> | 2023-11-14 22:16:29 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2023-11-14 22:24:28 -0300 |
commit | f5d94999ee6a7bd247c3d74959ebdd46334d7804 (patch) | |
tree | caf20c7d21cf363adc641b6fc21d0d3069c65b0a /gcc | |
parent | a9a0daa3e55733318c5ad25c7420da0417d5b650 (diff) | |
download | gcc-f5d94999ee6a7bd247c3d74959ebdd46334d7804.zip gcc-f5d94999ee6a7bd247c3d74959ebdd46334d7804.tar.gz gcc-f5d94999ee6a7bd247c3d74959ebdd46334d7804.tar.bz2 |
testsuite: tsan: add fallback overload for pthread_cond_clockwait
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.
for gcc/testsuite/ChangeLog
* g++.dg/tsan/pthread_cond_clockwait.C: Add fallback overload.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C b/gcc/testsuite/g++.dg/tsan/pthread_cond_clockwait.C index 82d6a5c..b43f3eb 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; |