More -Wunused fallout. sprinkle __unused when possible; otherwise, use the

do { if (&x) {} } while (/* CONSTCOND */ 0);
construct as suggested by uwe in <20061012224845.GA9449@snark.ptc.spbu.ru>.
This commit is contained in:
dogcow 2006-10-13 16:53:35 +00:00
parent c136b6cd0d
commit 2023789a40
15 changed files with 123 additions and 58 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.124 2006/08/30 15:34:31 cube Exp $ */
/* $NetBSD: vm_machdep.c,v 1.125 2006/10/13 16:53:35 dogcow Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.124 2006/08/30 15:34:31 cube Exp $");
__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.125 2006/10/13 16:53:35 dogcow Exp $");
#include "opt_user_ldt.h"
#include "opt_largepages.h"
@ -225,6 +225,8 @@ cpu_swapin(struct lwp *l)
{
#ifndef NOREDZONE
setredzone(l);
#else
do { if (&l) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
#endif
}
@ -237,6 +239,8 @@ cpu_swapout(struct lwp *l)
* Make sure we save the FP state before the user area vanishes.
*/
npxsave_lwp(l, 1);
#else
do { if (&l) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
#endif
}
@ -258,6 +262,8 @@ cpu_lwp_free(struct lwp *l, int proc)
#ifdef MTRR
if (proc && l->l_proc->p_md.md_flags & MDP_USEDMTRR)
mtrr_clean(l->l_proc);
#else
do { if (&proc) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
#endif
/* Nuke the TSS. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: esp_mca.c,v 1.12 2006/03/29 06:58:14 thorpej Exp $ */
/* $NetBSD: esp_mca.c,v 1.13 2006/10/13 16:53:36 dogcow Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: esp_mca.c,v 1.12 2006/03/29 06:58:14 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: esp_mca.c,v 1.13 2006/10/13 16:53:36 dogcow Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -128,8 +128,8 @@ static struct ncr53c9x_glue esp_glue = {
static int
esp_mca_match(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
struct device *parent __unused;
struct cfdata *cf __unused;
void *aux;
{
struct mca_attach_args *ma = aux;
@ -144,7 +144,8 @@ esp_mca_match(parent, cf, aux)
static void
esp_mca_attach(parent, self, aux)
struct device *parent, *self;
struct device *parent __unused;
struct device *self;
void *aux;
{
struct mca_attach_args *ma = aux;
@ -374,7 +375,7 @@ esp_dma_setup(sc, addr, len, datain, dmasize)
caddr_t *addr;
size_t *len;
int datain;
size_t *dmasize;
size_t *dmasize __unused;
{
struct esp_softc *esc = (struct esp_softc *) sc;
int error;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wsdisplay.c,v 1.102 2006/10/12 01:32:06 christos Exp $ */
/* $NetBSD: wsdisplay.c,v 1.103 2006/10/13 16:53:35 dogcow Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.102 2006/10/12 01:32:06 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.103 2006/10/13 16:53:35 dogcow Exp $");
#include "opt_wsdisplay_compat.h"
#include "opt_wsmsgattrs.h"
@ -839,6 +839,8 @@ wsdisplayclose(dev_t dev, int flag, int mode __unused, struct lwp *l)
(void)wsdisplay_internal_ioctl(sc, scr, WSKBDIO_SETMODE,
(caddr_t)&kbmode, 0, l);
}
#else
do { if (&l) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
#endif
scr->scr_flags &= ~SCR_OPEN;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wskbd.c,v 1.95 2006/10/12 01:32:06 christos Exp $ */
/* $NetBSD: wskbd.c,v 1.96 2006/10/13 16:53:35 dogcow Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.95 2006/10/12 01:32:06 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.96 2006/10/13 16:53:35 dogcow Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -1233,6 +1233,8 @@ wskbd_set_console_display(struct device *displaydv, struct wsevsrc *me)
sc->sc_base.me_dispdv = displaydv;
#if NWSMUX > 0
(void)wsmux_attach_sc((struct wsmux_softc *)me, &sc->sc_base);
#else
do { if (&me) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
#endif
return (&sc->sc_base);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_fil_netbsd.c,v 1.25 2006/10/12 01:32:10 christos Exp $ */
/* $NetBSD: ip_fil_netbsd.c,v 1.26 2006/10/13 16:53:36 dogcow Exp $ */
/*
* Copyright (C) 1993-2003 by Darren Reed.
@ -794,6 +794,8 @@ int iplread(
#ifdef IPFILTER_LOG
return ipflog_read(GET_MINOR(dev), uio);
#else
do { if (&dev) {} } while (/* CONSTCOND */ 0); /* make -Wunused */
do { if (&uio) {} } while (/* CONSTCOND */ 0); /* not complain */
return ENXIO;
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_lookup.c,v 1.5 2006/09/17 13:43:15 yamt Exp $ */
/* $NetBSD: ip_lookup.c,v 1.6 2006/10/13 16:53:36 dogcow Exp $ */
/*
* Copyright (C) 2002-2003 by Darren Reed.
@ -533,9 +533,9 @@ void *ptr;
/*ARGSUSED*/
int ip_lookup_ioctl(data, cmd, mode)
caddr_t data;
ioctlcmd_t cmd;
int mode;
caddr_t data __unused;
ioctlcmd_t cmd __unused;
int mode __unused;
{
return EIO;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_nat.c,v 1.16 2006/10/12 01:32:10 christos Exp $ */
/* $NetBSD: ip_nat.c,v 1.17 2006/10/13 16:53:36 dogcow Exp $ */
/*
* Copyright (C) 1995-2003 by Darren Reed.
@ -4579,6 +4579,9 @@ u_int type;
types[0] = 0;
(void) ipllog(IPL_LOGNAT, NULL, items, sizes, types, 1);
#else /* shut up -Wunused */
do { if (&nat) {} } while (/* CONSTCOND */ 0);
do { if (&type) {} } while (/* CONSTCOND */ 0);
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ip_state.c,v 1.12 2006/10/12 01:32:10 christos Exp $ */
/* $NetBSD: ip_state.c,v 1.13 2006/10/13 16:53:36 dogcow Exp $ */
/*
* Copyright (C) 1995-2003 by Darren Reed.
@ -110,7 +110,7 @@ struct file;
#if !defined(lint)
#if defined(__NetBSD__)
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ip_state.c,v 1.12 2006/10/12 01:32:10 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ip_state.c,v 1.13 2006/10/13 16:53:36 dogcow Exp $");
#else
static const char sccsid[] = "@(#)ip_state.c 1.8 6/5/96 (C) 1993-2000 Darren Reed";
static const char rcsid[] = "@(#)Id: ip_state.c,v 2.186.2.41 2006/04/01 10:16:28 darrenr Exp";
@ -3510,6 +3510,9 @@ u_int type;
} else {
ATOMIC_INCL(ips_stats.iss_logfail);
}
#else /* shut up -Wunused */
do { if (&is) {} } while (/* CONSTCOND */ 0);
do { if (&type) {} } while (/* CONSTCOND */ 0);
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_exec.c,v 1.228 2006/10/12 01:32:14 christos Exp $ */
/* $NetBSD: kern_exec.c,v 1.229 2006/10/13 16:53:36 dogcow Exp $ */
/*-
* Copyright (C) 1993, 1994, 1996 Christopher G. Demetriou
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.228 2006/10/12 01:32:14 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.229 2006/10/13 16:53:36 dogcow Exp $");
#include "opt_ktrace.h"
#include "opt_syscall_debug.h"
@ -1365,6 +1365,8 @@ exec_init(int init_boot)
#ifdef DIAGNOSTIC
if (!init_boot)
panic("exec_init(): called with init_boot == 0");
#else /* shut up -Wunused */
do { if (&init_boot) {} } while (/* CONSTCOND */ 0);
#endif
/* do one-time initializations */

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_ktrace.c,v 1.107 2006/10/12 01:32:15 christos Exp $ */
/* $NetBSD: kern_ktrace.c,v 1.108 2006/10/13 16:53:36 dogcow Exp $ */
/*
* Copyright (c) 1989, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.107 2006/10/12 01:32:15 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.108 2006/10/13 16:53:36 dogcow Exp $");
#include "opt_ktrace.h"
#include "opt_compat_mach.h"
@ -1327,6 +1327,8 @@ sys_utrace(struct lwp *l, void *v, register_t *retval __unused)
return (0);
#else /* !KTRACE */
do { if (&l) {} } while (/* CONSTCOND */ 0); /* quiet -Wunused */
do { if (&v) {} } while (/* CONSTCOND */ 0);
return ENOSYS;
#endif /* KTRACE */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_ntptime.c,v 1.38 2006/10/12 01:32:16 christos Exp $ */
/* $NetBSD: kern_ntptime.c,v 1.39 2006/10/13 16:53:36 dogcow Exp $ */
#include <sys/types.h> /* XXX to get __HAVE_TIMECOUNTER, remove
after all ports are converted. */
#ifdef __HAVE_TIMECOUNTER
@ -37,7 +37,7 @@
#include <sys/cdefs.h>
/* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */
__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.38 2006/10/12 01:32:16 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.39 2006/10/13 16:53:36 dogcow Exp $");
#include "opt_ntp.h"
#include "opt_compat_netbsd.h"
@ -503,6 +503,7 @@ ntp_update_second(int64_t *adjustment, time_t *newsec)
time_status &= ~STA_PPSSIGNAL;
#endif /* PPS_SYNC */
#else /* !NTP */
do { if (&newsec) {} } while (/* CONSTCOND */ 0); /* quiet -Wunused */
L_CLR(time_adj);
#endif /* !NTP */
@ -904,7 +905,7 @@ hardpps(struct timespec *tsp, /* time at PPS */
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.38 2006/10/12 01:32:16 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.39 2006/10/13 16:53:36 dogcow Exp $");
#include "opt_ntp.h"
#include "opt_compat_netbsd.h"
@ -1231,9 +1232,9 @@ SYSCTL_SETUP(sysctl_kern_ntptime_setup, "sysctl kern.ntptime node setup")
int
sys___ntp_gettime30(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
struct lwp *l __unused;
void *v __unused;
register_t *retval __unused;
{
return(ENOSYS);
@ -1242,9 +1243,9 @@ sys___ntp_gettime30(l, v, retval)
#ifdef COMPAT_30
int
compat_30_sys_ntp_gettime(l, v, retval)
struct lwp *l;
void *v;
register_t *retval;
struct lwp *l __unused;
void *v __unused;
register_t *retval __unused;
{
return(ENOSYS);

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_subr.c,v 1.147 2006/10/12 01:32:17 christos Exp $ */
/* $NetBSD: kern_subr.c,v 1.148 2006/10/13 16:53:36 dogcow Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.147 2006/10/12 01:32:17 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.148 2006/10/13 16:53:36 dogcow Exp $");
#include "opt_ddb.h"
#include "opt_md.h"
@ -1362,9 +1362,15 @@ int
trace_enter(struct lwp *l, register_t code,
register_t realcode, const struct sysent *callp, void *args)
{
#if defined(SYSCALL_DEBUG) || defined(KTRACE) || defined(PTRACE) || defined(SYSTRACE)
struct proc *p = l->l_proc;
do { if (&code) {} } while (/* CONSTCOND */ 0);
do { if (&realcode) {} } while (/* CONSTCOND */ 0);
do { if (&callp) {} } while (/* CONSTCOND */ 0);
do { if (&args) {} } while (/* CONSTCOND */ 0);
do { if (&p) {} } while (/* CONSTCOND */ 0);
#if defined(SYSCALL_DEBUG) || defined(KTRACE) || defined(PTRACE) || defined(SYSTRACE)
#ifdef SYSCALL_DEBUG
scdebug_call(l, code, args);
#endif /* SYSCALL_DEBUG */
@ -1398,9 +1404,13 @@ void
trace_exit(struct lwp *l, register_t code, void *args __unused,
register_t rval[], int error)
{
#if defined(SYSCALL_DEBUG) || defined(KTRACE) || defined(PTRACE) || defined(SYSTRACE)
struct proc *p = l->l_proc;
do { if (&code) {} } while (/* CONSTCOND */ 0);
do { if (&rval) {} } while (/* CONSTCOND */ 0);
do { if (&error) {} } while (/* CONSTCOND */ 0);
do { if (&p) {} } while (/* CONSTCOND */ 0);
#if defined(SYSCALL_DEBUG) || defined(KTRACE) || defined(PTRACE) || defined(SYSTRACE)
#ifdef SYSCALL_DEBUG
scdebug_ret(l, code, error, rval);
#endif /* SYSCALL_DEBUG */
@ -1425,5 +1435,10 @@ trace_exit(struct lwp *l, register_t code, void *args __unused,
KERNEL_PROC_UNLOCK(l);
}
#endif
#else
do { if (&code) {} } while (/* CONSTCOND */ 0);
do { if (&realcode) {} } while (/* CONSTCOND */ 0);
do { if (&callp) {} } while (/* CONSTCOND */ 0);
do { if (&args) {} } while (/* CONSTCOND */ 0);
#endif /* SYSCALL_DEBUG || {K,P,SYS}TRACE */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_generic.c,v 1.93 2006/10/12 01:32:18 christos Exp $ */
/* $NetBSD: sys_generic.c,v 1.94 2006/10/13 16:53:36 dogcow Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.93 2006/10/12 01:32:18 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: sys_generic.c,v 1.94 2006/10/13 16:53:36 dogcow Exp $");
#include "opt_ktrace.h"
@ -116,6 +116,8 @@ dofileread(struct lwp *l, int fd, struct file *fp, void *buf, size_t nbyte,
int error;
#ifdef KTRACE
struct iovec ktriov = { .iov_base = NULL, };
#else
do { if (&fd) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
#endif
p = l->l_proc;
@ -215,6 +217,8 @@ dofilereadv(struct lwp *l, int fd, struct file *fp, const struct iovec *iovp,
u_int iovlen;
#ifdef KTRACE
struct iovec *ktriov;
#else
do { if (&fd) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
#endif
p = l->l_proc;
@ -344,6 +348,8 @@ dofilewrite(struct lwp *l, int fd, struct file *fp, const void *buf,
int error;
#ifdef KTRACE
struct iovec ktriov = { .iov_base = NULL, };
#else
do { if (&fd) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
#endif
p = l->l_proc;
@ -445,6 +451,8 @@ dofilewritev(struct lwp *l, int fd, struct file *fp, const struct iovec *iovp,
u_int iovlen;
#ifdef KTRACE
struct iovec *ktriov;
#else
do { if (&fd) {} } while (/* CONSTCOND */ 0); /* shut up -Wunused */
#endif
p = l->l_proc;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bridge.c,v 1.42 2006/10/12 01:32:27 christos Exp $ */
/* $NetBSD: if_bridge.c,v 1.43 2006/10/13 16:53:36 dogcow Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@ -80,7 +80,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.42 2006/10/12 01:32:27 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.43 2006/10/13 16:53:36 dogcow Exp $");
#include "opt_bridge_ipf.h"
#include "opt_inet.h"
@ -1164,6 +1164,8 @@ bridge_enqueue(struct bridge_softc *sc, struct ifnet *dst_ifp, struct mbuf *m,
if (m == NULL)
return;
}
#else
do { if (&runfilt) {} } while (/* CONSTCOND */ 0); /* quiet -Wunused */
#endif /* PFIL_HOOKS */
#ifdef ALTQ

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_spppsubr.c,v 1.98 2006/10/12 01:32:28 christos Exp $ */
/* $NetBSD: if_spppsubr.c,v 1.99 2006/10/13 16:53:36 dogcow Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.98 2006/10/12 01:32:28 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.99 2006/10/13 16:53:36 dogcow Exp $");
#include "opt_inet.h"
#include "opt_ipx.h"
@ -3711,61 +3711,77 @@ sppp_ipv6cp_scr(struct sppp *sp)
sppp_cp_send(sp, PPP_IPV6CP, CONF_REQ, sp->confid[IDX_IPV6CP], i, &opt);
}
#else /*INET6*/
static void sppp_ipv6cp_init(struct sppp *sp)
static void
sppp_ipv6cp_init(struct sppp *sp __unused)
{
}
static void sppp_ipv6cp_up(struct sppp *sp)
static void
sppp_ipv6cp_up(struct sppp *sp __unused)
{
}
static void sppp_ipv6cp_down(struct sppp *sp)
static void
sppp_ipv6cp_down(struct sppp *sp __unused)
{
}
static void sppp_ipv6cp_open(struct sppp *sp)
static void
sppp_ipv6cp_open(struct sppp *sp __unused)
{
}
static void sppp_ipv6cp_close(struct sppp *sp)
static void
sppp_ipv6cp_close(struct sppp *sp __unused)
{
}
static void sppp_ipv6cp_TO(void *sp)
static void
sppp_ipv6cp_TO(void *sp __unused)
{
}
static int sppp_ipv6cp_RCR(struct sppp *sp, struct lcp_header *h, int len)
static int
sppp_ipv6cp_RCR(struct sppp *sp __unused, struct lcp_header *h __unused,
int len __unused)
{
return 0;
}
static void sppp_ipv6cp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len)
static void
sppp_ipv6cp_RCN_rej(struct sppp *sp __unused, struct lcp_header *h __unused,
int len __unused)
{
}
static void sppp_ipv6cp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len)
static void
sppp_ipv6cp_RCN_nak(struct sppp *sp __unused, struct lcp_header *h __unused,
int len __unused)
{
}
static void sppp_ipv6cp_tlu(struct sppp *sp)
static void
sppp_ipv6cp_tlu(struct sppp *sp __unused)
{
}
static void sppp_ipv6cp_tld(struct sppp *sp)
static void
sppp_ipv6cp_tld(struct sppp *sp __unused)
{
}
static void sppp_ipv6cp_tls(struct sppp *sp)
static void
sppp_ipv6cp_tls(struct sppp *sp __unused)
{
}
static void sppp_ipv6cp_tlf(struct sppp *sp)
static void
sppp_ipv6cp_tlf(struct sppp *sp __unused)
{
}
static void sppp_ipv6cp_scr(struct sppp *sp)
static void
sppp_ipv6cp_scr(struct sppp *sp __unused)
{
}
#endif /*INET6*/