From a12c54454f3a6132988b68873903f6e9eed7f384 Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Tue, 8 Jan 2013 15:15:45 -0800 Subject: [PATCH] Fix unused warnings in pthread.c Change-Id: I0287aadb825fd8cda29dc976bce55d75a1279fc5 --- libc/bionic/pthread.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c index 92ee4aa76..f29472379 100644 --- a/libc/bionic/pthread.c +++ b/libc/bionic/pthread.c @@ -450,22 +450,18 @@ int pthread_attr_getstacksize(pthread_attr_t const * attr, size_t * stack_size) return 0; } -int pthread_attr_setstackaddr(pthread_attr_t * attr, void * stack_addr) +int pthread_attr_setstackaddr(pthread_attr_t * attr __attribute__((unused)), + void * stack_addr __attribute__((unused))) { -#if 1 - // It's not clear if this is setting the top or bottom of the stack, so don't handle it for now. + // This was removed from POSIX.1-2008, and is not implemented on bionic. + // Needed for ABI compatibility with the NDK. return ENOSYS; -#else - if ((uint32_t)stack_addr & (PAGE_SIZE - 1)) { - return EINVAL; - } - attr->stack_base = stack_addr; - return 0; -#endif } int pthread_attr_getstackaddr(pthread_attr_t const * attr, void ** stack_addr) { + // This was removed from POSIX.1-2008. + // Needed for ABI compatibility with the NDK. *stack_addr = (char*)attr->stack_base + attr->stack_size; return 0; } @@ -513,7 +509,7 @@ int pthread_getattr_np(pthread_t thid, pthread_attr_t * attr) return 0; } -int pthread_attr_setscope(pthread_attr_t *attr, int scope) +int pthread_attr_setscope(pthread_attr_t *attr __attribute__((unused)), int scope) { if (scope == PTHREAD_SCOPE_SYSTEM) return 0; @@ -523,7 +519,7 @@ int pthread_attr_setscope(pthread_attr_t *attr, int scope) return EINVAL; } -int pthread_attr_getscope(pthread_attr_t const *attr) +int pthread_attr_getscope(pthread_attr_t const *attr __attribute__((unused))) { return PTHREAD_SCOPE_SYSTEM; } @@ -1181,7 +1177,7 @@ _recursive_increment(pthread_mutex_t* mutex, int mvalue, int mtype) __LIBC_HIDDEN__ int pthread_mutex_lock_impl(pthread_mutex_t *mutex) { - int mvalue, mtype, tid, new_lock_type, shared; + int mvalue, mtype, tid, shared; if (__unlikely(mutex == NULL)) return EINVAL; @@ -1275,7 +1271,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex) __LIBC_HIDDEN__ int pthread_mutex_unlock_impl(pthread_mutex_t *mutex) { - int mvalue, mtype, tid, oldv, shared; + int mvalue, mtype, tid, shared; if (__unlikely(mutex == NULL)) return EINVAL; @@ -1342,7 +1338,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex) __LIBC_HIDDEN__ int pthread_mutex_trylock_impl(pthread_mutex_t *mutex) { - int mvalue, mtype, tid, oldv, shared; + int mvalue, mtype, tid, shared; if (__unlikely(mutex == NULL)) return EINVAL; @@ -1437,7 +1433,7 @@ int pthread_mutex_lock_timeout_np_impl(pthread_mutex_t *mutex, unsigned msecs) clockid_t clock = CLOCK_MONOTONIC; struct timespec abstime; struct timespec ts; - int mvalue, mtype, tid, oldv, new_lock_type, shared; + int mvalue, mtype, tid, shared; /* compute absolute expiration time */ __timespec_to_relative_msec(&abstime, msecs, clock); @@ -2118,9 +2114,7 @@ int pthread_getcpuclockid(pthread_t tid, clockid_t *clockid) */ int pthread_once( pthread_once_t* once_control, void (*init_routine)(void) ) { - static pthread_mutex_t once_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER; volatile pthread_once_t* ocptr = once_control; - pthread_once_t value; /* PTHREAD_ONCE_INIT is 0, we use the following bit flags * -- 2.11.0