From 50a6186734f490f3047917d2cce00722c2160978 Mon Sep 17 00:00:00 2001 From: John Marino Date: Mon, 1 Oct 2012 03:09:06 +0200 Subject: [PATCH] gcc47 build fixes: Unused-but-set-variable + more warnings The following programs fail to build with gcc47 due to the new unused-but-set-variable warning. They've been fixed in various ways. The ones set with WARNS=3 suppress cast-qual warning There is a single enum-compare error too. This effort is not complete. bin/csh pass -Wno-unused-but-set-variable bin/mined source file modified bin/sh set WARNS=3 crypto/openssh source file modified (2) gnu/lib/libdialog source file modified gnu/usr.bin/gdb/kgdb source file modified gnu/usr.bin/rcs source file modified lib/libalias source file modified lib/libdevstat source file modified lib/libdm set WARNS=3 lib/libevtr source file modified lib/libldns pass -Wno-unused-but-set-variable lib/libncp source file modified lib/libpam set WARNS=3 lib/libsmdb pass -Wno-unused-but-set-variable lib/libstand source file modified (4) lib/libtcplay source file modified lib/libthread_xu source file modified (2) libexec/rshd source file modified libexec/telnetd source file modified libexec/ypxfr pass -Wno-enum-compare sbin/atm/fore_dnld source file modified sbin/atm/ilmid source file modified sbin/atm/camcontrol source file modifief (2) sbin/ccdconfig source file modified sbin/cryptdisks source file modified sbin/ffsinfo source file modified sbin/fsirand source file modified sbin/growfs source file modified sbin/hammer source file modified sbin/ldconfig source file modified (real bug here?) sbin/mount source file modified sbin/mount_ufs source file modified sbin/mount_extfs source file modified sbin/mountd source file modified sbin/natd source file modified sbin/newfs source file modified sbin/ping6 set WARNS=3, source modified sbin/rcorder source file modified sbin/reboot source file modified (real bug here?) sbin/udevd source file modified sbin/usched source file modified sbin/vinum source file modified sys/boot/common source file modified sys/boot/pc32/loader source file modified usr.bin/brandelf source file modified usr.bin/bzip2 pass -Wno-unused-but-set-variable usr.bin/dfregress source file modified usr.bin/ee source file modified usr.bin/less pass -Wno-unused-but-set-variable --- bin/csh/Makefile | 1 + bin/mined/mined2.c | 4 +--- bin/sh/Makefile | 2 ++ crypto/openssh/ssh-pkcs11-helper.c | 3 ++- crypto/openssh/ssh.c | 2 +- gnu/lib/libdialog/dir.c | 2 +- gnu/lib/libdialog/textbox.c | 2 +- gnu/usr.bin/gdb/kgdb/kthr.c | 3 ++- gnu/usr.bin/rcs/lib/rcsutil.c | 2 +- lib/libalias/alias_nbt.c | 4 +++- lib/libdevstat/devstat.c | 2 -- lib/libdm/Makefile | 2 ++ lib/libevtr/evtr.c | 4 +--- lib/libldns/Makefile | 1 + lib/libncp/ncpl_rcfile.c | 2 +- lib/libpam/Makefile | 2 ++ lib/libsmdb/Makefile | 1 + lib/libstand/cd9660.c | 3 +-- lib/libstand/netif.c | 3 +-- lib/libstand/nfs.c | 3 +-- lib/libstand/tftp.c | 2 +- lib/libtcplay/safe_mem.c | 2 +- lib/libthread_xu/arch/i386/i386/pthread_md.c | 3 --- lib/libthread_xu/arch/x86_64/x86_64/pthread_md.c | 3 --- libexec/rshd/rshd.c | 2 +- libexec/telnetd/telnetd.c | 2 +- libexec/ypxfr/Makefile | 1 + sbin/atm/fore_dnld/fore_dnld.c | 2 +- sbin/atm/ilmid/ilmid.c | 4 ++-- sbin/camcontrol/camcontrol.c | 5 +++-- sbin/camcontrol/modeedit.c | 2 +- sbin/ccdconfig/ccdconfig.c | 7 ++++++- sbin/cryptdisks/safe_mem.c | 2 +- sbin/ffsinfo/ffsinfo.c | 2 +- sbin/fsirand/fsirand.c | 2 +- sbin/growfs/growfs.c | 2 +- sbin/hammer/cmd_info.c | 3 --- sbin/ldconfig/ldconfig.c | 3 ++- sbin/mount/mount.c | 2 +- sbin/mount_ext2fs/mount_ext2fs.c | 3 +-- sbin/mount_ufs/mount.c | 2 +- sbin/mountd/mountd.c | 2 -- sbin/natd/natd.c | 2 +- sbin/newfs/mkfs.c | 2 +- sbin/ping6/Makefile | 2 ++ sbin/ping6/ping6.c | 2 +- sbin/rcorder/rcorder.c | 5 +++-- sbin/reboot/reboot.c | 3 ++- sbin/udevd/udevd_monitor.c | 2 +- sbin/usched/usched.c | 2 +- sbin/vinum/commands.c | 4 ++-- sys/boot/common/ls.c | 5 ++--- sys/boot/pc32/loader/main.c | 2 +- usr.bin/brandelf/brandelf.c | 3 ++- usr.bin/bzip2/Makefile | 1 + usr.bin/dfregress/testcase.c | 2 +- usr.bin/ee/ee.c | 2 -- usr.bin/less/Makefile | 1 + 58 files changed, 75 insertions(+), 71 deletions(-) diff --git a/bin/csh/Makefile b/bin/csh/Makefile index d138ca08fe..348b27ff33 100644 --- a/bin/csh/Makefile +++ b/bin/csh/Makefile @@ -16,6 +16,7 @@ CONTRIBDIR=${TCSHDIR} PROG= csh DFLAGS= -D_PATH_TCSHELL='"/bin/${PROG}"' CFLAGS+= -I. -I${.CURDIR} -I${TCSHDIR} ${DFLAGS} +CFLAGS+= -Wno-unused-but-set-variable SRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \ sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \ sh.lex.c sh.misc.c sh.parse.c sh.print.c sh.proc.c sh.sem.c \ diff --git a/bin/mined/mined2.c b/bin/mined/mined2.c index 3bbf4df136..6dad670494 100644 --- a/bin/mined/mined2.c +++ b/bin/mined/mined2.c @@ -92,12 +92,10 @@ static const char *help_string= void HLP(int u __unused) { - char c; - string_print(enter_string); string_print(help_string); flush(); - c=getchar(); + getchar(); RD(0); return; } diff --git a/bin/sh/Makefile b/bin/sh/Makefile index 88b39ba7f6..f6dcc0800e 100644 --- a/bin/sh/Makefile +++ b/bin/sh/Makefile @@ -12,6 +12,8 @@ GENSRCS= builtins.c init.c nodes.c syntax.c GENHDRS= builtins.h nodes.h syntax.h token.h SRCS= ${SHSRCS} ${GENSRCS} ${GENHDRS} +WARNS?= 3 + # MLINKS for Shell built in commands for which there are no userland # utilities of the same name are handled with the associated manpage, # builtin.1 in share/man/man1/. diff --git a/crypto/openssh/ssh-pkcs11-helper.c b/crypto/openssh/ssh-pkcs11-helper.c index cd33515f62..62fc433182 100644 --- a/crypto/openssh/ssh-pkcs11-helper.c +++ b/crypto/openssh/ssh-pkcs11-helper.c @@ -168,7 +168,8 @@ process_sign(void) { u_char *blob, *data, *signature = NULL; u_int blen, dlen, slen = 0; - int ok = -1, flags, ret; + int ok = -1, ret; + int __unused flags; Key *key, *found; Buffer msg; diff --git a/crypto/openssh/ssh.c b/crypto/openssh/ssh.c index ee124c1a50..a217cdef79 100644 --- a/crypto/openssh/ssh.c +++ b/crypto/openssh/ssh.c @@ -1327,7 +1327,7 @@ ssh_session2_setup(int id, int success, void *arg) { extern char **environ; const char *display; - int interactive = tty_flag; + int __unused interactive = tty_flag; if (!success) return; /* No need for error message, channels code sens one */ diff --git a/gnu/lib/libdialog/dir.c b/gnu/lib/libdialog/dir.c index f290bc404a..56baf289f8 100644 --- a/gnu/lib/libdialog/dir.c +++ b/gnu/lib/libdialog/dir.c @@ -381,7 +381,7 @@ get_dir(char *dirname, char *fmask, DirList **dir, int *n) struct dirent **dire; struct stat status; int i, j, nb; - long d; + long __unused d; getcwd(cwd, MAXPATHLEN); diff --git a/gnu/lib/libdialog/textbox.c b/gnu/lib/libdialog/textbox.c index 30c6f7d564..89898add55 100644 --- a/gnu/lib/libdialog/textbox.c +++ b/gnu/lib/libdialog/textbox.c @@ -562,7 +562,7 @@ static void print_page(WINDOW *win, int height, int width) */ static void print_line(WINDOW *win, int row, int width) { - int i, y, x; + int i, __unused y, x; unsigned char *line; line = get_line(); diff --git a/gnu/usr.bin/gdb/kgdb/kthr.c b/gnu/usr.bin/gdb/kgdb/kthr.c index 6e32d0350a..2635b3cc6d 100644 --- a/gnu/usr.bin/gdb/kgdb/kthr.c +++ b/gnu/usr.bin/gdb/kgdb/kthr.c @@ -250,6 +250,7 @@ kgdb_thr_select(struct kthr *kt) char * kgdb_thr_extra_thread_info(int tid) { +#if 0 /* XXX: Doesn't do anything, obsolete? */ struct kthr *kt; static char buf[64]; @@ -258,7 +259,7 @@ kgdb_thr_extra_thread_info(int tid) return (NULL); buf[0] = 0; - +#endif return (NULL); } diff --git a/gnu/usr.bin/rcs/lib/rcsutil.c b/gnu/usr.bin/rcs/lib/rcsutil.c index cb1270792f..1826001fa2 100644 --- a/gnu/usr.bin/rcs/lib/rcsutil.c +++ b/gnu/usr.bin/rcs/lib/rcsutil.c @@ -414,7 +414,7 @@ static sig_atomic_t volatile heldsignal, holdlevel; char const *filename; unsigned char const *p; { - unsigned char volatile t; + unsigned char volatile __unused t; accessName = filename; t = *p; accessName = 0; diff --git a/lib/libalias/alias_nbt.c b/lib/libalias/alias_nbt.c index 3020e70848..ec2298eb04 100644 --- a/lib/libalias/alias_nbt.c +++ b/lib/libalias/alias_nbt.c @@ -123,7 +123,9 @@ static void PrintRcode( u_char rcode ) { static u_char *AliasHandleName ( u_char *p, char *pmax ) { u_char *s; +#ifdef DEBUG u_char c; +#endif int compress; /* Following length field */ @@ -155,8 +157,8 @@ static u_char *AliasHandleName ( u_char *p, char *pmax ) { #endif while (s < p) { if ( compress == 1 ) { - c = (u_char )(((((*s & 0x0f) << 4) | (*(s+1) & 0x0f)) - 0x11)); #ifdef DEBUG + c = (u_char )(((((*s & 0x0f) << 4) | (*(s+1) & 0x0f)) - 0x11)); if (isprint( c ) ) printf("%c", c ); else diff --git a/lib/libdevstat/devstat.c b/lib/libdevstat/devstat.c index 2024711fdd..983675ee00 100644 --- a/lib/libdevstat/devstat.c +++ b/lib/libdevstat/devstat.c @@ -230,7 +230,6 @@ getdevs(struct statinfo *stats) { int error; size_t dssize; - int oldnumdevs; long oldgeneration; int retval = 0; struct devinfo *dinfo; @@ -243,7 +242,6 @@ getdevs(struct statinfo *stats) return(-1); } - oldnumdevs = dinfo->numdevs; oldgeneration = dinfo->generation; /* diff --git a/lib/libdm/Makefile b/lib/libdm/Makefile index a1127f0a9b..42eac323ea 100644 --- a/lib/libdm/Makefile +++ b/lib/libdm/Makefile @@ -4,4 +4,6 @@ INCS= libdm.h NOMAN= +WARNS= 3 + .include diff --git a/lib/libevtr/evtr.c b/lib/libevtr/evtr.c index 773422b113..bbee6adf1b 100644 --- a/lib/libevtr/evtr.c +++ b/lib/libevtr/evtr.c @@ -1755,7 +1755,7 @@ int _evtr_next_event(evtr_t evtr, evtr_event_t ev, struct evtr_query *q) { char buf[MAX_EVHDR_SIZE]; - int ret, err, ntried, nmatched; + int ret, err; struct trace_event_header *evhdr = (struct trace_event_header *)buf; for (ret = 0; !ret;) { @@ -1792,8 +1792,6 @@ _evtr_next_event(evtr_t evtr, evtr_event_t ev, struct evtr_query *q) return feof(evtr->f) ? -1 : !0; switch (evhdr->type) { case EVTR_TYPE_PROBE: - ntried = q->ntried; - nmatched = q->nmatched; if ((err = evtr_load_probe(evtr, ev, buf, q))) { if (err == -1) { /* no match */ diff --git a/lib/libldns/Makefile b/lib/libldns/Makefile index e313cb6886..73814ef014 100644 --- a/lib/libldns/Makefile +++ b/lib/libldns/Makefile @@ -21,6 +21,7 @@ SRCS+= b32_ntop.c b32_pton.c b64_ntop.c b64_pton.c .PATH: ${LDNS} ${LDNS}/compat CFLAGS+= -I${.CURDIR} -I${LDNS} +CFLAGS+= -Wno-unused-but-set-variable #CLEANFILES= bsdxml.h bsdxml_external.h WARNS?= 2 diff --git a/lib/libncp/ncpl_rcfile.c b/lib/libncp/ncpl_rcfile.c index 0ccb22a9d8..a4295a627a 100644 --- a/lib/libncp/ncpl_rcfile.c +++ b/lib/libncp/ncpl_rcfile.c @@ -389,7 +389,7 @@ rc_getbool(struct rcfile *rcp,char *section, char *key,int *value) { int ncp_open_rcfile(void) { char *home, *fn; - int error; + int __unused error; home = getenv("HOME"); if (home) { diff --git a/lib/libpam/Makefile b/lib/libpam/Makefile index da9c1debee..23bb1d8623 100644 --- a/lib/libpam/Makefile +++ b/lib/libpam/Makefile @@ -8,6 +8,8 @@ CFLAGS+= -DHAVE_CONFIG_H CFLAGS+= -DOPENPAM_MODULES_DIR='"${MODULE_DIR}/"' CFLAGS+= -I${SRCDIR}/lib -I${SRCDIR}/include -I${.CURDIR} +WARNS= 3 + # Dist files SRCS= openpam_borrow_cred.c \ openpam_check_owner_perms.c \ diff --git a/lib/libsmdb/Makefile b/lib/libsmdb/Makefile index 2dcf68b04b..2fe907bbdc 100644 --- a/lib/libsmdb/Makefile +++ b/lib/libsmdb/Makefile @@ -6,6 +6,7 @@ SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail-8.14 CFLAGS+=-I${SENDMAIL_DIR}/sendmail -I${SENDMAIL_DIR}/include -I. CFLAGS+=-DNEWDB -DNOT_SENDMAIL +CFLAGS+=-Wno-unused-but-set-variable # User customizations to the sendmail build environment CFLAGS+=${SENDMAIL_CFLAGS} diff --git a/lib/libstand/cd9660.c b/lib/libstand/cd9660.c index 766a4531c7..5e3d19a0c0 100644 --- a/lib/libstand/cd9660.c +++ b/lib/libstand/cd9660.c @@ -510,7 +510,7 @@ cd9660_readdir(struct open_file *f, struct dirent *d) { struct file *fp = (struct file *)f->f_fsdata; struct iso_directory_record *ep; - size_t buf_size, reclen, namelen; + size_t buf_size, namelen; int error = 0; int lenskip; char *buf, *name; @@ -552,7 +552,6 @@ again: } } } - reclen = _DIRENT_RECLEN(namelen); d->d_ino = isonum_733(ep->extent); if (isonum_711(ep->flags) & 2) diff --git a/lib/libstand/netif.c b/lib/libstand/netif.c index c78caa18ef..2c20aa5327 100644 --- a/lib/libstand/netif.c +++ b/lib/libstand/netif.c @@ -87,7 +87,7 @@ netif_match(struct netif *nif, void *machdep_hint) struct netif * netif_select(void *machdep_hint) { - int d, u, unit_done, s; + int d, u, s; struct netif_driver *drv; struct netif cur_if; static struct netif best_if; @@ -103,7 +103,6 @@ netif_select(void *machdep_hint) for (u = 0; u < drv->netif_nifs; u++) { cur_if.nif_unit = u; - unit_done = 0; #ifdef NETIF_DEBUG if (netif_debug) diff --git a/lib/libstand/nfs.c b/lib/libstand/nfs.c index 9df43542ba..61abff49d6 100644 --- a/lib/libstand/nfs.c +++ b/lib/libstand/nfs.c @@ -671,7 +671,6 @@ nfs_readdir(struct open_file *f, struct dirent *d) struct nfs_readdir_off *roff = NULL; static char *buf; static n_long cookie = 0; - size_t cc; n_long eof; struct { @@ -692,7 +691,7 @@ nfs_readdir(struct open_file *f, struct dirent *d) args->cookie = htonl(cookie); args->count = htonl(NFS_READDIRSIZE); - cc = rpc_call(fp->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READDIR, + rpc_call(fp->iodesc, NFS_PROG, NFS_VER2, NFSPROC_READDIR, args, sizeof(*args), rdata.d, sizeof(rdata.d)); buf = rdata.d; diff --git a/lib/libstand/tftp.c b/lib/libstand/tftp.c index efad4c504e..ec440374fe 100644 --- a/lib/libstand/tftp.c +++ b/lib/libstand/tftp.c @@ -406,7 +406,7 @@ tftp_write(struct open_file *f, void *start, size_t size, size_t *resid) static int tftp_stat(struct open_file *f, struct stat *sb) { - struct tftp_handle *tftpfile; + struct tftp_handle __unused *tftpfile; tftpfile = (struct tftp_handle *) f->f_fsdata; sb->st_mode = 0444 | S_IFREG; diff --git a/lib/libtcplay/safe_mem.c b/lib/libtcplay/safe_mem.c index a07f5a9518..225de150cd 100644 --- a/lib/libtcplay/safe_mem.c +++ b/lib/libtcplay/safe_mem.c @@ -150,7 +150,7 @@ check_and_purge_safe_mem(void) { struct safe_mem_hdr *hdr; char *mem; - int ok; + int __unused ok; if (safe_mem_hdr_first == NULL) return; diff --git a/lib/libthread_xu/arch/i386/i386/pthread_md.c b/lib/libthread_xu/arch/i386/i386/pthread_md.c index 33c7a6cbca..9621e95639 100644 --- a/lib/libthread_xu/arch/i386/i386/pthread_md.c +++ b/lib/libthread_xu/arch/i386/i386/pthread_md.c @@ -40,9 +40,6 @@ struct tls_tcb * _tcb_ctor(struct pthread *thread, int initial) { struct tls_tcb *tcb; - int flags; - - flags = 0; if (initial) tcb = tls_get_tcb(); diff --git a/lib/libthread_xu/arch/x86_64/x86_64/pthread_md.c b/lib/libthread_xu/arch/x86_64/x86_64/pthread_md.c index 84461a55d5..a8f30887c1 100644 --- a/lib/libthread_xu/arch/x86_64/x86_64/pthread_md.c +++ b/lib/libthread_xu/arch/x86_64/x86_64/pthread_md.c @@ -40,9 +40,6 @@ struct tls_tcb * _tcb_ctor(struct pthread *thread, int initial) { struct tls_tcb *tcb; - int flags; - - flags = 0; if (initial) tcb = tls_get_tcb(); diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c index 8bb9089013..3127cb8251 100644 --- a/libexec/rshd/rshd.c +++ b/libexec/rshd/rshd.c @@ -205,7 +205,7 @@ doit(union sockunion *fromp) char cmdbuf[NCARGS+1], locuser[16], remuser[16]; char fromhost[2 * MAXHOSTNAMELEN + 1]; char numericname[INET6_ADDRSTRLEN]; - int af = fromp->su_family, err; + int af = fromp->su_family, __unused err; #ifdef CRYPT int rc; int pv1[2], pv2[2]; diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index eb7851ac9a..cb13325faf 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -639,7 +639,7 @@ terminaltypeok(char *s) void doit(struct sockaddr *who) { - int err_; /* XXX */ + int __unused err_; /* XXX */ int ptynum; /* diff --git a/libexec/ypxfr/Makefile b/libexec/ypxfr/Makefile index dd090c017b..203ed43d4c 100644 --- a/libexec/ypxfr/Makefile +++ b/libexec/ypxfr/Makefile @@ -14,6 +14,7 @@ WARNS?= 3 MAN= ypxfr.8 CFLAGS+= -I. +CFLAGS+= -Wno-enum-compare DPADD= ${LIBRPCSVC} LDADD= -lrpcsvc diff --git a/sbin/atm/fore_dnld/fore_dnld.c b/sbin/atm/fore_dnld/fore_dnld.c index d7d13c0241..2cf462f13e 100644 --- a/sbin/atm/fore_dnld/fore_dnld.c +++ b/sbin/atm/fore_dnld/fore_dnld.c @@ -1136,7 +1136,7 @@ main( int argc, char **argv ) if ( ns ) { int c1; - int nr; + int __unused nr; nr = read ( fileno(stdin), &c1, 1 ); c1 &= 0xff; diff --git a/sbin/atm/ilmid/ilmid.c b/sbin/atm/ilmid/ilmid.c index 43fb77cb47..44d223893f 100644 --- a/sbin/atm/ilmid/ilmid.c +++ b/sbin/atm/ilmid/ilmid.c @@ -800,7 +800,7 @@ static void parse_oids ( Snmp_Header *h, u_char **bp ) { int len = h->varlen; - int sublen; + int __unused sublen; Variable *var; u_char *bufp = *bp; @@ -2106,7 +2106,7 @@ ilmi_do_state (void) * Loop forever */ for ( ; ; ) { - int count; + int __unused count; int n; u_char *bpp; Snmp_Header *Hdr; diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index c648abed27..f9cea04ee6 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -2762,7 +2762,7 @@ ratecontrol(struct cam_device *device, int retry_count, int timeout, if (spi && syncrate != -1) { int prelim_sync_period; - u_int freq; + u_int __unused freq; if ((cpi.hba_inquiry & PI_SDTR_ABLE) == 0) { warnx("HBA at %s%d is not cable of changing " @@ -3377,7 +3377,8 @@ retry: RPL_LUNDATA_LUN_LUN_MASK); break; case RPL_LUNDATA_ATYP_EXTLUN: { - int field_len, field_len_code, eam_code; + int __unused field_len; + int field_len_code, eam_code; eam_code = lundata->luns[i].lundata[j] & RPL_LUNDATA_EXT_EAM_MASK; diff --git a/sbin/camcontrol/modeedit.c b/sbin/camcontrol/modeedit.c index bf70af1f4c..e7497316f0 100644 --- a/sbin/camcontrol/modeedit.c +++ b/sbin/camcontrol/modeedit.c @@ -864,7 +864,7 @@ mode_list(struct cam_device *device, int page_control, int dbd, int retry_count, int timeout) { u_int8_t data[MAX_COMMAND_SIZE];/* Buffer to hold sense data. */ - u_int8_t *mode_pars; /* Pointer to modepage params. */ + u_int8_t __unused *mode_pars; /* Pointer to modepage params. */ struct scsi_mode_header_6 *mh; /* Location of mode header. */ struct scsi_mode_page_header *mph; struct pagename *nameentry; diff --git a/sbin/ccdconfig/ccdconfig.c b/sbin/ccdconfig/ccdconfig.c index afe74c055a..cc818ea136 100644 --- a/sbin/ccdconfig/ccdconfig.c +++ b/sbin/ccdconfig/ccdconfig.c @@ -410,19 +410,24 @@ pathtounit(char *path, int *unitp) static char * resolve_ccdname(char *name) { - char c, *path; + char *path; +#if 0 + char c; size_t len; +#endif if (name[0] == '/' || name[0] == '.') { /* Assume they gave the correct pathname. */ return (strdup(name)); } +#if 0 len = strlen(name); if (len > 0) c = name[len - 1]; else c = '\0'; +#endif asprintf(&path, "%s%s", _PATH_DEV, name); diff --git a/sbin/cryptdisks/safe_mem.c b/sbin/cryptdisks/safe_mem.c index 56bb07bc9e..43ada09ac7 100644 --- a/sbin/cryptdisks/safe_mem.c +++ b/sbin/cryptdisks/safe_mem.c @@ -149,7 +149,7 @@ check_and_purge_safe_mem(void) { struct safe_mem_hdr *hdr; char *mem; - int ok; + int __unused ok; if (safe_mem_hdr_first == NULL) return; diff --git a/sbin/ffsinfo/ffsinfo.c b/sbin/ffsinfo/ffsinfo.c index 88050d0b5b..03353b001e 100644 --- a/sbin/ffsinfo/ffsinfo.c +++ b/sbin/ffsinfo/ffsinfo.c @@ -128,7 +128,7 @@ rdfs(daddr_t bno, size_t size, void *bf, int fsi) int main(int argc, char **argv) { - char *device, *special, *cp; + char *device, *special, __unused *cp; char ch; size_t len; struct stat st; diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c index a4987eb7dc..b15de6c3c4 100644 --- a/sbin/fsirand/fsirand.c +++ b/sbin/fsirand/fsirand.c @@ -106,7 +106,7 @@ fsirand(char *device) static ssize_t oldibufsize = 0; ssize_t ibufsize; struct fs *sblock; - ino_t inumber, maxino; + ino_t inumber, __unused maxino; daddr_t dblk; char sbuf[SBSIZE], sbuftmp[SBSIZE]; int devfd, n, cg; diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index 7f1180e142..b9cdc6b5a6 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -1915,7 +1915,7 @@ int main(int argc, char **argv) { struct partinfo pinfo; - char *device, *special, *cp; + char *device, *special, __unused *cp; char ch; unsigned int size=0; size_t len; diff --git a/sbin/hammer/cmd_info.c b/sbin/hammer/cmd_info.c index de8fdbc781..271f9dce8e 100644 --- a/sbin/hammer/cmd_info.c +++ b/sbin/hammer/cmd_info.c @@ -75,16 +75,13 @@ show_info(char *path) int64_t usedbigblocks; int64_t usedbytes, rsvbytes; int64_t totalbytes, freebytes; - int error; char *fsid; char buf[6]; - u_int32_t sc; fsid = NULL; usedbigblocks = 0; usedbytes = totalbytes = rsvbytes = freebytes = 0; - sc = error = 0; hvi = libhammer_get_volinfo(path); if (hvi == NULL) { diff --git a/sbin/ldconfig/ldconfig.c b/sbin/ldconfig/ldconfig.c index fc65e6bcbe..80bc095cff 100644 --- a/sbin/ldconfig/ldconfig.c +++ b/sbin/ldconfig/ldconfig.c @@ -64,7 +64,8 @@ int main(int argc, char **argv) { static const char *hints_file; - int c, nostd = 0, justread = 0, merge = 0, rescan = 0; + int c, justread = 0, merge = 0, rescan = 0; + int __unused nostd = 0; if (argc > 1 && strcmp(argv[1], "-elf") == 0) { /* skip over legacy -elf arg */ diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index 73fa50630b..91153c7a03 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -484,7 +484,7 @@ prmount(struct statfs *sfp) { struct passwd *pw; char *buf; - int error; + int __unused error; int len; error = 0; diff --git a/sbin/mount_ext2fs/mount_ext2fs.c b/sbin/mount_ext2fs/mount_ext2fs.c index 79fc19c090..c5da23abba 100644 --- a/sbin/mount_ext2fs/mount_ext2fs.c +++ b/sbin/mount_ext2fs/mount_ext2fs.c @@ -63,11 +63,10 @@ main(int argc, char **argv) { struct ufs_args args; int ch, mntflags; - char *fs_name, *options, mntpath[MAXPATHLEN]; + char *fs_name, mntpath[MAXPATHLEN]; struct vfsconf vfc; int error; - options = NULL; mntflags = 0; while ((ch = getopt(argc, argv, "o:")) != -1) switch (ch) { diff --git a/sbin/mount_ufs/mount.c b/sbin/mount_ufs/mount.c index e91f0218e0..affe955bf8 100644 --- a/sbin/mount_ufs/mount.c +++ b/sbin/mount_ufs/mount.c @@ -474,7 +474,7 @@ prmount(struct statfs *sfp) { struct passwd *pw; char *buf; - int error; + int __unused error; int len; error = 0; diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index 64ee430c89..a456dcbf5a 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -509,7 +509,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp) struct fhreturn fhr; struct stat stb; struct statfs fsb; - struct addrinfo *ai; char host[NI_MAXHOST], numerichost[NI_MAXHOST]; int lookup_failed = 1; struct sockaddr *saddr; @@ -536,7 +535,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp) NULL, 0, 0); getnameinfo(saddr, saddr->sa_len, numerichost, sizeof numerichost, NULL, 0, NI_NUMERICHOST); - ai = NULL; switch (rqstp->rq_proc) { case NULLPROC: if (!svc_sendreply(transp, (xdrproc_t)xdr_void, NULL)) diff --git a/sbin/natd/natd.c b/sbin/natd/natd.c index 2188703a04..f75b03e934 100644 --- a/sbin/natd/natd.c +++ b/sbin/natd/natd.c @@ -1061,7 +1061,7 @@ ParseOption(const char *option, const char *parms) struct OptionInfo* info; int yesNoValue; int aliasValue; - int numValue; + int __unused numValue; u_short uNumValue; const char* strValue; struct in_addr addrValue; diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index ebfc18291f..e07fd5be39 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1140,7 +1140,7 @@ iput(struct ufs1_dinode *ip, ino_t ino) { struct ufs1_dinode inobuf[MAXINOPB]; daddr_t d; - int c; + int __unused c; #ifdef FSIRAND ip->di_gen = random(); diff --git a/sbin/ping6/Makefile b/sbin/ping6/Makefile index 65146ee701..85d678b626 100644 --- a/sbin/ping6/Makefile +++ b/sbin/ping6/Makefile @@ -4,6 +4,8 @@ PROG= ping6 MAN= ping6.8 +WARNS?= 3 + CFLAGS+=-DINET6 -DIPSEC -DHAVE_POLL_H -DHAVE_ARC4RANDOM -DUSE_RFC3542 BINOWN= root diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index a79ad4a101..d7c54ac8fa 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1694,7 +1694,7 @@ pr_ip6opt(void *extbuf, size_t bufsize) struct ip6_hbh *ext; int currentlen; u_int8_t type; - socklen_t extlen, len, origextlen; + socklen_t extlen, len, __unused origextlen; void *databuf; size_t offset; u_int16_t value2; diff --git a/sbin/rcorder/rcorder.c b/sbin/rcorder/rcorder.c index c5b5fb017d..49010a3839 100644 --- a/sbin/rcorder/rcorder.c +++ b/sbin/rcorder/rcorder.c @@ -710,7 +710,8 @@ keep_ok(filenode *fnode) void do_file(filenode *fnode) { - f_reqnode *r, *r_tmp; + f_reqnode *r; + /* f_reqnode *r_tmp; */ f_provnode *p, *p_tmp; provnode *pnode; int was_set; @@ -737,7 +738,7 @@ do_file(filenode *fnode) */ r = fnode->req_list; while (r != NULL) { - r_tmp = r; + /*r_tmp = r;*/ satisfy_req(r, fnode->filename); r = r->next; /*free(r_tmp);*/ diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index 0e8a4ce0f3..7664cb94fb 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -60,7 +60,8 @@ int main(int argc, char *argv[]) { struct passwd *pw; - int ch, howto, i, fd, kflag, lflag, nflag, qflag, pflag, sverrno; + int ch, howto, i, fd, kflag, lflag, nflag, qflag, sverrno; + int __unused pflag; u_int pageins; char *kernel = NULL, *p; const char *user; diff --git a/sbin/udevd/udevd_monitor.c b/sbin/udevd/udevd_monitor.c index 8732c718c4..f0b6421753 100644 --- a/sbin/udevd/udevd_monitor.c +++ b/sbin/udevd/udevd_monitor.c @@ -110,7 +110,7 @@ struct udev_monitor * udev_monitor_init(struct client_info *cli, prop_array_t filters) { struct udev_monitor *udm; - int error; + int __unused error; udm = malloc(sizeof(struct udev_monitor)); if (udm == NULL) diff --git a/sbin/usched/usched.c b/sbin/usched/usched.c index ac0d843fbe..686a46fac1 100644 --- a/sbin/usched/usched.c +++ b/sbin/usched/usched.c @@ -50,7 +50,7 @@ main(int ac, char **av) int res; char *sched = NULL; char *cpustr = NULL; - cpumask_t cpumask = 0; + cpumask_t __unused cpumask = 0; while ((ch = getopt(ac, av, "v")) != -1) { switch(ch) { diff --git a/sbin/vinum/commands.c b/sbin/vinum/commands.c index 615a09a0f6..7c52cc4b01 100644 --- a/sbin/vinum/commands.c +++ b/sbin/vinum/commands.c @@ -430,8 +430,8 @@ initsd(int sdno, int dowait) /* Variables for use by children */ int sdfh; /* and for subdisk */ - int initsize; /* actual size to write */ - int64_t sdsize; /* size of subdisk */ + int __unused initsize; /* actual size to write */ + int64_t __unused sdsize; /* size of subdisk */ if (dowait == 0) { pid = fork(); /* into the background with you */ diff --git a/sys/boot/common/ls.c b/sys/boot/common/ls.c index 27b25abc72..15ac9bc30e 100644 --- a/sys/boot/common/ls.c +++ b/sys/boot/common/ls.c @@ -139,9 +139,8 @@ ls_getdir(char **pathp) struct stat sb; int fd; const char *cp; - char *path, *tail; - - tail = NULL; + char *path; + fd = -1; /* one extra byte for a possible trailing slash required */ diff --git a/sys/boot/pc32/loader/main.c b/sys/boot/pc32/loader/main.c index 7c612084f0..f3255745f4 100644 --- a/sys/boot/pc32/loader/main.c +++ b/sys/boot/pc32/loader/main.c @@ -276,7 +276,7 @@ static void extract_currdev(void) { struct i386_devdesc new_currdev; - int major, biosdev = -1; + int __unused major, biosdev = -1; /* Assume we are booting from a BIOS disk by default */ new_currdev.d_dev = &biosdisk; diff --git a/usr.bin/brandelf/brandelf.c b/usr.bin/brandelf/brandelf.c index d410010c38..90e55b2e70 100644 --- a/usr.bin/brandelf/brandelf.c +++ b/usr.bin/brandelf/brandelf.c @@ -64,7 +64,8 @@ main(int argc, char **argv) const char *strtype = "FreeBSD"; int type = ELFOSABI_FREEBSD; int retval = 0; - int ch, change = 0, verbose = 0, force = 0, listed = 0; + int ch, change = 0, force = 0, listed = 0; + int __unused verbose = 0; while ((ch = getopt(argc, argv, "f:lt:v")) != -1) switch (ch) { diff --git a/usr.bin/bzip2/Makefile b/usr.bin/bzip2/Makefile index b5eb78e998..c50b2e313c 100644 --- a/usr.bin/bzip2/Makefile +++ b/usr.bin/bzip2/Makefile @@ -9,6 +9,7 @@ PROG= bzip2 WARNS?= 2 CFLAGS+= -D_FILE_OFFSET_BITS=64 +CFLAGS+= -Wno-unused-but-set-variable DPADD= ${LIBBZ2} LDADD= -lbz2 diff --git a/usr.bin/dfregress/testcase.c b/usr.bin/dfregress/testcase.c index d400007785..b9435340ba 100644 --- a/usr.bin/dfregress/testcase.c +++ b/usr.bin/dfregress/testcase.c @@ -264,7 +264,7 @@ uid_t testcase_get_runas_uid(prop_dictionary_t testcase) { uint32_t uid = 0; - int r; + int __unused r; r = prop_dictionary_get_uint32( prop_dictionary_get(testcase, "opts"), "runas_uid", &uid); diff --git a/usr.bin/ee/ee.c b/usr.bin/ee/ee.c index 45ea423964..5d3411ed35 100644 --- a/usr.bin/ee/ee.c +++ b/usr.bin/ee/ee.c @@ -3275,7 +3275,6 @@ menu_op(struct menu_entries *menu_list) int temp = 0; int list_size; int top_offset; /* offset from top where menu items start */ - int vert_pos; /* vertical position */ int vert_size; /* vertical size for menu list item display */ int off_start = 1; /* offset from start of menu items to start display */ @@ -3345,7 +3344,6 @@ menu_op(struct menu_entries *menu_list) paint_menu(menu_list, max_width, max_height, list_size, top_offset, temp_win, off_start, vert_size); counter = 1; - vert_pos = 0; do { if (off_start > 2) diff --git a/usr.bin/less/Makefile b/usr.bin/less/Makefile index f80ba04b58..16ced54f7e 100644 --- a/usr.bin/less/Makefile +++ b/usr.bin/less/Makefile @@ -8,6 +8,7 @@ SRCS= main.c screen.c brac.c ch.c charset.c cmdbuf.c \ output.c pattern.c position.c prompt.c search.c signal.c \ tags.c ttyin.c version.c CFLAGS+= -I${.CURDIR} -DSYSDIR=\"/etc\" +CFLAGS+= -Wno-unused-but-set-variable DPADD= ${LIBTERMCAP} LDADD= -ltermcap -- 2.41.0