git: 1431239494ee - main - Add a __witness_used for variables only used under #ifdef WITNESS.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 Apr 2022 18:47:54 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1431239494ee15e7175474ddd562c5dec11e7c73 commit 1431239494ee15e7175474ddd562c5dec11e7c73 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-04-27 18:46:16 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-04-27 18:46:16 +0000 Add a __witness_used for variables only used under #ifdef WITNESS. __diagused is now solely used for variables only used under INVARIANTS. Reviewed by: mjg Differential Revision: https://reviews.freebsd.org/D35085 --- sys/kern/vfs_lookup.c | 6 +++--- sys/sys/systm.h | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index b1eae2a73859..cfaa12cfa8b9 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -98,8 +98,8 @@ crossmp_vop_lock1(struct vop_lock1_args *ap) { struct vnode *vp; struct lock *lk __diagused; - const char *file __diagused; - int flags, line __diagused; + const char *file __witness_used; + int flags, line __witness_used; vp = ap->a_vp; lk = vp->v_vnlock; @@ -115,7 +115,7 @@ crossmp_vop_lock1(struct vop_lock1_args *ap) WITNESS_LOCK(&lk->lock_object, 0, file, line); if ((flags & LK_INTERLOCK) != 0) VI_UNLOCK(vp); - LOCK_LOG_LOCK("SLOCK", &lk->lock_object, 0, 0, ap->a_file, line); + LOCK_LOG_LOCK("SLOCK", &lk->lock_object, 0, 0, ap->a_file, ap->a_line); return (0); } diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 6ca9ee886562..043f347ac0d6 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -554,13 +554,16 @@ void _gone_in_dev(device_t dev, int major, const char *msg); #define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg) #define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg) -#if !defined(INVARIANTS) && !defined(WITNESS) -#define __diagused __unused -#elif ((defined(INVARIANTS) && !defined(WITNESS)) || \ - (!defined(INVARIANTS) && defined(WITNESS))) +#ifdef INVARIANTS +#define __diagused +#else #define __diagused __unused +#endif + +#ifdef WITNESS +#define __witness_used #else -#define __diagused +#define __witness_used __unused #endif #endif /* _KERNEL */