genode/os/include/dde_kit/assert.h
2011-12-22 16:19:25 +01:00

38 lines
1.1 KiB
C

/*
* \brief Assertion macro
* \author Christian Helmuth
* \date 2008-11-04
*/
/*
* Copyright (C) 2008-2011 Genode Labs GmbH
*
* 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_ */