Changes in uspace/lib/c/include/assert.h [e8d3c6f5:1cf26ab] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/assert.h
re8d3c6f5 r1cf26ab 34 34 */ 35 35 36 // XXX: The definition of `assert()` is not guarded.37 // One must not use `#pragma once` in this header.38 // This is in accordance with the C standard.39 40 36 #ifndef LIBC_ASSERT_H_ 41 37 #define LIBC_ASSERT_H_ 42 38 43 39 #define static_assert(expr) _Static_assert(expr, "") 44 45 extern void __helenos_assert_abort(const char *, const char *, unsigned int)46 __attribute__((noreturn));47 48 extern void __helenos_assert_quick_abort(const char *, const char *, unsigned int)49 __attribute__((noreturn));50 51 #endif52 40 53 41 /** Debugging assert macro … … 61 49 */ 62 50 63 # undef assert51 #ifndef NDEBUG 64 52 65 #ifndef NDEBUG 66 #define assert(expr) ((expr) ? (void) 0 : __helenos_assert_abort(#expr, __FILE__, __LINE__)) 67 #else 68 #define assert(expr) ((void) 0) 53 #define assert(expr) \ 54 do { \ 55 if (!(expr)) \ 56 assert_abort(#expr, __FILE__, __LINE__); \ 57 } while (0) 58 59 #else /* NDEBUG */ 60 61 #define assert(expr) 62 63 #endif /* NDEBUG */ 64 65 extern void assert_abort(const char *, const char *, unsigned int) 66 __attribute__((noreturn)); 67 69 68 #endif 70 71 #ifdef _HELENOS_SOURCE72 73 #undef safe_assert74 75 #ifndef NDEBUG76 #define safe_assert(expr) ((expr) ? (void) 0 : __helenos_assert_quick_abort(#expr, __FILE__, __LINE__))77 #else78 #define safe_assert(expr) ((void) 0)79 #endif80 81 #endif /* _HELENOS_SOURCE */82 69 83 70 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.