git: b40c0db6f6d6 - main - Patch up __diagused for when only one of INVARIANTS or WITNESS is defined

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Wed, 27 Apr 2022 13:30:17 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=b40c0db6f6d61ed594118d81dc691b9263a7e4d7

commit b40c0db6f6d61ed594118d81dc691b9263a7e4d7
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-04-27 13:29:12 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-04-27 13:29:12 +0000

    Patch up __diagused for when only one of INVARIANTS or WITNESS is defined
    
    Reported by:    John F Carr<jfc@mit.edu>
---
 sys/sys/systm.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index f2ffa7e6b815..6ca9ee886562 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -554,10 +554,13 @@ 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
-#else
+#if !defined(INVARIANTS) && !defined(WITNESS)
+#define	__diagused	__unused
+#elif ((defined(INVARIANTS) && !defined(WITNESS)) || \
+	(!defined(INVARIANTS) && defined(WITNESS)))
 #define	__diagused	__unused
+#else
+#define	__diagused
 #endif
 
 #endif /* _KERNEL */