Fix unused warnings in pthread.c
Change-Id: I0287aadb825fd8cda29dc976bce55d75a1279fc5
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index 92ee4aa..f294723 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -450,22 +450,18 @@
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 @@
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 @@
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 @@
__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 @@
__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 @@
__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 @@
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_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
*