From 9b19d72862ec030327b619472a0fdd12ace7a4c0 Mon Sep 17 00:00:00 2001 From: ru Date: Mon, 5 Dec 2005 11:58:35 +0000 Subject: [PATCH] Fix -Wundef warnings found when compiling i386 LINT, GENERIC and custom kernels. --- sys/contrib/pf/net/if_pflog.c | 11 +++++ sys/contrib/pf/net/if_pfsync.c | 11 +++++ sys/contrib/pf/net/pf.c | 16 ++++++++ sys/contrib/pf/net/pf_ioctl.c | 16 ++++++++ sys/contrib/pf/net/pf_norm.c | 4 ++ sys/dev/aic7xxx/aic7xxx_osm.h | 2 +- sys/dev/dcons/dcons_os.c | 6 +-- sys/dev/gem/if_gem.c | 2 +- sys/dev/hwpmc/hwpmc_amd.c | 20 +++++----- sys/dev/hwpmc/hwpmc_logging.c | 2 +- sys/dev/hwpmc/hwpmc_mod.c | 28 ++++++------- sys/dev/hwpmc/hwpmc_piv.c | 4 +- sys/dev/ie/if_ie_isa.c | 4 +- sys/dev/lmc/if_lmc.c | 14 +++---- sys/dev/lmc/if_lmc.h | 64 +++++++++++++++--------------- sys/fs/nwfs/nwfs_io.c | 2 +- sys/gnu/fs/ext2fs/ext2_alloc.c | 8 ++-- sys/gnu/fs/ext2fs/ext2_balloc.c | 2 +- sys/gnu/fs/ext2fs/ext2_inode.c | 4 +- sys/gnu/fs/ext2fs/ext2_lookup.c | 2 +- sys/i386/include/bus.h | 2 +- sys/i386/isa/pcvt/pcvt_hdr.h | 3 -- sys/i386/isa/vesa.c | 4 +- sys/i4b/layer1/itjc/i4b_itjc_pci.c | 2 +- sys/i4b/layer2/i4b_l2timer.c | 8 ++-- sys/i4b/layer4/i4b_i4bdrv.c | 2 +- sys/i4b/layer4/i4b_l4.c | 4 +- sys/netipsec/key_debug.c | 2 +- sys/pc98/cbus/scterm-sck.c | 4 +- sys/pc98/include/bus.h | 2 +- 30 files changed, 155 insertions(+), 100 deletions(-) diff --git a/sys/contrib/pf/net/if_pflog.c b/sys/contrib/pf/net/if_pflog.c index 1466ec2b3f8a..671ea2684f47 100644 --- a/sys/contrib/pf/net/if_pflog.c +++ b/sys/contrib/pf/net/if_pflog.c @@ -46,8 +46,19 @@ #elif __FreeBSD__ >= 5 #include "opt_bpf.h" #include "opt_pf.h" + +#ifdef DEV_BPF #define NBPFILTER DEV_BPF +#else +#define NBPFILTER 0 +#endif + +#ifdef DEV_PFLOG #define NPFLOG DEV_PFLOG +#else +#define NPFLOG 0 +#endif + #endif #include diff --git a/sys/contrib/pf/net/if_pfsync.c b/sys/contrib/pf/net/if_pfsync.c index e7f80e2db246..2c7f10ca10b2 100644 --- a/sys/contrib/pf/net/if_pfsync.c +++ b/sys/contrib/pf/net/if_pfsync.c @@ -38,8 +38,19 @@ #elif __FreeBSD__ >= 5 #include "opt_bpf.h" #include "opt_pf.h" + +#ifdef DEV_BPF #define NBPFILTER DEV_BPF +#else +#define NBPFILTER 0 +#endif + +#ifdef DEV_PFSYNC #define NPFSYNC DEV_PFSYNC +#else +#define NPFSYNC 0 +#endif + #endif #include diff --git a/sys/contrib/pf/net/pf.c b/sys/contrib/pf/net/pf.c index c552d820f99d..e68fa5d9b8c2 100644 --- a/sys/contrib/pf/net/pf.c +++ b/sys/contrib/pf/net/pf.c @@ -44,9 +44,25 @@ #ifdef __FreeBSD__ #include "opt_bpf.h" #include "opt_pf.h" + +#ifdef DEV_BPF #define NBPFILTER DEV_BPF +#else +#define NBPFILTER 0 +#endif + +#ifdef DEV_PFLOG #define NPFLOG DEV_PFLOG +#else +#define NPFLOG 0 +#endif + +#ifdef DEV_PFSYNC #define NPFSYNC DEV_PFSYNC +#else +#define NPFSYNC 0 +#endif + #else #include "bpfilter.h" #include "pflog.h" diff --git a/sys/contrib/pf/net/pf_ioctl.c b/sys/contrib/pf/net/pf_ioctl.c index 3fa72a946b38..1141b2f85ff6 100644 --- a/sys/contrib/pf/net/pf_ioctl.c +++ b/sys/contrib/pf/net/pf_ioctl.c @@ -44,9 +44,25 @@ #ifdef __FreeBSD__ #include "opt_bpf.h" #include "opt_pf.h" + +#ifdef DEV_BPF #define NBPFILTER DEV_BPF +#else +#define NBPFILTER 0 +#endif + +#ifdef DEV_PFLOG #define NPFLOG DEV_PFLOG +#else +#define NPFLOG 0 +#endif + +#ifdef DEV_PFSYNC #define NPFSYNC DEV_PFSYNC +#else +#define NPFSYNC 0 +#endif + #else #include "bpfilter.h" #include "pflog.h" diff --git a/sys/contrib/pf/net/pf_norm.c b/sys/contrib/pf/net/pf_norm.c index 50ce270d9d9e..34aea8434365 100644 --- a/sys/contrib/pf/net/pf_norm.c +++ b/sys/contrib/pf/net/pf_norm.c @@ -30,8 +30,12 @@ #include "opt_inet.h" #include "opt_inet6.h" #include "opt_pf.h" +#ifdef DEV_PFLOG #define NPFLOG DEV_PFLOG #else +#define NPFLOG 0 +#endif +#else #include "pflog.h" #endif diff --git a/sys/dev/aic7xxx/aic7xxx_osm.h b/sys/dev/aic7xxx/aic7xxx_osm.h index 159f9f9c31ba..f83ff5db677e 100644 --- a/sys/dev/aic7xxx/aic7xxx_osm.h +++ b/sys/dev/aic7xxx/aic7xxx_osm.h @@ -157,7 +157,7 @@ struct scb_platform_data { }; /***************************** Core Includes **********************************/ -#if AHC_REG_PRETTY_PRINT +#ifdef AHC_REG_PRETTY_PRINT #define AIC_DEBUG_REGISTERS 1 #else #define AIC_DEBUG_REGISTERS 0 diff --git a/sys/dev/dcons/dcons_os.c b/sys/dev/dcons/dcons_os.c index 7a51e1cf38b3..40273a39fdba 100644 --- a/sys/dev/dcons/dcons_os.c +++ b/sys/dev/dcons/dcons_os.c @@ -192,7 +192,7 @@ GDB_DBGPORT(dcons, dcons_dbg_probe, dcons_dbg_init, dcons_dbg_term, extern struct gdb_dbgport *gdb_cur; #endif -#if (KDB || DDB) && ALT_BREAK_TO_DEBUGGER +#if (defined(KDB) || defined(DDB)) && defined(ALT_BREAK_TO_DEBUGGER) static int dcons_check_break(struct dcons_softc *dc, int c) { @@ -549,7 +549,7 @@ dcons_drv_init(int stage) dcons_buf = dg.buf; #if __FreeBSD_version < 502122 -#if DDB && DCONS_FORCE_GDB +#if defined(DDB) && DCONS_FORCE_GDB #if CONS_NODEV gdbconsdev.cn_arg = (void *)&sc[DCONS_GDB]; #if __FreeBSD_version >= 501109 @@ -678,7 +678,7 @@ dcons_modevent(module_t mode, int type, void *data) printf("dcons: unload\n"); callout_stop(&dcons_callout); #if __FreeBSD_version < 502122 -#if DDB && DCONS_FORCE_GDB +#if defined(DDB) && DCONS_FORCE_GDB #if CONS_NODEV gdb_arg = NULL; #else diff --git a/sys/dev/gem/if_gem.c b/sys/dev/gem/if_gem.c index 5f9bae43e7b6..4ffd71eec3bb 100644 --- a/sys/dev/gem/if_gem.c +++ b/sys/dev/gem/if_gem.c @@ -321,7 +321,7 @@ gem_attach(sc) /* Attach the interface. */ ether_ifattach(ifp, sc->sc_enaddr); -#if notyet +#ifdef notyet /* * Add a suspend hook to make sure we come back up after a * resume. diff --git a/sys/dev/hwpmc/hwpmc_amd.c b/sys/dev/hwpmc/hwpmc_amd.c index 3d9282986390..b7cdee808ceb 100644 --- a/sys/dev/hwpmc/hwpmc_amd.c +++ b/sys/dev/hwpmc/hwpmc_amd.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -#if DEBUG +#ifdef DEBUG enum pmc_class amd_pmc_class; #endif @@ -291,7 +291,7 @@ amd_read_pmc(int cpu, int ri, pmc_value_t *v) return 0; } -#if DEBUG +#ifdef DEBUG KASSERT(pd->pm_descr.pd_class == amd_pmc_class, ("[amd,%d] unknown PMC class (%d)", __LINE__, pd->pm_descr.pd_class)); @@ -338,7 +338,7 @@ amd_write_pmc(int cpu, int ri, pmc_value_t v) if (pd->pm_descr.pd_class == PMC_CLASS_TSC) return 0; -#if DEBUG +#ifdef DEBUG KASSERT(pd->pm_descr.pd_class == amd_pmc_class, ("[amd,%d] unknown PMC class (%d)", __LINE__, pd->pm_descr.pd_class)); @@ -474,7 +474,7 @@ amd_allocate_pmc(int cpu, int ri, struct pmc *pm, return 0; } -#if DEBUG +#ifdef DEBUG KASSERT(pd->pd_class == amd_pmc_class, ("[amd,%d] Unknown PMC class (%d)", __LINE__, pd->pd_class)); #endif @@ -536,7 +536,7 @@ amd_allocate_pmc(int cpu, int ri, struct pmc *pm, static int amd_release_pmc(int cpu, int ri, struct pmc *pmc) { -#if DEBUG +#ifdef DEBUG const struct amd_descr *pd; #endif struct pmc_hw *phw; @@ -553,7 +553,7 @@ amd_release_pmc(int cpu, int ri, struct pmc *pmc) KASSERT(phw->phw_pmc == NULL, ("[amd,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); -#if DEBUG +#ifdef DEBUG pd = &amd_pmcdesc[ri]; if (pd->pm_descr.pd_class == amd_pmc_class) KASSERT(AMD_PMC_IS_STOPPED(pd->pm_evsel), @@ -593,7 +593,7 @@ amd_start_pmc(int cpu, int ri) if (pd->pm_descr.pd_class == PMC_CLASS_TSC) return 0; /* TSCs are always running */ -#if DEBUG +#ifdef DEBUG KASSERT(pd->pm_descr.pd_class == amd_pmc_class, ("[amd,%d] unknown PMC class (%d)", __LINE__, pd->pm_descr.pd_class)); @@ -641,7 +641,7 @@ amd_stop_pmc(int cpu, int ri) if (pd->pm_descr.pd_class == PMC_CLASS_TSC) return 0; -#if DEBUG +#ifdef DEBUG KASSERT(pd->pm_descr.pd_class == amd_pmc_class, ("[amd,%d] unknown PMC class (%d)", __LINE__, pd->pm_descr.pd_class)); @@ -890,7 +890,7 @@ amd_cleanup(int cpu) if ((pcs = pmc_pcpu[cpu]) == NULL) return 0; -#if DEBUG +#ifdef DEBUG /* check the TSC */ KASSERT(pcs->pc_hwpmcs[0]->phw_pmc == NULL, ("[amd,%d] CPU%d,PMC0 still in use", __LINE__, cpu)); @@ -948,7 +948,7 @@ pmc_amd_initialize(void) return NULL; } -#if DEBUG +#ifdef DEBUG amd_pmc_class = class; #endif diff --git a/sys/dev/hwpmc/hwpmc_logging.c b/sys/dev/hwpmc/hwpmc_logging.c index 8b6f376b2f02..ff6298e6f04d 100644 --- a/sys/dev/hwpmc/hwpmc_logging.c +++ b/sys/dev/hwpmc/hwpmc_logging.c @@ -203,7 +203,7 @@ pmclog_get_buffer(struct pmc_owner *po) PMCDBG(LOG,GTB,1, "po=%p plb=%p", po, plb); -#if DEBUG +#ifdef DEBUG if (plb) KASSERT(plb->plb_ptr == plb->plb_base && plb->plb_base < plb->plb_fence, diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index ecd83d2a4e08..85b5fa0dfded 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -150,7 +150,7 @@ static LIST_HEAD(, pmc_owner) pmc_ss_owners; * Prototypes */ -#if DEBUG +#ifdef DEBUG static int pmc_debugflags_sysctl_handler(SYSCTL_HANDLER_ARGS); static int pmc_debugflags_parse(char *newstr, char *fence); #endif @@ -202,7 +202,7 @@ static void pmc_unlink_target_process(struct pmc *pmc, SYSCTL_NODE(_kern, OID_AUTO, hwpmc, CTLFLAG_RW, 0, "HWPMC parameters"); -#if DEBUG +#ifdef DEBUG struct pmc_debugflags pmc_debugflags = PMC_DEBUG_DEFAULT_FLAGS; char pmc_debugstr[PMC_DEBUG_STRSIZE]; TUNABLE_STR(PMC_SYSCTL_NAME_PREFIX "debugflags", pmc_debugstr, @@ -301,7 +301,7 @@ static moduledata_t pmc_mod = { DECLARE_MODULE(pmc, pmc_mod, SI_SUB_SMP, SI_ORDER_ANY); MODULE_VERSION(pmc, PMC_VERSION); -#if DEBUG +#ifdef DEBUG enum pmc_dbgparse_state { PMCDS_WS, /* in whitespace */ PMCDS_MAJOR, /* seen a major keyword */ @@ -757,7 +757,7 @@ pmc_link_target_process(struct pmc *pm, struct pmc_process *pp) PMCDBG(PRC,TLK,1, "link-target pmc=%p ri=%d pmc-process=%p", pm, ri, pp); -#if DEBUG +#ifdef DEBUG LIST_FOREACH(pt, &pm->pm_targets, pt_next) if (pt->pt_process == pp) KASSERT(0, ("[pmc,%d] pp %p already in pmc %p targets", @@ -1415,7 +1415,7 @@ pmc_process_csw_out(struct thread *td) */ -#if DEBUG +#ifdef DEBUG const char *pmc_hooknames[] = { "", "EXIT", @@ -1584,7 +1584,7 @@ pmc_hook_handler(struct thread *td, int function, void *arg) break; default: -#if DEBUG +#ifdef DEBUG KASSERT(0, ("[pmc,%d] unknown hook %d\n", __LINE__, function)); #endif break; @@ -1766,7 +1766,7 @@ pmc_destroy_pmc_descriptor(struct pmc *pm) { (void) pm; -#if DEBUG +#ifdef DEBUG KASSERT(pm->pm_state == PMC_STATE_DELETED || pm->pm_state == PMC_STATE_FREE, ("[pmc,%d] destroying non-deleted PMC", __LINE__)); @@ -1783,7 +1783,7 @@ pmc_destroy_pmc_descriptor(struct pmc *pm) static void pmc_wait_for_pmc_idle(struct pmc *pm) { -#if DEBUG +#ifdef DEBUG volatile int maxloop; maxloop = 100 * mp_ncpus; @@ -1794,7 +1794,7 @@ pmc_wait_for_pmc_idle(struct pmc *pm) * comes down to zero. */ while (atomic_load_acq_32(&pm->pm_runcount) > 0) { -#if DEBUG +#ifdef DEBUG maxloop--; KASSERT(maxloop > 0, ("[pmc,%d] (ri%d, rc%d) waiting too long for " @@ -2344,7 +2344,7 @@ pmc_stop(struct pmc *pm) } -#if DEBUG +#ifdef DEBUG static const char *pmc_op_to_name[] = { #undef __PMC_OP #define __PMC_OP(N, D) #N , @@ -3282,7 +3282,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args) pprw = (struct pmc_op_pmcrw *) arg; -#if DEBUG +#ifdef DEBUG if (prw.pm_flags & PMC_F_NEWVALUE) PMCDBG(PMC,OPS,2, "rw id=%d new %jx -> old %jx", ri, prw.pm_value, oldvalue); @@ -3921,7 +3921,7 @@ pmc_initialize(void) md = NULL; error = 0; -#if DEBUG +#ifdef DEBUG /* parse debug flags first */ if (TUNABLE_STR_FETCH(PMC_SYSCTL_NAME_PREFIX "debugflags", pmc_debugstr, sizeof(pmc_debugstr))) @@ -4071,7 +4071,7 @@ pmc_cleanup(void) struct pmc_ownerhash *ph; struct pmc_owner *po, *tmp; struct pmc_binding pb; -#if DEBUG +#ifdef DEBUG struct pmc_processhash *prh; #endif @@ -4121,7 +4121,7 @@ pmc_cleanup(void) mtx_destroy(&pmc_processhash_mtx); if (pmc_processhash) { -#if DEBUG +#ifdef DEBUG struct pmc_process *pp; PMCDBG(MOD,INI,3, "%s", "destroy process hash"); diff --git a/sys/dev/hwpmc/hwpmc_piv.c b/sys/dev/hwpmc/hwpmc_piv.c index 586fecdbcd83..d0c1af84504a 100644 --- a/sys/dev/hwpmc/hwpmc_piv.c +++ b/sys/dev/hwpmc/hwpmc_piv.c @@ -757,7 +757,7 @@ p4_read_pmc(int cpu, int ri, pmc_value_t *v) if (ri == 0) { /* TSC */ -#if DEBUG +#ifdef DEBUG pc = (struct p4_cpu *) pmc_pcpu[cpu]; phw = pc->pc_hwpmcs[ri]; pm = phw->phw_pmc; @@ -840,7 +840,7 @@ p4_write_pmc(int cpu, int ri, pmc_value_t v) * timekeeping and other system functions. */ if (ri == 0) { -#if DEBUG +#ifdef DEBUG pc = (struct p4_cpu *) pmc_pcpu[cpu]; phw = pc->pc_hwpmcs[ri]; pm = phw->phw_pmc; diff --git a/sys/dev/ie/if_ie_isa.c b/sys/dev/ie/if_ie_isa.c index 564176f17df6..120a0936be0c 100644 --- a/sys/dev/ie/if_ie_isa.c +++ b/sys/dev/ie/if_ie_isa.c @@ -123,7 +123,7 @@ ie_isa_3C507_identify (driver_t *driver, device_t parent) port += IE_3C507_IOSIZE) { if (ie_3C507_port_check(port)) { -#if DEBUG +#ifdef DEBUG if (bootverbose) { device_printf(parent, "(if_ie) (3C507) not found at port %#x\n", @@ -339,7 +339,7 @@ ie_isa_ee16_identify (driver_t *driver, device_t parent) port = ports[i]; if (ie_ee16_port_check(port)) { -#if DEBUG +#ifdef DEBUG if (bootverbose) { device_printf(parent, "if_ie: (EE16) not found at port %#x\n", diff --git a/sys/dev/lmc/if_lmc.c b/sys/dev/lmc/if_lmc.c index e4dfdfe712c0..965792040564 100644 --- a/sys/dev/lmc/if_lmc.c +++ b/sys/dev/lmc/if_lmc.c @@ -2807,7 +2807,7 @@ rxintr_cleanup(softc_t *sc) struct mbuf *new_mbuf; int pkt_len, desc_len; -#if (defined(__FreeBSD__) && DEVICE_POLLING) +#if (defined(__FreeBSD__) && defined(DEVICE_POLLING)) /* Input packet flow control (livelock prevention): */ /* Give pkts to higher levels only if quota is > 0. */ if (sc->quota <= 0) return 0; @@ -2923,7 +2923,7 @@ rxintr_cleanup(softc_t *sc) sc->ifp->if_ipackets++; LMC_BPF_MTAP(first_mbuf); #endif -#if (defined(__FreeBSD__) && DEVICE_POLLING) +#if (defined(__FreeBSD__) && defined(DEVICE_POLLING)) sc->quota--; #endif @@ -3947,7 +3947,7 @@ user_interrupt(softc_t *sc, int check_status) #if BSD -# if (defined(__FreeBSD__) && DEVICE_POLLING) +# if (defined(__FreeBSD__) && defined(DEVICE_POLLING)) /* Service the card from the kernel idle loop without interrupts. */ static void @@ -3986,7 +3986,7 @@ bsd_interrupt(void *arg) if ((READ_CSR(TLP_STATUS) & TLP_INT_TXRX) == 0) return IRQ_NONE; -# if (defined(__FreeBSD__) && DEVICE_POLLING) +# if (defined(__FreeBSD__) && defined(DEVICE_POLLING)) if (sc->ifp->if_capenable & IFCAP_POLLING) return IRQ_NONE; @@ -4464,7 +4464,7 @@ raw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) switch (cmd) { -# if (defined(__FreeBSD__) && DEVICE_POLLING) /* XXX necessary? */ +# if (defined(__FreeBSD__) && defined(DEVICE_POLLING)) /* XXX necessary? */ case SIOCSIFCAP: # endif case SIOCSIFDSTADDR: @@ -4815,7 +4815,7 @@ setup_ifnet(struct ifnet *ifp) ifp->if_mtu = MAX_DESC_LEN; /* sppp & p2p change this */ ifp->if_type = IFT_PTPSERIAL; /* p2p changes this */ -# if (defined(__FreeBSD__) && DEVICE_POLLING) +# if (defined(__FreeBSD__) && defined(DEVICE_POLLING)) ifp->if_capabilities |= IFCAP_POLLING; # if (__FreeBSD_version < 500000) ifp->if_capenable |= IFCAP_POLLING; @@ -4916,7 +4916,7 @@ ifnet_detach(softc_t *sc) ifmedia_delete_instance(&sc->ifm, IFM_INST_ANY); # endif -# if (defined(__FreeBSD__) && DEVICE_POLLING) +# if (defined(__FreeBSD__) && defined(DEVICE_POLLING)) if (sc->ifp->if_capenable & IFCAP_POLLING) ether_poll_deregister(sc->ifp); # endif diff --git a/sys/dev/lmc/if_lmc.h b/sys/dev/lmc/if_lmc.h index 2d024bd264e3..734b768c02f8 100644 --- a/sys/dev/lmc/if_lmc.h +++ b/sys/dev/lmc/if_lmc.h @@ -620,7 +620,7 @@ # define LMCIOCREAD _IOWR('i', 243, struct ioctl) # define LMCIOCWRITE _IOW('i', 244, struct ioctl) # define LMCIOCTL _IOWR('i', 245, struct ioctl) -#elif __linux__ /* sigh */ +#elif defined(__linux__) /* sigh */ # define LMCIOCGSTAT SIOCDEVPRIVATE+0 # define LMCIOCGCFG SIOCDEVPRIVATE+1 # define LMCIOCSCFG SIOCDEVPRIVATE+2 @@ -984,7 +984,7 @@ struct dma_desc #endif u_int32_t address1; /* buffer1 bus address */ u_int32_t address2; /* buffer2 bus address */ -#if (__FreeBSD__ || __NetBSD__ || __OpenBSD__) +#if (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) bus_dmamap_t map; /* bus dmamap for this descriptor */ # define TLP_BUS_DSL_VAL (sizeof(bus_dmamap_t) & TLP_BUS_DSL) #else @@ -1029,13 +1029,13 @@ struct desc_ring u_int32_t dma_addr; /* bus address for desc array */ int size_descs; /* bus_dmamap_sync needs this */ int num_descs; /* used to set rx quota */ -#if __linux__ +#ifdef __linux__ struct sk_buff *head; /* tail-queue of skbuffs */ struct sk_buff *tail; #elif BSD struct mbuf *head; /* tail-queue of mbufs */ struct mbuf *tail; -# if (__FreeBSD__ || __NetBSD__ || __OpenBSD__) +# if (defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) bus_dma_tag_t tag; /* bus_dma tag for desc array */ bus_dmamap_t map; /* bus_dma map for desc array */ bus_dma_segment_t segs[2]; /* bus_dmamap_load() or bus_dmamem_alloc() */ @@ -1068,13 +1068,13 @@ struct card */ #define IOREF_CSR 1 /* access Tulip CSRs with IO cycles if 1 */ -#if (__FreeBSD__ && DEVICE_POLLING) +#if (defined(__FreeBSD__) && defined(DEVICE_POLLING)) # define DEV_POLL 1 #else # define DEV_POLL 0 #endif -#if (ALTQ != 0) +#if defined(ALTQ) && ALTQ # define ALTQ_PRESENT 1 #else # define ALTQ_PRESENT 0 @@ -1085,7 +1085,7 @@ struct card /* FreeBSD wants struct ifnet first in the softc. */ struct softc { -#if (__NetBSD__ || __OpenBSD__) +#if (defined(__NetBSD__) || defined(__OpenBSD__)) struct device dev; /* base device -- must be first in softc */ pcitag_t pa_tag; /* pci_conf_read/write need this */ pci_chipset_tag_t pa_pc; /* pci_conf_read/write need this */ @@ -1100,7 +1100,7 @@ struct softc struct mbuf *tx_mbuf; /* hang mbuf here while building dma descs */ #endif /* __NetBSD__ || __OpenBSD__ */ -#if __bsdi__ +#ifdef __bsdi__ struct device dev; /* base device -- must be first in softc */ struct isadev id; /* bus resource */ struct intrhand ih; /* interrupt vectoring */ @@ -1130,7 +1130,7 @@ struct softc # endif #endif -#if __linux__ +#ifdef __linux__ # if GEN_HDLC hdlc_device *hdlc_dev; /* state for HDLC code */ sync_serial_settings hdlc_settings; /* state set by sethdlc program */ @@ -1152,7 +1152,7 @@ struct softc # endif #endif -#if __FreeBSD__ +#ifdef __FreeBSD__ struct device *dev; /* base device pointer */ bus_space_tag_t csr_tag; /* bus_space needs this */ bus_space_handle_t csr_handle;/* bus_space_needs this */ @@ -1163,7 +1163,7 @@ struct softc int csr_res_id; /* bus_release resource needs this */ int csr_res_type; /* bus_release resource needs this */ struct mbuf *tx_mbuf; /* hang mbuf here while building dma descs */ -# if DEVICE_POLLING +# ifdef DEVICE_POLLING int quota; /* used for incoming packet flow control */ # endif # if (__FreeBSD_version >= 500000) @@ -1175,7 +1175,7 @@ struct softc # endif #endif /* __FreeBSD__ */ -#if __linux__ +#ifdef __linux__ struct pci_dev *pci_dev; /* READ/WRITE_PCI_CFG macros need this */ struct net_device *net_dev; /* NAME_UNIT macro needs this */ struct timer_list wd_timer; /* timer calls watchdog() once a second */ @@ -1210,7 +1210,7 @@ struct softc /* Hide the minor differences between OS versions */ -#if __FreeBSD__ +#ifdef __FreeBSD__ typedef void intr_return_t; # define READ_PCI_CFG(sc, addr) pci_read_config ((sc)->dev, addr, 4) # define WRITE_PCI_CFG(sc, addr, data) pci_write_config((sc)->dev, addr, data, 4) @@ -1262,7 +1262,7 @@ struct softc # endif #endif /* __FreeBSD__ */ -#if __NetBSD__ +#ifdef __NetBSD__ typedef int intr_return_t; # define READ_PCI_CFG(sc, addr) pci_conf_read ((sc)->pa_pc, (sc)->pa_tag, addr) # define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data) @@ -1291,7 +1291,7 @@ struct softc # endif #endif /* __NetBSD__ */ -#if __OpenBSD__ +#ifdef __OpenBSD__ typedef int intr_return_t; # define READ_PCI_CFG(sc, addr) pci_conf_read ((sc)->pa_pc, (sc)->pa_tag, addr) # define WRITE_PCI_CFG(sc, addr, data) pci_conf_write((sc)->pa_pc, (sc)->pa_tag, addr, data) @@ -1320,7 +1320,7 @@ struct softc # endif #endif /* __OpenBSD__ */ -#if __bsdi__ +#ifdef __bsdi__ typedef int intr_return_t; # define READ_PCI_CFG(sc, addr) pci_inl(&(sc)->cfgbase, addr) # define WRITE_PCI_CFG(sc, addr, data) pci_outl(&(sc)->cfgbase, addr, data) @@ -1368,7 +1368,7 @@ struct softc # endif #endif /* __bsdi__ */ -#if __linux__ +#ifdef __linux__ static u_int32_t /* inline? so rare it doesn't matter */ READ_PCI_CFG(softc_t *sc, u_int32_t addr) { @@ -1423,10 +1423,10 @@ READ_PCI_CFG(softc_t *sc, u_int32_t addr) # define LMC_BPF_DETACH /* nothing */ #endif -#if (__bsdi__ || /* unconditionally */ \ - (__FreeBSD__ && (__FreeBSD_version < 503000)) || \ - (__NetBSD__ && (__NetBSD_Version__ < 106000000)) || \ - (__OpenBSD__ && ( OpenBSD < 200111))) +#if (defined(__bsdi__) || /* unconditionally */ \ + (defined(__FreeBSD__) && (__FreeBSD_version < 503000)) || \ + (defined(__NetBSD__) && (__NetBSD_Version__ < 106000000)) || \ + (defined(__OpenBSD__) && ( OpenBSD < 200111))) # define IFQ_ENQUEUE(ifq, m, pa, err) \ do { \ if (pa==0); /* suppress warning */ \ @@ -1527,8 +1527,8 @@ static void t1_send_bop(softc_t *, int); static int t1_ioctl(softc_t *, struct ioctl *); #if IFNET -# if ((__FreeBSD__ && (__FreeBSD_version < 500000)) ||\ - __NetBSD__ || __OpenBSD__ || __bsdi__) +# if ((defined(__FreeBSD__) && (__FreeBSD_version < 500000)) ||\ + defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)) static void netisr_dispatch(int, struct mbuf *); # endif static void raw_input(struct ifnet *, struct mbuf *); @@ -1537,7 +1537,7 @@ static void raw_input(struct ifnet *, struct mbuf *); #if BSD static void mbuf_enqueue(struct desc_ring *, struct mbuf *); static struct mbuf* mbuf_dequeue(struct desc_ring *); -# if __FreeBSD__ +# ifdef __FreeBSD__ static void fbsd_dmamap_load(void *, bus_dma_segment_t *, int, int); # endif static int create_ring(softc_t *, struct desc_ring *, int); @@ -1549,7 +1549,7 @@ static int txintr_setup_mbuf(softc_t *, struct mbuf *); static int txintr_setup(softc_t *); #endif /* BSD */ -#if __linux__ +#ifdef __linux__ static void skbuff_enqueue(struct desc_ring *, struct sk_buff *); static struct sk_buff* skbuff_dequeue(struct desc_ring *); static int create_ring(softc_t *, struct desc_ring *, int); @@ -1566,7 +1566,7 @@ static void check_intr_status(softc_t *); static void core_interrupt(void *, int); static void user_interrupt(softc_t *, int); #if BSD -# if (__FreeBSD__ && DEVICE_POLLING) +# if (defined(__FreeBSD__) && defined(DEVICE_POLLING)) static void fbsd_poll(struct ifnet *, enum poll_cmd, int); # endif static intr_return_t bsd_interrupt(void *); @@ -1593,7 +1593,7 @@ static void ifnet_start(struct ifnet *); static int raw_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); static void ifnet_watchdog(struct ifnet *); -# if __OpenBSD__ +# ifdef __OpenBSD__ static int ifmedia_change(struct ifnet *); static void ifmedia_status(struct ifnet *, struct ifmediareq *); # endif /* __OpenBSD__ */ @@ -1635,14 +1635,14 @@ static void shutdown_card(void *); static int attach_card(softc_t *, const char *); static void detach_card(softc_t *); -#if __FreeBSD__ +#ifdef __FreeBSD__ static int fbsd_probe(device_t); static int fbsd_detach(device_t); static void fbsd_shutdown(device_t); static int fbsd_attach(device_t); #endif /* __FreeBSD__ */ -#if __NetBSD__ +#ifdef __NetBSD__ static int nbsd_match(struct device *t, struct cfdata *, void *); static int nbsd_detach(struct device *, int); static void nbsd_attach(struct device *, struct device *, void *); @@ -1650,20 +1650,20 @@ static int lkm_nbsd_match(struct pci_attach_args *); int if_lmc_lkmentry(struct lkm_table *, int, int); #endif /* __NetBSD__ */ -#if __OpenBSD__ +#ifdef __OpenBSD__ static int obsd_match(struct device *, void *, void *); static int obsd_detach(struct device *, int); static void obsd_attach(struct device *, struct device *, void *); int if_lmc_lkmentry(struct lkm_table *, int, int); #endif /* __OpenBSD__ */ -#if __bsdi__ +#ifdef __bsdi__ static int bsdi_match(pci_devaddr_t *); static int bsdi_probe(struct device *, struct cfdata *, void *); static void bsdi_attach(struct device *, struct device *, void *); #endif /* __bsdi__ */ -#if __linux__ +#ifdef __linux__ static irqreturn_t linux_interrupt(int, void *, struct pt_regs *); static int linux_poll(struct net_device *, int *); static int linux_start(struct sk_buff *, struct net_device *); diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c index 0b697560ccd9..8fdd18a13d5e 100644 --- a/sys/fs/nwfs/nwfs_io.c +++ b/sys/fs/nwfs/nwfs_io.c @@ -226,7 +226,7 @@ nwfs_writevnode(vp, uiop, cred, ioflag) /* We can relay only on local information about file size, * because until file is closed NetWare will not return * the correct size. */ -#if notyet +#ifdef notyet nwfs_attr_cacheremove(vp); error = VOP_GETATTR(vp, &vattr, cred, td); if (error) return (error); diff --git a/sys/gnu/fs/ext2fs/ext2_alloc.c b/sys/gnu/fs/ext2fs/ext2_alloc.c index 8acfda8f1536..190a47264e57 100644 --- a/sys/gnu/fs/ext2fs/ext2_alloc.c +++ b/sys/gnu/fs/ext2fs/ext2_alloc.c @@ -102,7 +102,7 @@ ext2_alloc(ip, lbn, bpref, size, cred, bnp) *bnp = 0; fs = ip->i_e2fs; -#if DIAGNOSTIC +#ifdef DIAGNOSTIC if ((u_int)size > fs->s_blocksize || blkoff(fs, size) != 0) { vn_printf(ip->i_devvp, "bsize = %lu, size = %d, fs = %s\n", fs->s_blocksize, size, fs->fs_fsmnt); @@ -225,7 +225,7 @@ return ENOSPC; len = buflist->bs_nchildren; start_lbn = buflist->bs_children[0]->b_lblkno; end_lbn = start_lbn + len - 1; -#if DIAGNOSTIC +#ifdef DIAGNOSTIC for (i = 1; i < len; i++) if (buflist->bs_children[i]->b_lblkno != start_lbn + i) panic("ext2_reallocblks: non-cluster"); @@ -266,7 +266,7 @@ return ENOSPC; if (end_lvl == 0 || (idp = &end_ap[end_lvl - 1])->in_off + 1 >= len) { ssize = len; } else { -#if DIAGNOSTIC +#ifdef DIAGNOSTIC if (start_ap[start_lvl-1].in_lbn == idp->in_lbn) panic("ext2_reallocblk: start == end"); #endif @@ -292,7 +292,7 @@ return ENOSPC; for (bap = &sbap[soff], i = 0; i < len; i++, blkno += fs->s_frags_per_block) { if (i == ssize) bap = ebap; -#if DIAGNOSTIC +#ifdef DIAGNOSTIC if (buflist->bs_children[i]->b_blkno != fsbtodb(fs, *bap)) panic("ext2_reallocblks: alloc mismatch"); #endif diff --git a/sys/gnu/fs/ext2fs/ext2_balloc.c b/sys/gnu/fs/ext2fs/ext2_balloc.c index f15a9606ea68..e46414c5bf99 100644 --- a/sys/gnu/fs/ext2fs/ext2_balloc.c +++ b/sys/gnu/fs/ext2fs/ext2_balloc.c @@ -159,7 +159,7 @@ ext2_debug("ext2_balloc called (%d, %d, %d)\n", pref = 0; if ((error = ext2_getlbns(vp, bn, indirs, &num)) != 0) return(error); -#if DIAGNOSTIC +#ifdef DIAGNOSTIC if (num < 1) panic ("ext2_balloc: ext2_getlbns returned indirect block"); #endif diff --git a/sys/gnu/fs/ext2fs/ext2_inode.c b/sys/gnu/fs/ext2fs/ext2_inode.c index 8f1b21e76de4..9f84fd4590fa 100644 --- a/sys/gnu/fs/ext2fs/ext2_inode.c +++ b/sys/gnu/fs/ext2fs/ext2_inode.c @@ -138,7 +138,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length); oip = VTOI(ovp); if (ovp->v_type == VLNK && oip->i_size < ovp->v_mount->mnt_maxsymlinklen) { -#if DIAGNOSTIC +#ifdef DIAGNOSTIC if (length != 0) panic("ext2_truncate: partial truncate of symlink"); #endif @@ -318,7 +318,7 @@ printf("ext2_truncate called %d to %d\n", VTOI(ovp)->i_number, length); } } done: -#if DIAGNOSTIC +#ifdef DIAGNOSTIC for (level = SINGLE; level <= TRIPLE; level++) if (newblks[NDADDR + level] != oip->i_ib[level]) panic("itrunc1"); diff --git a/sys/gnu/fs/ext2fs/ext2_lookup.c b/sys/gnu/fs/ext2fs/ext2_lookup.c index d057e2a9d079..f2ac67956bc8 100644 --- a/sys/gnu/fs/ext2fs/ext2_lookup.c +++ b/sys/gnu/fs/ext2fs/ext2_lookup.c @@ -765,7 +765,7 @@ ext2_direnter(ip, dvp, cnp) int DIRBLKSIZ = ip->i_e2fs->s_blocksize; -#if DIAGNOSTIC +#ifdef DIAGNOSTIC if ((cnp->cn_flags & SAVENAME) == 0) panic("direnter: missing name"); #endif diff --git a/sys/i386/include/bus.h b/sys/i386/include/bus.h index b3a99511e13c..bfbc6a7b4599 100644 --- a/sys/i386/include/bus.h +++ b/sys/i386/include/bus.h @@ -1084,7 +1084,7 @@ bus_space_barrier(bus_space_tag_t tag __unused, bus_space_handle_t bsh __unused, #endif } -#if BUS_SPACE_NO_LEGACY +#ifdef BUS_SPACE_NO_LEGACY #undef inb #undef outb #define inb(a) compiler_error diff --git a/sys/i386/isa/pcvt/pcvt_hdr.h b/sys/i386/isa/pcvt/pcvt_hdr.h index 481c0374ba11..74f8ec893263 100644 --- a/sys/i386/isa/pcvt/pcvt_hdr.h +++ b/sys/i386/isa/pcvt/pcvt_hdr.h @@ -109,12 +109,9 @@ #if !(PCVT_SLOW_INTERRUPT) # define PCVT_DISABLE_INTR() disable_intr() # define PCVT_ENABLE_INTR() enable_intr() -# undef PCVT_SLOW_INTERRUPT #else # define PCVT_DISABLE_INTR() s = spltty() # define PCVT_ENABLE_INTR() splx(s) -# undef PCVT_SLOW_INTERRUPT -# define PCVT_SLOW_INTERRUPT 1 #endif #ifdef XSERVER diff --git a/sys/i386/isa/vesa.c b/sys/i386/isa/vesa.c index 5fadfbef4044..2fe79bf0f500 100644 --- a/sys/i386/isa/vesa.c +++ b/sys/i386/isa/vesa.c @@ -1173,7 +1173,7 @@ vesa_save_palette(video_adapter_t *adp, u_char *palette) static int vesa_load_palette(video_adapter_t *adp, u_char *palette) { -#if notyet +#ifdef notyet int bits; int error; @@ -1393,7 +1393,7 @@ set_palette(video_adapter_t *adp, int base, int count, u_char *red, u_char *green, u_char *blue, u_char *trans) { return 1; -#if notyet +#ifdef notyet u_char *r; u_char *g; u_char *b; diff --git a/sys/i4b/layer1/itjc/i4b_itjc_pci.c b/sys/i4b/layer1/itjc/i4b_itjc_pci.c index 773a84d55d7b..cbb14e146b02 100644 --- a/sys/i4b/layer1/itjc/i4b_itjc_pci.c +++ b/sys/i4b/layer1/itjc/i4b_itjc_pci.c @@ -1901,7 +1901,7 @@ itjc_bchannel_setup(int unit, int h_chan, int bprot, int activate) static void itjc_bchannel_start(int unit, int h_chan) { -#if Buggy_code +#if 0 /* Buggy code */ /* * I disabled this routine because it was causing crashes when * this driver was used with the ISP (kernel SPPP) protocol driver. diff --git a/sys/i4b/layer2/i4b_l2timer.c b/sys/i4b/layer2/i4b_l2timer.c index 22d3a9aa4ef7..05ff31e87ada 100644 --- a/sys/i4b/layer2/i4b_l2timer.c +++ b/sys/i4b/layer2/i4b_l2timer.c @@ -161,7 +161,7 @@ i4b_T202_stop(l2_softc_t *l2sc) /*---------------------------------------------------------------------------* * Q.921 timer T203 timeout function *---------------------------------------------------------------------------*/ -#if I4B_T203_ACTIVE +#if defined(I4B_T203_ACTIVE) && I4B_T203_ACTIVE static void i4b_T203_timeout(l2_softc_t *l2sc) { @@ -176,7 +176,7 @@ i4b_T203_timeout(l2_softc_t *l2sc) void i4b_T203_start(l2_softc_t *l2sc) { -#if I4B_T203_ACTIVE +#if defined(I4B_T203_ACTIVE) && I4B_T203_ACTIVE if (l2sc->T203 == TIMER_ACTIVE) return; @@ -193,7 +193,7 @@ i4b_T203_start(l2_softc_t *l2sc) void i4b_T203_stop(l2_softc_t *l2sc) { -#if I4B_T203_ACTIVE +#if defined(I4B_T203_ACTIVE) && I4B_T203_ACTIVE CRIT_VAR; CRIT_BEG; if(l2sc->T203 != TIMER_IDLE) @@ -212,7 +212,7 @@ i4b_T203_stop(l2_softc_t *l2sc) void i4b_T203_restart(l2_softc_t *l2sc) { -#if I4B_T203_ACTIVE +#if defined(I4B_T203_ACTIVE) && I4B_T203_ACTIVE CRIT_VAR; CRIT_BEG; diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c index 16d0ade2c444..4a53c7014096 100644 --- a/sys/i4b/layer4/i4b_i4bdrv.c +++ b/sys/i4b/layer4/i4b_i4bdrv.c @@ -441,7 +441,7 @@ i4bioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td break; #endif -#if NIBC > 0 +#if defined(NIBC) && NIBC > 0 case BDRV_IBC: dlt = ibc_ret_linktab(mdrsp->driver_unit); break; diff --git a/sys/i4b/layer4/i4b_l4.c b/sys/i4b/layer4/i4b_l4.c index 44a7d4086968..9cdd3e1c5d32 100644 --- a/sys/i4b/layer4/i4b_l4.c +++ b/sys/i4b/layer4/i4b_l4.c @@ -645,7 +645,7 @@ i4b_link_bchandrvr(call_desc_t *cd) break; #endif -#if NIBC > 0 +#if defined(NIBC) && NIBC > 0 case BDRV_IBC: cd->dlt = ibc_ret_linktab(cd->driver_unit); break; @@ -699,7 +699,7 @@ i4b_link_bchandrvr(call_desc_t *cd) break; #endif -#if NIBC > 0 +#if defined(NIBC) && NIBC > 0 case BDRV_IBC: ibc_set_linktab(cd->driver_unit, cd->ilt); break; diff --git a/sys/netipsec/key_debug.c b/sys/netipsec/key_debug.c index 73270a43ab77..97294f3067e7 100644 --- a/sys/netipsec/key_debug.c +++ b/sys/netipsec/key_debug.c @@ -588,7 +588,7 @@ kdebug_secasv(sav) if (sav->lft_s != NULL) kdebug_sadb_lifetime((struct sadb_ext *)sav->lft_s); -#if notyet +#ifdef notyet /* XXX: misc[123] ? */ #endif diff --git a/sys/pc98/cbus/scterm-sck.c b/sys/pc98/cbus/scterm-sck.c index 7029c072a799..9b45490ad171 100644 --- a/sys/pc98/cbus/scterm-sck.c +++ b/sys/pc98/cbus/scterm-sck.c @@ -463,7 +463,7 @@ scterm_scan_esc(scr_stat *scp, term_stat *tcp, u_char c) sc_term_up_scroll(scp, 1, sc->scr_map[0x20], tcp->cur_attr, 0, 0); break; -#if notyet +#ifdef notyet case 'Q': tcp->esc = 4; return; @@ -892,7 +892,7 @@ scterm_scan_esc(scr_stat *scp, term_stat *tcp, u_char c) splx(i); break; } -#if notyet +#ifdef notyet } else if (tcp->esc == 4) { /* seen ESC Q */ /* to be filled */ #endif diff --git a/sys/pc98/include/bus.h b/sys/pc98/include/bus.h index 64a8194fa35a..bb10690e3702 100644 --- a/sys/pc98/include/bus.h +++ b/sys/pc98/include/bus.h @@ -565,7 +565,7 @@ bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, __asm __volatile("" : : : "memory"); } -#if BUS_SPACE_NO_LEGACY +#ifdef BUS_SPACE_NO_LEGACY #undef inb #undef outb #define inb(a) compiler_error