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
This commit is contained in:
John Baldwin 2022-04-27 11:46:16 -07:00
parent e140d551b7
commit 1431239494
2 changed files with 12 additions and 9 deletions

View File

@ -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);
}

View File

@ -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)))
#define __diagused __unused
#else
#ifdef INVARIANTS
#define __diagused
#else
#define __diagused __unused
#endif
#ifdef WITNESS
#define __witness_used
#else
#define __witness_used __unused
#endif
#endif /* _KERNEL */