Changes in uspace/lib/c/include/assert.h [1cf26ab:e8d3c6f5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/assert.h
r1cf26ab re8d3c6f5 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 36 40 #ifndef LIBC_ASSERT_H_ 37 41 #define LIBC_ASSERT_H_ 38 42 39 43 #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 #endif 40 52 41 53 /** Debugging assert macro … … 49 61 */ 50 62 63 #undef assert 64 51 65 #ifndef NDEBUG 66 #define assert(expr) ((expr) ? (void) 0 : __helenos_assert_abort(#expr, __FILE__, __LINE__)) 67 #else 68 #define assert(expr) ((void) 0) 69 #endif 52 70 53 #define assert(expr) \ 54 do { \ 55 if (!(expr)) \ 56 assert_abort(#expr, __FILE__, __LINE__); \ 57 } while (0) 71 #ifdef _HELENOS_SOURCE 58 72 59 # else /* NDEBUG */73 #undef safe_assert 60 74 61 #define assert(expr) 75 #ifndef NDEBUG 76 #define safe_assert(expr) ((expr) ? (void) 0 : __helenos_assert_quick_abort(#expr, __FILE__, __LINE__)) 77 #else 78 #define safe_assert(expr) ((void) 0) 79 #endif 62 80 63 #endif /* NDEBUG */ 64 65 extern void assert_abort(const char *, const char *, unsigned int) 66 __attribute__((noreturn)); 67 68 #endif 81 #endif /* _HELENOS_SOURCE */ 69 82 70 83 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.