From 5793a61eb824a7b97e9bab5913b595a778205cef Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 22 May 2022 15:05:39 +0300 Subject: improved tcb handling in preparation for processes --- include/apos/assert.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include/apos/assert.h') 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); -- cgit v1.3