diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-29 01:07:48 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-29 01:07:48 +0300 |
| commit | 0f4a751e60a6c8ac40592ff44c74f1c9e4846d9a (patch) | |
| tree | 96fb1e8479261a128f065ee493ee3a97a3b91949 /include/apos/assert.h | |
| parent | 013a27aec9370221e8afae188a8ed08ed2d406b0 (diff) | |
| download | kmi-0f4a751e60a6c8ac40592ff44c74f1c9e4846d9a.tar.gz kmi-0f4a751e60a6c8ac40592ff44c74f1c9e4846d9a.zip | |
continue documentation efforts.
Diffstat (limited to 'include/apos/assert.h')
| -rw-r--r-- | include/apos/assert.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/include/apos/assert.h b/include/apos/assert.h index 3255481..97523c7 100644 --- a/include/apos/assert.h +++ b/include/apos/assert.h @@ -20,6 +20,12 @@ /* TODO: should this exit or do something explosive like that? */ #if !defined(DNDEBUG) + +/** + * The kernel is in an irrepairable state, just give up. + * + * @param x Condition to check for. + */ #define catastrophic_assert(x) \ do { \ if (unlikely(!(x))) { \ @@ -29,6 +35,15 @@ } \ } while (0); +/** + * The function cannot continue without this assertion, but doesn't necessarily + * mean that the kernel is borked. + * + * @warning Implicit return. + * + * @param x Condition to check for. + * @param r Return value on failed check. + */ #define hard_assert(x, r) \ { \ if (unlikely(!(x))) { \ @@ -37,6 +52,11 @@ } \ } +/** + * Unexpected case, but not likely to cause problems, likely a bug. + * + * @param x Condition to check for. + */ #define soft_assert(x) \ do { \ if (unlikely(!(x))) { \ @@ -49,8 +69,14 @@ #define soft_assert(x) #endif -/* use when return value doesn't exist, like hard_assert(x, - * RETURN_VOID); */ +/** + * Use when return value doesn't exist. + * + * Example: + * @code{.c} + * void func() { hard_assert(x, RETURN_VOID); } + * @endcode + */ #define RETURN_VOID #endif /* APOS_ASSERT_H */ |
