Changes in kernel/generic/include/debug.h [63e27ef:bcc20fa1] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/debug.h
r63e27ef rbcc20fa1 36 36 #define KERN_DEBUG_H_ 37 37 38 #include <panic.h> 38 39 #include <log.h> 39 40 #include <symtab_lookup.h> 40 41 41 42 #define CALLER ((uintptr_t) __builtin_return_address(0)) 43 44 #ifdef CONFIG_DEBUG 45 46 /** Debugging ASSERT macro 47 * 48 * If CONFIG_DEBUG is set, the ASSERT() macro 49 * evaluates expr and if it is false raises 50 * kernel panic. 51 * 52 * @param expr Expression which is expected to be true. 53 * 54 */ 55 #define ASSERT(expr) \ 56 do { \ 57 if (!(expr)) \ 58 panic_assert("%s() at %s:%u:\n%s", \ 59 __func__, __FILE__, __LINE__, #expr); \ 60 } while (0) 61 62 /** Debugging verbose ASSERT macro 63 * 64 * If CONFIG_DEBUG is set, the ASSERT() macro 65 * evaluates expr and if it is false raises 66 * kernel panic. The panic message contains also 67 * the supplied message. 68 * 69 * @param expr Expression which is expected to be true. 70 * @param msg Additional message to show (string). 71 * 72 */ 73 #define ASSERT_VERBOSE(expr, msg) \ 74 do { \ 75 if (!(expr)) \ 76 panic_assert("%s() at %s:%u:\n%s, %s", \ 77 __func__, __FILE__, __LINE__, #expr, msg); \ 78 } while (0) 79 80 /** Static assert macro 81 * 82 */ 83 #define STATIC_ASSERT(expr) \ 84 _Static_assert(expr, "") 85 86 #define STATIC_ASSERT_VERBOSE(expr, msg) \ 87 _Static_assert(expr, msg) 88 89 90 #else /* CONFIG_DEBUG */ 91 92 #define ASSERT(expr) 93 #define ASSERT_VERBOSE(expr, msg) 94 #define STATIC_ASSERT(expr) 95 #define STATIC_ASSERT_VERBOSE(expr, msg) 96 97 #endif /* CONFIG_DEBUG */ 42 98 43 99 #ifdef CONFIG_LOG
Note:
See TracChangeset
for help on using the changeset viewer.