Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit a12c544

Browse files
Wink Savilleenh-google
authored andcommitted
Fix unused warnings in pthread.c
Change-Id: I0287aadb825fd8cda29dc976bce55d75a1279fc5
1 parent bfde0b6 commit a12c544

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

libc/bionic/pthread.c

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -450,22 +450,18 @@ int pthread_attr_getstacksize(pthread_attr_t const * attr, size_t * stack_size)
450450
return 0;
451451
}
452452

453-
int pthread_attr_setstackaddr(pthread_attr_t * attr, void * stack_addr)
453+
int pthread_attr_setstackaddr(pthread_attr_t * attr __attribute__((unused)),
454+
void * stack_addr __attribute__((unused)))
454455
{
455-
#if 1
456-
// It's not clear if this is setting the top or bottom of the stack, so don't handle it for now.
456+
// This was removed from POSIX.1-2008, and is not implemented on bionic.
457+
// Needed for ABI compatibility with the NDK.
457458
return ENOSYS;
458-
#else
459-
if ((uint32_t)stack_addr & (PAGE_SIZE - 1)) {
460-
return EINVAL;
461-
}
462-
attr->stack_base = stack_addr;
463-
return 0;
464-
#endif
465459
}
466460

467461
int pthread_attr_getstackaddr(pthread_attr_t const * attr, void ** stack_addr)
468462
{
463+
// This was removed from POSIX.1-2008.
464+
// Needed for ABI compatibility with the NDK.
469465
*stack_addr = (char*)attr->stack_base + attr->stack_size;
470466
return 0;
471467
}
@@ -513,7 +509,7 @@ int pthread_getattr_np(pthread_t thid, pthread_attr_t * attr)
513509
return 0;
514510
}
515511

516-
int pthread_attr_setscope(pthread_attr_t *attr, int scope)
512+
int pthread_attr_setscope(pthread_attr_t *attr __attribute__((unused)), int scope)
517513
{
518514
if (scope == PTHREAD_SCOPE_SYSTEM)
519515
return 0;
@@ -523,7 +519,7 @@ int pthread_attr_setscope(pthread_attr_t *attr, int scope)
523519
return EINVAL;
524520
}
525521

526-
int pthread_attr_getscope(pthread_attr_t const *attr)
522+
int pthread_attr_getscope(pthread_attr_t const *attr __attribute__((unused)))
527523
{
528524
return PTHREAD_SCOPE_SYSTEM;
529525
}
@@ -1181,7 +1177,7 @@ _recursive_increment(pthread_mutex_t* mutex, int mvalue, int mtype)
11811177
__LIBC_HIDDEN__
11821178
int pthread_mutex_lock_impl(pthread_mutex_t *mutex)
11831179
{
1184-
int mvalue, mtype, tid, new_lock_type, shared;
1180+
int mvalue, mtype, tid, shared;
11851181

11861182
if (__unlikely(mutex == NULL))
11871183
return EINVAL;
@@ -1275,7 +1271,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex)
12751271
__LIBC_HIDDEN__
12761272
int pthread_mutex_unlock_impl(pthread_mutex_t *mutex)
12771273
{
1278-
int mvalue, mtype, tid, oldv, shared;
1274+
int mvalue, mtype, tid, shared;
12791275

12801276
if (__unlikely(mutex == NULL))
12811277
return EINVAL;
@@ -1342,7 +1338,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex)
13421338
__LIBC_HIDDEN__
13431339
int pthread_mutex_trylock_impl(pthread_mutex_t *mutex)
13441340
{
1345-
int mvalue, mtype, tid, oldv, shared;
1341+
int mvalue, mtype, tid, shared;
13461342

13471343
if (__unlikely(mutex == NULL))
13481344
return EINVAL;
@@ -1437,7 +1433,7 @@ int pthread_mutex_lock_timeout_np_impl(pthread_mutex_t *mutex, unsigned msecs)
14371433
clockid_t clock = CLOCK_MONOTONIC;
14381434
struct timespec abstime;
14391435
struct timespec ts;
1440-
int mvalue, mtype, tid, oldv, new_lock_type, shared;
1436+
int mvalue, mtype, tid, shared;
14411437

14421438
/* compute absolute expiration time */
14431439
__timespec_to_relative_msec(&abstime, msecs, clock);
@@ -2118,9 +2114,7 @@ int pthread_getcpuclockid(pthread_t tid, clockid_t *clockid)
21182114
*/
21192115
int pthread_once( pthread_once_t* once_control, void (*init_routine)(void) )
21202116
{
2121-
static pthread_mutex_t once_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
21222117
volatile pthread_once_t* ocptr = once_control;
2123-
pthread_once_t value;
21242118

21252119
/* PTHREAD_ONCE_INIT is 0, we use the following bit flags
21262120
*

0 commit comments

Comments
 (0)