aboutsummaryrefslogtreecommitdiff
path: root/include/apos/assert.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/apos/assert.h')
-rw-r--r--include/apos/assert.h13
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);