add DBGSET macro to conditionally assign to a variable depending on INVARIANTS

This commit is contained in:
Matt Macy 2018-05-19 03:50:29 +00:00
parent b203713694
commit f1b2eaf13b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=333830

View File

@ -85,6 +85,7 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
#endif
#ifdef INVARIANTS /* The option is always available */
#define DBGSET(lhs, rhs) lhs = (rhs)
#define KASSERT(exp,msg) do { \
if (__predict_false(!(exp))) \
kassert_panic msg; \
@ -96,6 +97,7 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
} \
} while (0)
#else
#define DBGSET(lhs, rhs) rhs
#define KASSERT(exp,msg) do { \
} while (0)