Message ID | 20231125235718.14192-1-marcus.haehnel@kernkonzept.com |
---|---|
State | Accepted |
Headers | show |
Series | [uclibc-ng-devel] linuxthreads: Avoid definiton without prototype warning | expand |
My apologies for the wrong subject. I made a copy and paste error. The correct one is now in the subject of this message. Best regards, - Marcus On Sunday, 26 November 2023 00:56:59 CET Marcus Haehnel wrote: > The spurious_wakeup_count variable is set but is never actually used for > the semaphore implementation. To avoid a clang warning for this case > remove the unused variable. > --- > libpthread/linuxthreads/semaphore.c | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/libpthread/linuxthreads/semaphore.c b/libpthread/linuxthreads/semaphore.c > index 9025dfee6..9464204a9 100644 > --- a/libpthread/linuxthreads/semaphore.c > +++ b/libpthread/linuxthreads/semaphore.c > @@ -61,7 +61,6 @@ int sem_wait(sem_t * sem) > volatile pthread_descr self = thread_self(); > pthread_extricate_if extr; > int already_canceled = 0; > - int spurious_wakeup_count; > > /* Set up extrication interface */ > extr.pu_object = sem; > @@ -90,7 +89,6 @@ int sem_wait(sem_t * sem) > } > > /* Wait for sem_post or cancellation, or fall through if already canceled */ > - spurious_wakeup_count = 0; > while (1) > { > suspend(self); > @@ -98,8 +96,7 @@ int sem_wait(sem_t * sem) > && (THREAD_GETMEM(self, p_woken_by_cancel) == 0 > || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE)) > { > - /* Count resumes that don't belong to us. */ > - spurious_wakeup_count++; > + /* Resume does not belong to us. */ > continue; > } > break; > @@ -213,7 +210,6 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime) > pthread_descr self = thread_self(); > pthread_extricate_if extr; > int already_canceled = 0; > - int spurious_wakeup_count; > > __pthread_lock(&sem->__sem_lock, self); > if (sem->__sem_value > 0) { > @@ -250,7 +246,6 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime) > __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); > } > > - spurious_wakeup_count = 0; > while (1) > { > if (timedsuspend(self, abstime) == 0) { > @@ -277,8 +272,7 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime) > && (THREAD_GETMEM(self, p_woken_by_cancel) == 0 > || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE)) > { > - /* Count resumes that don't belong to us. */ > - spurious_wakeup_count++; > + /* Resume does not belong to us. */ > continue; > } > break; >
diff --git a/libpthread/linuxthreads/semaphore.c b/libpthread/linuxthreads/semaphore.c index 9025dfee6..9464204a9 100644 --- a/libpthread/linuxthreads/semaphore.c +++ b/libpthread/linuxthreads/semaphore.c @@ -61,7 +61,6 @@ int sem_wait(sem_t * sem) volatile pthread_descr self = thread_self(); pthread_extricate_if extr; int already_canceled = 0; - int spurious_wakeup_count; /* Set up extrication interface */ extr.pu_object = sem; @@ -90,7 +89,6 @@ int sem_wait(sem_t * sem) } /* Wait for sem_post or cancellation, or fall through if already canceled */ - spurious_wakeup_count = 0; while (1) { suspend(self); @@ -98,8 +96,7 @@ int sem_wait(sem_t * sem) && (THREAD_GETMEM(self, p_woken_by_cancel) == 0 || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE)) { - /* Count resumes that don't belong to us. */ - spurious_wakeup_count++; + /* Resume does not belong to us. */ continue; } break; @@ -213,7 +210,6 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime) pthread_descr self = thread_self(); pthread_extricate_if extr; int already_canceled = 0; - int spurious_wakeup_count; __pthread_lock(&sem->__sem_lock, self); if (sem->__sem_value > 0) { @@ -250,7 +246,6 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime) __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME); } - spurious_wakeup_count = 0; while (1) { if (timedsuspend(self, abstime) == 0) { @@ -277,8 +272,7 @@ int sem_timedwait(sem_t *sem, const struct timespec *abstime) && (THREAD_GETMEM(self, p_woken_by_cancel) == 0 || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE)) { - /* Count resumes that don't belong to us. */ - spurious_wakeup_count++; + /* Resume does not belong to us. */ continue; } break;