|
From: <sv...@va...> - 2011-07-11 22:16:49
|
Author: sewardj
Date: 2011-07-11 23:11:58 +0100 (Mon, 11 Jul 2011)
New Revision: 11875
Log:
The pthread.h on Android has no definition for pthread_rwlock_t, which
makes the associated intercepts in Helgrind and DRD un-compilable.
Add a configure test for it, and use them to guard the aforementioned
intercepts.
Modified:
trunk/configure.in
trunk/drd/drd_pthread_intercepts.c
trunk/helgrind/hg_intercepts.c
Modified: trunk/configure.in
===================================================================
--- trunk/configure.in 2011-07-11 22:10:14 UTC (rev 11874)
+++ trunk/configure.in 2011-07-11 22:11:58 UTC (rev 11875)
@@ -846,6 +846,26 @@
])
+# Check for PTHREAD_RWLOCK_T
+
+AC_MSG_CHECKING([for pthread_rwlock_t])
+
+AC_TRY_COMPILE(
+[
+#define _GNU_SOURCE
+#include <pthread.h>
+], [
+ pthread_rwlock_t rwl;
+],
+[
+AC_MSG_RESULT([yes])
+AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
+ [Define to 1 if you have the `pthread_rwlock_t' type.])
+], [
+AC_MSG_RESULT([no])
+])
+
+
# Check for PTHREAD_MUTEX_ADAPTIVE_NP
AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
Modified: trunk/drd/drd_pthread_intercepts.c
===================================================================
--- trunk/drd/drd_pthread_intercepts.c 2011-07-11 22:10:14 UTC (rev 11874)
+++ trunk/drd/drd_pthread_intercepts.c 2011-07-11 22:11:58 UTC (rev 11875)
@@ -999,6 +999,10 @@
PTH_FUNCS(int, semZupost, sem_post_intercept, (sem_t *sem), (sem));
+/* Android's pthread.h doesn't say anything about rwlocks, hence these
+ functions have to be conditionally compiled. */
+#if defined(HAVE_PTHREAD_RWLOCK_T)
+
static __always_inline
int pthread_rwlock_init_intercept(pthread_rwlock_t* rwlock,
const pthread_rwlockattr_t* attr)
@@ -1158,3 +1162,5 @@
PTH_FUNCS(int,
pthreadZurwlockZuunlock, pthread_rwlock_unlock_intercept,
(pthread_rwlock_t* rwlock), (rwlock));
+
+#endif /* defined(HAVE_PTHREAD_RWLOCK_T) */
Modified: trunk/helgrind/hg_intercepts.c
===================================================================
--- trunk/helgrind/hg_intercepts.c 2011-07-11 22:10:14 UTC (rev 11874)
+++ trunk/helgrind/hg_intercepts.c 2011-07-11 22:11:58 UTC (rev 11875)
@@ -1274,6 +1274,10 @@
/*--- pthread_rwlock_t functions ---*/
/*----------------------------------------------------------------*/
+/* Android's pthread.h doesn't say anything about rwlocks, hence these
+ functions have to be conditionally compiled. */
+#if defined(HAVE_PTHREAD_RWLOCK_T)
+
/* Handled: pthread_rwlock_init pthread_rwlock_destroy
pthread_rwlock_rdlock
pthread_rwlock_wrlock
@@ -1618,7 +1622,9 @@
# error "Unsupported OS"
#endif
+#endif /* defined(HAVE_PTHREAD_RWLOCK_T) */
+
/*----------------------------------------------------------------*/
/*--- POSIX semaphores ---*/
/*----------------------------------------------------------------*/
|