Quell gcc 8.2.0 defined but not used warning

On Debian Buster gcc ((Debian 8.2.0-8) 8.2.0) was throwing the following
warning:

  CC       rigctl.o
../../hamlib/tests/rigctl.c:125:18: warning: ‘have_rl’ defined but not used [-Wunused-const-variable=]
 static const int have_rl = 0;
                  ^~~~~~~

and:

  CC       rotctl.o
../../hamlib/tests/rotctl.c:113:18: warning: ‘have_rl’ defined but not used [-Wunused-const-variable=]
 static const int have_rl = 0;
                  ^~~~~~~

Turns out I didn't have the readline-dev package installed.  As the have_rl
variable is wrapped in CPP macros, it indeed is not used when readline is not
available.
pull/58/head^2
Nate Bargmann 2018-10-25 18:26:25 -05:00
rodzic ac540c82cc
commit b0ebeaeda4
2 zmienionych plików z 16 dodań i 16 usunięć

Wyświetl plik

@ -121,8 +121,6 @@ static struct option long_options[] =
/* variable for readline support */
#ifdef HAVE_LIBREADLINE
static const int have_rl = 1;
#else /* no readline */
static const int have_rl = 0;
#endif
@ -143,6 +141,7 @@ int main(int argc, char *argv[])
int verbose = 0;
int show_conf = 0;
int dump_caps_opt = 0;
#ifdef HAVE_READLINE_HISTORY
int rd_hist = 0;
int sv_hist = 0;
@ -150,7 +149,8 @@ int main(int argc, char *argv[])
const char hist_file[] = "/.rigctl_history";
char *hist_path = NULL;
struct stat hist_dir_stat;
#endif
#endif /* HAVE_READLINE_HISTORY */
const char *rig_file = NULL, *ptt_file = NULL, *dcd_file = NULL;
ptt_type_t ptt_type = RIG_PTT_NONE;
dcd_type_t dcd_type = RIG_DCD_NONE;
@ -389,7 +389,7 @@ int main(int argc, char *argv[])
case 'I':
sv_hist++;
break;
#endif
#endif /* HAVE_READLINE_HISTORY */
case 'v':
verbose++;
@ -570,7 +570,7 @@ int main(int argc, char *argv[])
}
}
#endif
#endif /* HAVE_READLINE_HISTORY */
}
#endif /* HAVE_LIBREADLINE */
@ -608,11 +608,11 @@ int main(int argc, char *argv[])
hist_path = (char *)NULL;
}
#endif
#endif /* HAVE_READLINE_HISTORY */
}
#endif
rig_close(my_rig); /* close port */
#endif /* HAVE_LIBREADLINE */
rig_close(my_rig); /* close port */
rig_cleanup(my_rig); /* if you care about memory */
return exitcode;

Wyświetl plik

@ -109,8 +109,6 @@ static struct option long_options[] =
/* variable for readline support */
#ifdef HAVE_LIBREADLINE
static const int have_rl = 1;
#else /* no readline */
static const int have_rl = 0;
#endif
@ -131,6 +129,7 @@ int main(int argc, char *argv[])
int verbose = 0;
int show_conf = 0;
int dump_caps_opt = 0;
#ifdef HAVE_READLINE_HISTORY
int rd_hist = 0;
int sv_hist = 0;
@ -138,7 +137,8 @@ int main(int argc, char *argv[])
const char hist_file[] = "/.rotctl_history";
char *hist_path = NULL;
struct stat hist_dir_stat;
#endif
#endif /* HAVE_READLINE_HISTORY */
const char *rot_file = NULL;
int serial_rate = 0;
char conf_parms[MAXCONFLEN] = "";
@ -240,7 +240,7 @@ int main(int argc, char *argv[])
case 'I':
sv_hist++;
break;
#endif
#endif /* HAVE_READLINE_HISTORY */
case 'v':
verbose++;
@ -395,7 +395,7 @@ int main(int argc, char *argv[])
}
}
#endif
#endif /* HAVE_READLINE_HISTORY */
}
#endif /* HAVE_LIBREADLINE */
@ -433,11 +433,11 @@ int main(int argc, char *argv[])
hist_path = (char *)NULL;
}
#endif
#endif /* HAVE_READLINE_HISTORY */
}
#endif
rot_close(my_rot); /* close port */
#endif /* HAVE_LIBREADLINE */
rot_close(my_rot); /* close port */
rot_cleanup(my_rot); /* if you care about memory */
return exitcode;