Source-Changes-HG archive

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

[src/trunk]: src/sys Modify *ASSERTMSG() so they are now used as variadic mac...



details:   https://anonhg.NetBSD.org/src/rev/ef91f5e8587c
branches:  trunk
changeset: 769923:ef91f5e8587c
user:      jym <jym%NetBSD.org@localhost>
date:      Tue Sep 27 01:02:33 2011 +0000

description:
Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html

diffstat:

 sys/arch/evbmips/evbmips/interrupt.c       |  11 +++----
 sys/arch/mips/mips/mips_softint.c          |  10 +++---
 sys/arch/mips/mips/pmap_tlb.c              |  16 ++++++------
 sys/arch/mips/mips/syscall.c               |   8 +++---
 sys/arch/mips/mips/vm_machdep.c            |  12 ++++----
 sys/arch/mips/ralink/ralink_gpio.c         |  30 +++++++++++-----------
 sys/arch/mips/ralink/ralink_intr.c         |   6 ++--
 sys/arch/mips/rmi/rmixl_fmn.c              |   6 ++--
 sys/arch/mips/rmi/rmixl_intr.c             |  12 ++++----
 sys/arch/powerpc/booke/booke_pmap.c        |   8 +++---
 sys/arch/powerpc/booke/dev/pq3etsec.c      |  16 ++++++-----
 sys/arch/powerpc/booke/e500_intr.c         |  16 ++++++------
 sys/arch/powerpc/booke/pci/pq3pci.c        |   8 +++---
 sys/arch/powerpc/booke/trap.c              |   6 ++--
 sys/arch/powerpc/include/oea/pmap.h        |   4 +-
 sys/arch/powerpc/include/userret.h         |   4 +-
 sys/arch/powerpc/pic/intr.c                |   8 +++---
 sys/arch/powerpc/powerpc/process_machdep.c |  12 ++++----
 sys/arch/powerpc/powerpc/softint_machdep.c |   8 +++---
 sys/arch/powerpc/powerpc/trap.c            |   6 ++--
 sys/arch/x86/x86/pmap.c                    |  22 +++++++---------
 sys/arch/xen/x86/xen_ipi.c                 |  10 +++---
 sys/common/pmap/tlb/pmap.c                 |   6 ++--
 sys/common/pmap/tlb/pmap_tlb.c             |  16 ++++++------
 sys/dev/ic/siisata.c                       |  10 +++---
 sys/dev/usb/usb_mem.c                      |  16 ++++++------
 sys/kern/kern_mutex_obj.c                  |  20 +++++++-------
 sys/kern/kern_softint.c                    |   8 +++---
 sys/kern/kern_synch.c                      |   8 +++---
 sys/kern/subr_evcnt.c                      |   8 +++---
 sys/kern/subr_pcu.c                        |   8 +++---
 sys/kern/subr_pool.c                       |   8 +++---
 sys/lib/libkern/libkern.h                  |  40 ++++++++++++++++++------------
 sys/uvm/uvm_bio.c                          |   7 ++---
 sys/uvm/uvm_map.c                          |   7 ++---
 sys/uvm/uvm_pglist.c                       |  20 +++++++-------
 36 files changed, 213 insertions(+), 208 deletions(-)

diffs (truncated from 1386 to 300 lines):

diff -r 3456c66ad5c6 -r ef91f5e8587c sys/arch/evbmips/evbmips/interrupt.c
--- a/sys/arch/evbmips/evbmips/interrupt.c      Tue Sep 27 01:01:43 2011 +0000
+++ b/sys/arch/evbmips/evbmips/interrupt.c      Tue Sep 27 01:02:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: interrupt.c,v 1.17 2011/07/10 00:03:53 matt Exp $      */
+/*     $NetBSD: interrupt.c,v 1.18 2011/09/27 01:02:33 jym Exp $       */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.17 2011/07/10 00:03:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.18 2011/09/27 01:02:33 jym Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -66,15 +66,14 @@
                splx(ipl);      /* lower to interrupt level */
 
                KASSERTMSG(ci->ci_cpl == ipl,
-                   ("%s: cpl (%d) != ipl (%d)",
-                   __func__, ci->ci_cpl, ipl));
+                   "%s: cpl (%d) != ipl (%d)", __func__, ci->ci_cpl, ipl);
                KASSERT(pending != 0);
 
                if (pending & MIPS_INT_MASK_5) {
                        struct clockframe cf;
                        KASSERTMSG(ipl == IPL_SCHED,
-                           ("%s: ipl (%d) != IPL_SCHED (%d)",
-                            __func__, ipl, IPL_SCHED));
+                           "%s: ipl (%d) != IPL_SCHED (%d)",
+                            __func__, ipl, IPL_SCHED);
                        /* call the common MIPS3 clock interrupt handler */ 
                        cf.pc = pc;
                        cf.sr = status;
