git: 8ddf0f738c5f - stable/13 - Add MPASSERT() and MPPASS() macros
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 06 Jul 2022 12:33:50 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=8ddf0f738c5f0b3477059b2c3897478ce7462476
commit 8ddf0f738c5f0b3477059b2c3897478ce7462476
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-06-29 11:37:04 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-07-06 12:33:30 +0000
Add MPASSERT() and MPPASS() macros
(cherry picked from commit 61ae7a355ce787aecd84dc35a047f458a5b5b1fb)
---
sys/sys/kassert.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sys/sys/kassert.h b/sys/sys/kassert.h
index bb6847dc404f..d7c1a21385f9 100644
--- a/sys/sys/kassert.h
+++ b/sys/sys/kassert.h
@@ -46,19 +46,35 @@ extern bool panicked;
kassert_panic msg; \
} \
} while (0)
+#define MPASSERT(exp, mp, msg) do { \
+ if (__predict_false(!(exp))) { \
+ printf("MPASSERT mp %p failed: %s not true at %s:%d (%s)\n",\
+ (mp), #exp, __FILE__, __LINE__, __func__); \
+ kassert_panic msg; \
+ } \
+} while (0)
#define VNPASS(exp, vp) do { \
const char *_exp = #exp; \
VNASSERT(exp, vp, ("condition %s not met at %s:%d (%s)", \
_exp, __FILE__, __LINE__, __func__)); \
} while (0)
+#define MPPASS(exp, mp) do { \
+ const char *_exp = #exp; \
+ MPASSERT(exp, mp, ("condition %s not met at %s:%d (%s)", \
+ _exp, __FILE__, __LINE__, __func__)); \
+} while (0)
#define __assert_unreachable() \
panic("executing segment marked as unreachable at %s:%d (%s)\n", \
__FILE__, __LINE__, __func__)
#else /* INVARIANTS */
#define VNASSERT(exp, vp, msg) do { \
} while (0)
+#define MPASSERT(exp, mp, msg) do { \
+} while (0)
#define VNPASS(exp, vp) do { \
} while (0)
+#define MPPASS(exp, mp) do { \
+} while (0)
#define __assert_unreachable() __unreachable()
#endif /* INVARIANTS */