Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch - move variables inside their #ifdef use



details:   https://anonhg.NetBSD.org/src/rev/0ca420c058d8
branches:  trunk
changeset: 791130:0ca420c058d8
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Nov 06 06:23:15 2013 +0000

description:
- move variables inside their #ifdef use
- remove unused and set-but-unused variables
- use __USE() in a particularly ugly case

with these, and a couple of other changes, amd64 gcc 4.8.1 world
is able to complete build.sh release.

diffstat:

 sys/arch/amd64/amd64/machdep.c    |   5 +++--
 sys/arch/xen/x86/mainbus.c        |   8 ++++----
 sys/arch/xen/x86/x86_xpmap.c      |   7 +++----
 sys/arch/xen/xen/privcmd.c        |   9 +++------
 sys/arch/xen/xen/xbd_xenbus.c     |   6 ++----
 sys/arch/xen/xen/xbdback_xenbus.c |  10 ++++------
 6 files changed, 19 insertions(+), 26 deletions(-)

diffs (216 lines):

diff -r a2f22a787801 -r 0ca420c058d8 sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c    Wed Nov 06 06:20:12 2013 +0000
+++ b/sys/arch/amd64/amd64/machdep.c    Wed Nov 06 06:23:15 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.197 2013/10/23 20:18:50 drochner Exp $   */
+/*     $NetBSD: machdep.c,v 1.198 2013/11/06 06:23:15 mrg Exp $        */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.197 2013/10/23 20:18:50 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.198 2013/11/06 06:23:15 mrg Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -649,6 +649,7 @@
 {
        static bool syncdone = false;
        int s = IPL_NONE;
+       __USE(s);       /* ugly otherwise */
 
        if (cold) {
                howto |= RB_HALT;
diff -r a2f22a787801 -r 0ca420c058d8 sys/arch/xen/x86/mainbus.c
--- a/sys/arch/xen/x86/mainbus.c        Wed Nov 06 06:20:12 2013 +0000
+++ b/sys/arch/xen/x86/mainbus.c        Wed Nov 06 06:23:15 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.15 2011/09/20 00:12:24 jym Exp $ */
+/*     $NetBSD: mainbus.c,v 1.16 2013/11/06 06:23:15 mrg Exp $ */
 /*     NetBSD: mainbus.c,v 1.53 2003/10/27 14:11:47 junyoung Exp       */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.15 2011/09/20 00:12:24 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.16 2013/11/06 06:23:15 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -133,7 +133,7 @@
 void
 mainbus_attach(device_t parent, device_t self, void *aux)
 {
-#if defined(DOM0OPS) && NPCI > 0
+#if defined(DOM0OPS) && NPCI > 0 && defined(PCI_BUS_FIXUP)
        int mode;
 #endif
        union mainbus_attach_args mba;
@@ -157,8 +157,8 @@
 #endif
 #if NPCI > 0
                /* ACPI needs to be able to access PCI configuration space. */
+#ifdef PCI_BUS_FIXUP
                mode = pci_mode_detect();
-#ifdef PCI_BUS_FIXUP
                if (mode != 0) {
                        pci_maxbus = pci_bus_fixup(NULL, 0);
                        aprint_debug_dev(self, "PCI bus max, after "
diff -r a2f22a787801 -r 0ca420c058d8 sys/arch/xen/x86/x86_xpmap.c
--- a/sys/arch/xen/x86/x86_xpmap.c      Wed Nov 06 06:20:12 2013 +0000
+++ b/sys/arch/xen/x86/x86_xpmap.c      Wed Nov 06 06:23:15 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_xpmap.c,v 1.49 2012/09/16 22:09:34 rmind Exp $     */
+/*     $NetBSD: x86_xpmap.c,v 1.50 2013/11/06 06:23:15 mrg Exp $       */
 
 /*
  * Copyright (c) 2006 Mathieu Ropert <mro%adviseo.fr@localhost>
@@ -69,7 +69,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.49 2012/09/16 22:09:34 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_xpmap.c,v 1.50 2013/11/06 06:23:15 mrg Exp $");
 
 #include "opt_xen.h"
 #include "opt_ddb.h"
@@ -701,7 +701,7 @@
        int old_count, int new_count, int final)
 {
        pd_entry_t *pdtpe, *pde, *pte;
-       pd_entry_t *cur_pgd, *bt_pgd;
+       pd_entry_t *bt_pgd;
        paddr_t addr;
        vaddr_t page, avail, text_end, map_end;
        int i;
@@ -761,7 +761,6 @@
         * - some PTEs (level 1)
         */
        
-       cur_pgd = (pd_entry_t *) old_pgd;
        bt_pgd = (pd_entry_t *) new_pgd;
        memset (bt_pgd, 0, PAGE_SIZE);
        avail = new_pgd + PAGE_SIZE;
diff -r a2f22a787801 -r 0ca420c058d8 sys/arch/xen/xen/privcmd.c
--- a/sys/arch/xen/xen/privcmd.c        Wed Nov 06 06:20:12 2013 +0000
+++ b/sys/arch/xen/xen/privcmd.c        Wed Nov 06 06:23:15 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.44 2012/06/27 00:37:10 jym Exp $ */
+/* $NetBSD: privcmd.c,v 1.45 2013/11/06 06:23:15 mrg Exp $ */
 
 /*-
  * Copyright (c) 2004 Christian Limpach.
@@ -27,7 +27,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.44 2012/06/27 00:37:10 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.45 2013/11/06 06:23:15 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -369,17 +369,15 @@
        {
                int i;
                privcmd_mmapbatch_t* pmb = ap->a_data;
-               vaddr_t va0, va;
+               vaddr_t va0;
                u_long mfn;
                paddr_t ma;
                struct vm_map *vmm;
                struct vm_map_entry *entry;
                vm_prot_t prot;
-               pmap_t pmap;
                vaddr_t trymap;
 
                vmm = &curlwp->l_proc->p_vmspace->vm_map;
-               pmap = vm_map_pmap(vmm);
                va0 = pmb->addr & ~PAGE_MASK;
 
                if (pmb->num == 0)
@@ -409,7 +407,6 @@
                }
 
                for(i = 0; i < pmb->num; ++i) {
-                       va = va0 + (i * PAGE_SIZE);
                        error = copyin(&pmb->arr[i], &mfn, sizeof(mfn));
                        if (error != 0) {
                                /* XXX: mappings */
diff -r a2f22a787801 -r 0ca420c058d8 sys/arch/xen/xen/xbd_xenbus.c
--- a/sys/arch/xen/xen/xbd_xenbus.c     Wed Nov 06 06:20:12 2013 +0000
+++ b/sys/arch/xen/xen/xbd_xenbus.c     Wed Nov 06 06:23:15 2013 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbd_xenbus.c,v 1.60 2013/10/13 06:55:34 riz Exp $      */
+/*      $NetBSD: xbd_xenbus.c,v 1.61 2013/11/06 06:23:15 mrg Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.60 2013/10/13 06:55:34 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.61 2013/11/06 06:23:15 mrg Exp $");
 
 #include "opt_xen.h"
 
@@ -821,7 +821,6 @@
            device_lookup_private(&xbd_cd, DISKUNIT(dev));
        struct  dk_softc *dksc;
        int     error;
-       struct  disk *dk;
        int s;
        struct xbd_req *xbdreq;
        blkif_request_t *req;
@@ -830,7 +829,6 @@
        DPRINTF(("xbdioctl(%d, %08lx, %p, %d, %p)\n",
            dev, cmd, data, flag, l));
        dksc = &sc->sc_dksc;
-       dk = &dksc->sc_dkdev;
 
        error = disk_ioctl(&sc->sc_dksc.sc_dkdev, cmd, data, flag, l);
        if (error != EPASSTHROUGH)
diff -r a2f22a787801 -r 0ca420c058d8 sys/arch/xen/xen/xbdback_xenbus.c
--- a/sys/arch/xen/xen/xbdback_xenbus.c Wed Nov 06 06:20:12 2013 +0000
+++ b/sys/arch/xen/xen/xbdback_xenbus.c Wed Nov 06 06:23:15 2013 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbdback_xenbus.c,v 1.58 2013/10/20 11:37:11 bouyer Exp $      */
+/*      $NetBSD: xbdback_xenbus.c,v 1.59 2013/11/06 06:23:15 mrg Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.58 2013/10/20 11:37:11 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.59 2013/11/06 06:23:15 mrg Exp $");
 
 #include <sys/atomic.h>
 #include <sys/buf.h>
@@ -1305,8 +1305,8 @@
        KASSERT(xbdi->xbdi_req->rq_operation == BLKIF_OP_READ ||
            xbdi->xbdi_req->rq_operation == BLKIF_OP_WRITE);
        if (xbdi->xbdi_segno < xbdi->xbdi_xen_req.nr_segments) {
-               uint8_t this_fs, this_ls, last_fs, last_ls;
-               grant_ref_t thisgrt, lastgrt;
+               uint8_t this_fs, this_ls, last_ls;
+               grant_ref_t thisgrt;
                /* 
                 * Segment-level reason to coalesce: handling full
                 * pages, or adjacent sector ranges from the same page
@@ -1320,9 +1320,7 @@
                           "first,last_sect[%d]=0%o,0%o\n",
                           xbdi->xbdi_domid, xbdi->xbdi_segno,
                           this_fs, this_ls));
-               last_fs = xbdi->xbdi_last_fs = xbdi->xbdi_this_fs;
                last_ls = xbdi->xbdi_last_ls = xbdi->xbdi_this_ls;
-               lastgrt = xbdi->xbdi_lastgrt = xbdi->xbdi_thisgrt;
                xbdi->xbdi_this_fs = this_fs;
                xbdi->xbdi_this_ls = this_ls;
                xbdi->xbdi_thisgrt = thisgrt;



Home | Main Index | Thread Index | Old Index