genode/os/include/dde_kit/assert.h

38 lines
1.1 KiB
C
Raw Normal View History

2011-12-22 15:19:25 +00:00
/*
* \brief Assertion macro
* \author Christian Helmuth
* \date 2008-11-04
*/
/*
2013-01-10 20:44:47 +00:00
* Copyright (C) 2008-2013 Genode Labs GmbH
2011-12-22 15:19:25 +00:00
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__DDE_KIT__ASSERT_H_
#define _INCLUDE__DDE_KIT__ASSERT_H_
#include <dde_kit/printf.h>
#include <dde_kit/panic.h>
/**
* Assert a condition
*
* \param expr expression that must be true
*
* If the expression is not true, dde_kit_panic() is called.
*/
#define dde_kit_assert(expr) \
do { \
if (!(expr)) { \
dde_kit_print("Assertion failed: "#expr"\n"); \
dde_kit_printf(" File: %s:%d\n", __FILE__, __LINE__); \
dde_kit_printf(" Function: %s()\n", __FUNCTION__); \
dde_kit_panic("Assertion failed."); \
} \
} while (0);
#endif /* _INCLUDE__DDE_KIT__ASSERT_H_ */