Browse Source

Enable and fix -Wunused-but-set-variable warnings.

master
Reece H. Dunn 7 years ago
parent
commit
977c85ad6e
2 changed files with 12 additions and 11 deletions
  1. 4
    3
      configure.ac
  2. 8
    8
      src/libespeak-ng/event.c

+ 4
- 3
configure.ac View File

@@ -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.

+ 8
- 8
src/libespeak-ng/event.c View File

@@ -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);
}
}


Loading…
Cancel
Save