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.
#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;