diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-22 15:05:39 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-05-22 15:05:39 +0300 |
| commit | 5793a61eb824a7b97e9bab5913b595a778205cef (patch) | |
| tree | f31931b924058cb6474b80cd02472940ad8cfcd5 /include/apos/assert.h | |
| parent | a4851206bef5ceecef18b3fde5be6918a67cca21 (diff) | |
| download | kmi-5793a61eb824a7b97e9bab5913b595a778205cef.tar.gz kmi-5793a61eb824a7b97e9bab5913b595a778205cef.zip | |
improved tcb handling in preparation for processes
Diffstat (limited to 'include/apos/assert.h')
| -rw-r--r-- | include/apos/assert.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/apos/assert.h b/include/apos/assert.h index 7200fd2..f3d9a4d 100644 --- a/include/apos/assert.h +++ b/include/apos/assert.h @@ -8,24 +8,25 @@ #if !defined(DNDEBUG) #define catastrophic_assert(x) \ do { \ - if (x) { \ - err("catastrophic assertion failed: %s\n", QUOTE(x)); \ + if (unlikely(!(x))) { \ + error("catastrophic assertion failed: %s\n", \ + QUOTE(x)); \ while (1) \ ; \ } \ } while (0); #define hard_assert(x, r) \ - do { \ - if (x) { \ + { \ + if (unlikely(!(x))) { \ warn("hard assertion failed: %s\n", QUOTE(x)); \ return r; \ } \ - } while (0); + } #define soft_assert(x) \ do { \ - if (x) { \ + if (unlikely(!(x))) { \ info("soft assertion failed: %s\n", QUOTE(x)); \ } \ } while (0); |