diff -r 3456c66ad5c6 -r ef91f5e8587c sys/arch/mips/mips/mips_softint.c
--- a/sys/arch/mips/mips/mips_softint.c Tue Sep 27 01:01:43 2011 +0000
+++ b/sys/arch/mips/mips/mips_softint.c Tue Sep 27 01:02:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mips_softint.c,v 1.5 2011/07/10 23:13:22 matt Exp $    */
+/*     $NetBSD: mips_softint.c,v 1.6 2011/09/27 01:02:34 jym Exp $     */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mips_softint.c,v 1.5 2011/07/10 23:13:22 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_softint.c,v 1.6 2011/09/27 01:02:34 jym Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -101,7 +101,7 @@
                softint_fast_dispatch(ci->ci_softlwps[SOFTINT_##level], \
                    IPL_SOFT##level); \
                KASSERT(ci->ci_softlwps[SOFTINT_##level]->l_ctxswtch == 0); \
-               KASSERTMSG(ci->ci_cpl == IPL_HIGH, ("cpl (%d) != HIGH", ci->ci_cpl)); \
+               KASSERTMSG(ci->ci_cpl == IPL_HIGH, "cpl (%d) != HIGH", ci->ci_cpl); \
                continue; \
        }
 
@@ -115,8 +115,8 @@
        KASSERT((ipending & ~MIPS_SOFT_INT_MASK) == 0);
        KASSERT(ci->ci_cpl == IPL_HIGH);
        KASSERTMSG(ci->ci_mtx_count == 0,
-           ("%s: cpu%u (%p): ci_mtx_count (%d) != 0",
-            __func__, cpu_index(ci), ci, ci->ci_mtx_count));
+           "%s: cpu%u (%p): ci_mtx_count (%d) != 0",
+            __func__, cpu_index(ci), ci, ci->ci_mtx_count);
 
        if (ipending & MIPS_SOFT_INT_MASK_0) {
                /*
diff -r 3456c66ad5c6 -r ef91f5e8587c sys/arch/mips/mips/pmap_tlb.c
--- a/sys/arch/mips/mips/pmap_tlb.c     Tue Sep 27 01:01:43 2011 +0000
+++ b/sys/arch/mips/mips/pmap_tlb.c     Tue Sep 27 01:02:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_tlb.c,v 1.7 2011/04/14 17:41:32 matt Exp $        */
+/*     $NetBSD: pmap_tlb.c,v 1.8 2011/09/27 01:02:34 jym Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.7 2011/04/14 17:41:32 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.8 2011/09/27 01:02:34 jym Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -440,8 +440,8 @@
 
        KASSERT(cpu_intr_p());
        KASSERTMSG(ci->ci_cpl >= IPL_SCHED,
-           ("%s: cpl (%d) < IPL_SCHED (%d)",
-           __func__, ci->ci_cpl, IPL_SCHED));
+           "%s: cpl (%d) < IPL_SCHED (%d)",
+           __func__, ci->ci_cpl, IPL_SCHED);
        TLBINFO_LOCK(ti);
 
        switch (ti->ti_tlbinvop) {
@@ -815,8 +815,8 @@
                const uint32_t cpu_mask = 1 << cpu_index(ci);
                KASSERT(!cpu_intr_p());
                KASSERTMSG(pm->pm_onproc & cpu_mask,
-                   ("%s: pmap %p onproc %#x doesn't include cpu %d (%p)",
-                   __func__, pm, pm->pm_onproc, cpu_index(ci), ci));
+                   "%s: pmap %p onproc %#x doesn't include cpu %d (%p)",
+                   __func__, pm, pm->pm_onproc, cpu_index(ci), ci);
                /*
                 * The bits in pm_onproc that belong to this TLB can
                 * be changed while this TLBs lock is not held as long
@@ -1028,8 +1028,8 @@
        __asm("mfc0 %0,$%1" : "=r"(tlb_hi) : "n"(MIPS_COP_0_TLB_HI));
        uint32_t asid = (tlb_hi & MIPS_TLB_PID) >> MIPS_TLB_PID_SHIFT;
        KDASSERTMSG(asid == curcpu()->ci_pmap_asid_cur,
-          ("tlb_hi (%#x) asid (%#x) != current asid (%#x)",
-           tlb_hi, asid, curcpu()->ci_pmap_asid_cur));
+          "tlb_hi (%#x) asid (%#x) != current asid (%#x)",
+           tlb_hi, asid, curcpu()->ci_pmap_asid_cur);
        kpreempt_enable();
 #endif
 }
diff -r 3456c66ad5c6 -r ef91f5e8587c sys/arch/mips/mips/syscall.c
--- a/sys/arch/mips/mips/syscall.c      Tue Sep 27 01:01:43 2011 +0000
+++ b/sys/arch/mips/mips/syscall.c      Tue Sep 27 01:02:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: syscall.c,v 1.45 2011/07/10 23:21:59 matt Exp $        */
+/*     $NetBSD: syscall.c,v 1.46 2011/09/27 01:02:34 jym Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.45 2011/07/10 23:21:59 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.46 2011/09/27 01:02:34 jym Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sa.h"
@@ -136,8 +136,8 @@
 #if defined(__mips_o32)
        const int abi = _MIPS_BSD_API_O32;
        KASSERTMSG(p->p_md.md_abi == abi,
-           ("pid %d(%p): md_abi(%d) != abi(%d)",
-           p->p_pid, p, p->p_md.md_abi, abi));
+           "pid %d(%p): md_abi(%d) != abi(%d)",
+           p->p_pid, p, p->p_md.md_abi, abi);
        size_t nregs = 4;
 #else
        const int abi = p->p_md.md_abi;
diff -r 3456c66ad5c6 -r ef91f5e8587c sys/arch/mips/mips/vm_machdep.c
--- a/sys/arch/mips/mips/vm_machdep.c   Tue Sep 27 01:01:43 2011 +0000
+++ b/sys/arch/mips/mips/vm_machdep.c   Tue Sep 27 01:02:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.140 2011/09/01 06:41:38 matt Exp $    */
+/*     $NetBSD: vm_machdep.c,v 1.141 2011/09/27 01:02:34 jym Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.140 2011/09/01 06:41:38 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.141 2011/09/27 01:02:34 jym Exp $");
 
 #include "opt_ddb.h"
 #include "opt_coredump.h"
@@ -210,11 +210,11 @@
        KASSERT(pg != NULL);
        const paddr_t pa = VM_PAGE_TO_PHYS(pg);
        KASSERTMSG(pa >= mips_avail_start,
-           ("pa (%#"PRIxPADDR") < mips_avail_start (%#"PRIxPADDR")",
-            pa, mips_avail_start));
+           "pa (%#"PRIxPADDR") < mips_avail_start (%#"PRIxPADDR")",
+            pa, mips_avail_start);
        KASSERTMSG(pa < mips_avail_end,
-           ("pa (%#"PRIxPADDR") >= mips_avail_end (%#"PRIxPADDR")",
-            pa, mips_avail_end));
+           "pa (%#"PRIxPADDR") >= mips_avail_end (%#"PRIxPADDR")",
+            pa, mips_avail_end);
 
        /*
         * we need to return a direct-mapped VA for the pa.
diff -r 3456c66ad5c6 -r ef91f5e8587c sys/arch/mips/ralink/ralink_gpio.c
--- a/sys/arch/mips/ralink/ralink_gpio.c        Tue Sep 27 01:01:43 2011 +0000
+++ b/sys/arch/mips/ralink/ralink_gpio.c        Tue Sep 27 01:02:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ralink_gpio.c,v 1.2 2011/07/28 15:38:49 matt Exp $     */
+/*     $NetBSD: ralink_gpio.c,v 1.3 2011/09/27 01:02:34 jym Exp $      */
 /*-
  * Copyright (c) 2011 CradlePoint Technology, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
 /* ra_gpio.c -- Ralink 3052 gpio driver */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ralink_gpio.c,v 1.2 2011/07/28 15:38:49 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ralink_gpio.c,v 1.3 2011/09/27 01:02:34 jym Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -411,32 +411,32 @@
 static inline uint32_t
 sy_read(ra_gpio_softc_t *sc, bus_size_t off)
 {
-       KASSERTMSG((off & 3) == 0, ("%s: unaligned off=%#" PRIxBUSSIZE "\n",
-               __func__, off));
+       KASSERTMSG((off & 3) == 0, "%s: unaligned off=%#" PRIxBUSSIZE "\n",
+               __func__, off);
        return bus_space_read_4(sc->sc_memt, sc->sc_sy_memh, off);
 }
 
 static inline void
 sy_write(ra_gpio_softc_t *sc, bus_size_t off, uint32_t val)
 {
-       KASSERTMSG((off & 3) == 0, ("%s: unaligned off=%#" PRIxBUSSIZE "\n",
-               __func__, off));
+       KASSERTMSG((off & 3) == 0, "%s: unaligned off=%#" PRIxBUSSIZE "\n",
+               __func__, off);
        bus_space_write_4(sc->sc_memt, sc->sc_sy_memh, off, val);
 }
 
 static inline uint32_t
 gp_read(ra_gpio_softc_t *sc, bus_size_t off)
 {
-       KASSERTMSG((off & 3) == 0, ("%s: unaligned off=%#" PRIxBUSSIZE "\n",
-               __func__, off));
+       KASSERTMSG((off & 3) == 0, "%s: unaligned off=%#" PRIxBUSSIZE "\n",
+               __func__, off);
        return bus_space_read_4(sc->sc_memt, sc->sc_gp_memh, off);
 }
 
 static inline void
 gp_write(ra_gpio_softc_t *sc, bus_size_t off, uint32_t val)
 {
-       KASSERTMSG((off & 3) == 0, ("%s: unaligned off=%#" PRIxBUSSIZE "\n",
-               __func__, off));
+       KASSERTMSG((off & 3) == 0, "%s: unaligned off=%#" PRIxBUSSIZE "\n",
+               __func__, off);
        bus_space_write_4(sc->sc_memt, sc->sc_gp_memh, off, val);
 }
 
@@ -760,8 +760,8 @@
                 * then warn and return 0
                 */
                const int index = pin_tab_index[pin];
-               KASSERTMSG(index != -1, ("%s: non-existant pin=%d\n",
-                       __func__, pin));
+               KASSERTMSG(index != -1, "%s: non-existant pin=%d\n",
+                       __func__, pin);
                if (index == -1) {
                        rv = 0;
                } else {
@@ -853,7 +853,7 @@
         * then warn and return
         */
        const int index = pin_tab_index[pin];
-       KASSERTMSG(index != -1, ("%s: non-existant pin=%d\n", __func__, pin));
+       KASSERTMSG(index != -1, "%s: non-existant pin=%d\n", __func__, pin);
        if (index == -1)
                return;
 
@@ -1236,7 +1236,7 @@
 {
        RALINK_DEBUG_FUNC_ENTRY();
        const int index = pin_tab_index[pin];
-       KASSERTMSG(index != -1, ("%s: non-existant pin=%d\n", __func__, pin));
+       KASSERTMSG(index != -1, "%s: non-existant pin=%d\n", __func__, pin);
        if (index == -1)
                return;
 
@@ -1260,7 +1260,7 @@
 enable_gpio_interrupt(ra_gpio_softc_t *sc, int pin)
 {
        const int index = pin_tab_index[pin];
-       KASSERTMSG(index != -1, ("%s: non-existant pin=%d\n", __func__, pin));
+       KASSERTMSG(index != -1, "%s: non-existant pin=%d\n", __func__, pin);
        if (index == -1)
                return;
 
diff -r 3456c66ad5c6 -r ef91f5e8587c sys/arch/mips/ralink/ralink_intr.c
--- a/sys/arch/mips/ralink/ralink_intr.c        Tue Sep 27 01:01:43 2011 +0000
+++ b/sys/arch/mips/ralink/ralink_intr.c        Tue Sep 27 01:02:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ralink_intr.c,v 1.2 2011/07/28 15:38:49 matt Exp $     */
+/*     $NetBSD: ralink_intr.c,v 1.3 2011/09/27 01:02:34 jym Exp $      */
 /*-
  * Copyright (c) 2011 CradlePoint Technology, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
 #define __INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ralink_intr.c,v 1.2 2011/07/28 15:38:49 matt Exp $");



Home | Main Index | Thread Index | Old Index