1
/*
2
* \brief Assertion macro
3
* \author Christian Helmuth
4
* \date 2008-11-04
5
*/
6
7
/*
8
* Copyright (C) 2008-2013 Genode Labs GmbH
9
*
10
* This file is part of the Genode OS framework, which is distributed
11
* under the terms of the GNU General Public License version 2.
12
*/
13
14
#
ifndef _INCLUDE__DDE_KIT__ASSERT_H_
15
#
define _INCLUDE__DDE_KIT__ASSERT_H_
16
17
#
include <dde_kit/printf.h>
18
#
include <dde_kit/panic.h>
19
20
/**
21
* Assert a condition
22
*
23
* \param expr expression that must be true
24
*
25
* If the expression is not true, dde_kit_panic() is called.
26
*/
27
#
define dde_kit_assert(expr) \
28
do { \
29
if (!(expr)) { \
30
dde_kit_print("Assertion failed: "
#
expr"\n"
); \
31
dde_kit_printf(" File: %s:%d\n"
, __FILE__, __LINE__); \
32
dde_kit_printf(" Function: %s()\n"
, __FUNCTION__); \
33
dde_kit_panic("Assertion failed."
); \
34
} \
35
} while (0);
36
37
#
endif /* _INCLUDE__DDE_KIT__ASSERT_H_ */