From 977c85ad6eafa6e8ea9b9f08c35d164bfa7e1f62 Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Thu, 5 Oct 2017 07:35:10 +0100 Subject: [PATCH] Enable and fix -Wunused-but-set-variable warnings. --- configure.ac | 7 ++++--- src/libespeak-ng/event.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index 0619cb3a..5ec75351 100644 --- a/configure.ac +++ b/configure.ac @@ -275,9 +275,10 @@ dnl dnl Reference: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html dnl ================================================================ -AX_CHECK_COMPILE_FLAG([-Wunused-function], [CFLAGS="-Wunused-function $CFLAGS"]) -AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [CFLAGS="-Wunused-parameter $CFLAGS"]) -AX_CHECK_COMPILE_FLAG([-Wunused-variable], [CFLAGS="-Wunused-variable $CFLAGS"]) +AX_CHECK_COMPILE_FLAG([-Wunused-function], [CFLAGS="-Wunused-function $CFLAGS"]) +AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [CFLAGS="-Wunused-parameter $CFLAGS"]) +AX_CHECK_COMPILE_FLAG([-Wunused-variable], [CFLAGS="-Wunused-variable $CFLAGS"]) +AX_CHECK_COMPILE_FLAG([-Wunused-but-set-variable], [CFLAGS="-Wunused-but-set-variable $CFLAGS"]) dnl ================================================================ dnl Generate output. diff --git a/src/libespeak-ng/event.c b/src/libespeak-ng/event.c index c1dcd1f0..f762bc26 100644 --- a/src/libespeak-ng/event.c +++ b/src/libespeak-ng/event.c @@ -257,7 +257,7 @@ static void *polling_thread(void *p) while (1) { int a_stop_is_required = 0; - int a_status = pthread_mutex_lock(&my_mutex); + (void)pthread_mutex_lock(&my_mutex); my_event_is_running = 0; while (my_start_is_required == 0) { @@ -284,16 +284,16 @@ static void *polling_thread(void *p) event->user_data = NULL; } - a_status = pthread_mutex_lock(&my_mutex); + (void)pthread_mutex_lock(&my_mutex); event_delete((espeak_EVENT *)pop()); a_stop_is_required = my_stop_is_required; if (a_stop_is_required > 0) my_stop_is_required = 0; - a_status = pthread_mutex_unlock(&my_mutex); + (void)pthread_mutex_unlock(&my_mutex); } - a_status = pthread_mutex_lock(&my_mutex); + (void)pthread_mutex_lock(&my_mutex); my_event_is_running = 0; @@ -303,7 +303,7 @@ static void *polling_thread(void *p) my_stop_is_required = 0; } - a_status = pthread_mutex_unlock(&my_mutex); + (void)pthread_mutex_unlock(&my_mutex); if (a_stop_is_required > 0) { // no mutex required since the stop command is synchronous @@ -311,10 +311,10 @@ static void *polling_thread(void *p) init(); // acknowledge the stop request - espeak_ng_STATUS a_status = pthread_mutex_lock(&my_mutex); + (void)pthread_mutex_lock(&my_mutex); my_stop_is_acknowledged = 1; - a_status = pthread_cond_signal(&my_cond_stop_is_acknowledged); - a_status = pthread_mutex_unlock(&my_mutex); + (void)pthread_cond_signal(&my_cond_stop_is_acknowledged); + (void)pthread_mutex_unlock(&my_mutex); } }