Rev 3386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 3386 | Rev 4153 | ||
|---|---|---|---|
| Line 55... | Line 55... | ||
| 55 | * |
55 | * |
| 56 | */ |
56 | */ |
| 57 | #ifdef CONFIG_DEBUG |
57 | #ifdef CONFIG_DEBUG |
| 58 | # define ASSERT(expr) \ |
58 | # define ASSERT(expr) \ |
| 59 | if (!(expr)) { \ |
59 | if (!(expr)) { \ |
| 60 | panic("assertion failed (%s), caller=%p\n", #expr, CALLER); \ |
60 | panic("Assertion failed (%s), caller=%p.", #expr, CALLER); \ |
| 61 | } |
61 | } |
| 62 | #else |
62 | #else |
| 63 | # define ASSERT(expr) |
63 | # define ASSERT(expr) |
| 64 | #endif |
64 | #endif |
| 65 | 65 | ||
| 66 | /** Extensive debugging output macro |
66 | /** Extensive logging output macro |
| 67 | * |
67 | * |
| 68 | * If CONFIG_EDEBUG is set, the LOG() macro |
68 | * If CONFIG_LOG is set, the LOG() macro |
| 69 | * will print whatever message is indicated plus |
69 | * will print whatever message is indicated plus |
| 70 | * an information about the location. |
70 | * an information about the location. |
| 71 | * |
71 | * |
| 72 | */ |
72 | */ |
| 73 | 73 | ||
| 74 | #ifdef CONFIG_EDEBUG |
74 | #ifdef CONFIG_LOG |
| 75 | # define LOG(format, ...) \ |
75 | # define LOG(format, ...) \ |
| 76 | printf("%s() at %s:%u: " format "\n", __func__, __FILE__, \ |
76 | printf("%s() at %s:%u: " format "\n", __func__, __FILE__, \ |
| 77 | __LINE__, ##__VA_ARGS__); |
77 | __LINE__, ##__VA_ARGS__); |
| 78 | #else |
78 | #else |
| 79 | # define LOG(format, ...) |
79 | # define LOG(format, ...) |
| 80 | #endif |
80 | #endif |
| 81 | 81 | ||
| 82 | /** Extensive debugging execute macro |
82 | /** Extensive logging execute macro |
| 83 | * |
83 | * |
| 84 | * If CONFIG_EDEBUG is set, the LOG_EXEC() macro |
84 | * If CONFIG_LOG is set, the LOG_EXEC() macro |
| 85 | * will print an information about calling a given |
85 | * will print an information about calling a given |
| 86 | * function and call it. |
86 | * function and call it. |
| 87 | * |
87 | * |
| 88 | */ |
88 | */ |
| 89 | 89 | ||
| 90 | #ifdef CONFIG_EDEBUG |
90 | #ifdef CONFIG_LOG |
| 91 | # define LOG_EXEC(fnc) \ |
91 | # define LOG_EXEC(fnc) \ |
| 92 | { \ |
92 | { \ |
| 93 | printf("%s() at %s:%u: " #fnc "\n", __func__, __FILE__, \ |
93 | printf("%s() at %s:%u: " #fnc "\n", __func__, __FILE__, \ |
| 94 | __LINE__); \ |
94 | __LINE__); \ |
| 95 | fnc; \ |
95 | fnc; \ |