diff options
Diffstat (limited to 'libs/libc/inc/assert.h')
-rw-r--r-- | libs/libc/inc/assert.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libs/libc/inc/assert.h b/libs/libc/inc/assert.h index 9621e36..fb5a857 100644 --- a/libs/libc/inc/assert.h +++ b/libs/libc/inc/assert.h @@ -8,15 +8,20 @@ #ifdef KERNEL #include <proc.h> #define assert(exp) \ - if (!(exp)) { \ - printf("%s:%d: %s: Kernel assertion '%s' failed\n", __FILE__, __LINE__, __func__, \ - #exp); \ - __asm__ volatile("cli\nhlt"); \ + { \ + if (!(exp)) { \ + printf("%s:%d: %s: Kernel assertion '%s' failed\n", __FILE__, __LINE__, \ + __func__, #exp); \ + __asm__ volatile("cli\nhlt"); \ + } \ } #elif defined(USER) #define assert(exp) \ - if (!(exp)) \ - err(1, "%s:%d: %s: Assertion '%s' failed\n", __FILE__, __LINE__, __func__, #exp); + { \ + if (!(exp)) \ + err(1, "%s:%d: %s: Assertion '%s' failed\n", __FILE__, __LINE__, __func__, \ + #exp); \ + } #endif #endif |