root / lab4 / .minix-src / include / ddekit / assert.h @ 13
History | View | Annotate | Download (618 Bytes)
1 | 13 | up20180614 | #ifndef _ddekit_assert_h
|
---|---|---|---|
2 | #define _ddekit_assert_h
|
||
3 | #include <ddekit/ddekit.h> |
||
4 | |||
5 | #include <ddekit/printf.h> |
||
6 | #include <ddekit/panic.h> |
||
7 | |||
8 | /** \file ddekit/assert.h */
|
||
9 | |||
10 | /** Assert that an expression is true and panic if not.
|
||
11 | * \ingroup DDEKit_util
|
||
12 | */
|
||
13 | #define ddekit_assert(expr) do \ |
||
14 | { \ |
||
15 | if (!(expr)) { \
|
||
16 | ddekit_print("\033[31;1mDDE: Assertion failed: "#expr"\033[0m\n"); \ |
||
17 | ddekit_printf(" File: %s:%d\n",__FILE__,__LINE__); \
|
||
18 | ddekit_printf(" Function: %s()\n", __FUNCTION__); \
|
||
19 | ddekit_panic("Assertion failed."); \
|
||
20 | }} while (0); |
||
21 | #define Assert ddekit_assert
|
||
22 | |||
23 | #endif |