mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
kassert.h: update MPASS definition commentary
We now have a detailed man page describing both MPASS and KASSERT. Give a warning that careless use of MPASS can result in inadequate assertion messages, and point to the MPASS(9) page which describes this. While here add a comment above the KASSERT definitions pointing to the man page. Suggested by: bz Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44438
This commit is contained in:
parent
5d956e11ed
commit
36de8bb226
|
@ -142,6 +142,9 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
|
|||
# endif /* defined(WITNESS) || defined(INVARIANT_SUPPORT) */
|
||||
#endif /* _STANDALONE */
|
||||
|
||||
/*
|
||||
* Kernel assertion; see KASSERT(9) for details.
|
||||
*/
|
||||
#if (defined(_KERNEL) && defined(INVARIANTS)) || defined(_STANDALONE)
|
||||
#define KASSERT(exp,msg) do { \
|
||||
if (__predict_false(!(exp))) \
|
||||
|
@ -154,8 +157,11 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2);
|
|||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Helpful macros for quickly coming up with assertions with informative
|
||||
* panic messages.
|
||||
* Macros for generating panic messages based on the exact condition text.
|
||||
*
|
||||
* NOTE: Use these with care, as the resulting message might omit key
|
||||
* information required to understand the assertion failure. Consult the
|
||||
* MPASS(9) man page for guidance.
|
||||
*/
|
||||
#define MPASS(ex) MPASS4(ex, #ex, __FILE__, __LINE__)
|
||||
#define MPASS2(ex, what) MPASS4(ex, what, __FILE__, __LINE__)
|
||||
|
|
Loading…
Reference in a new issue