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

dnl Reference: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html dnl Reference: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
dnl ================================================================ 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 ================================================================
dnl Generate output. dnl Generate output.

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

while (1) { while (1) {
int a_stop_is_required = 0; 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; my_event_is_running = 0;


while (my_start_is_required == 0) { while (my_start_is_required == 0) {
event->user_data = NULL; event->user_data = NULL;
} }


a_status = pthread_mutex_lock(&my_mutex);
(void)pthread_mutex_lock(&my_mutex);
event_delete((espeak_EVENT *)pop()); event_delete((espeak_EVENT *)pop());
a_stop_is_required = my_stop_is_required; a_stop_is_required = my_stop_is_required;
if (a_stop_is_required > 0) if (a_stop_is_required > 0)
my_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; my_event_is_running = 0;


my_stop_is_required = 0; my_stop_is_required = 0;
} }


a_status = pthread_mutex_unlock(&my_mutex);
(void)pthread_mutex_unlock(&my_mutex);


if (a_stop_is_required > 0) { if (a_stop_is_required > 0) {
// no mutex required since the stop command is synchronous // no mutex required since the stop command is synchronous
init(); init();


// acknowledge the stop request // 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; 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