am a12c5445: Fix unused warnings in pthread.c

* commit 'a12c54454f3a6132988b68873903f6e9eed7f384':
  Fix unused warnings in pthread.c
This commit is contained in:
Wink Saville 2013-01-11 10:12:12 -08:00 committed by Android Git Automerger
commit 801aeefe2d

View file

@ -450,22 +450,18 @@ int pthread_attr_getstacksize(pthread_attr_t const * attr, size_t * stack_size)
return 0; 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 // This was removed from POSIX.1-2008, and is not implemented on bionic.
// It's not clear if this is setting the top or bottom of the stack, so don't handle it for now. // Needed for ABI compatibility with the NDK.
return ENOSYS; 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) 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; *stack_addr = (char*)attr->stack_base + attr->stack_size;
return 0; return 0;
} }
@ -513,7 +509,7 @@ int pthread_getattr_np(pthread_t thid, pthread_attr_t * attr)
return 0; 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) if (scope == PTHREAD_SCOPE_SYSTEM)
return 0; return 0;
@ -523,7 +519,7 @@ int pthread_attr_setscope(pthread_attr_t *attr, int scope)
return EINVAL; 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; return PTHREAD_SCOPE_SYSTEM;
} }
@ -1181,7 +1177,7 @@ _recursive_increment(pthread_mutex_t* mutex, int mvalue, int mtype)
__LIBC_HIDDEN__ __LIBC_HIDDEN__
int pthread_mutex_lock_impl(pthread_mutex_t *mutex) 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)) if (__unlikely(mutex == NULL))
return EINVAL; return EINVAL;
@ -1275,7 +1271,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex)
__LIBC_HIDDEN__ __LIBC_HIDDEN__
int pthread_mutex_unlock_impl(pthread_mutex_t *mutex) int pthread_mutex_unlock_impl(pthread_mutex_t *mutex)
{ {
int mvalue, mtype, tid, oldv, shared; int mvalue, mtype, tid, shared;
if (__unlikely(mutex == NULL)) if (__unlikely(mutex == NULL))
return EINVAL; return EINVAL;
@ -1342,7 +1338,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex)
__LIBC_HIDDEN__ __LIBC_HIDDEN__
int pthread_mutex_trylock_impl(pthread_mutex_t *mutex) int pthread_mutex_trylock_impl(pthread_mutex_t *mutex)
{ {
int mvalue, mtype, tid, oldv, shared; int mvalue, mtype, tid, shared;
if (__unlikely(mutex == NULL)) if (__unlikely(mutex == NULL))
return EINVAL; return EINVAL;
@ -1437,7 +1433,7 @@ int pthread_mutex_lock_timeout_np_impl(pthread_mutex_t *mutex, unsigned msecs)
clockid_t clock = CLOCK_MONOTONIC; clockid_t clock = CLOCK_MONOTONIC;
struct timespec abstime; struct timespec abstime;
struct timespec ts; struct timespec ts;
int mvalue, mtype, tid, oldv, new_lock_type, shared; int mvalue, mtype, tid, shared;
/* compute absolute expiration time */ /* compute absolute expiration time */
__timespec_to_relative_msec(&abstime, msecs, clock); __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) ) 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; volatile pthread_once_t* ocptr = once_control;
pthread_once_t value;
/* PTHREAD_ONCE_INIT is 0, we use the following bit flags /* PTHREAD_ONCE_INIT is 0, we use the following bit flags
* *