2012-05-30 20:13:09 +02:00
|
|
|
/*
|
|
|
|
* \brief Assertion macro
|
|
|
|
* \author Martin Stein
|
|
|
|
* \date 2012-04-04
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2013-01-10 21:44:47 +01:00
|
|
|
* Copyright (C) 2012-2013 Genode Labs GmbH
|
2012-05-30 20:13:09 +02: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 _CORE__INCLUDE__ASSERT_H_
|
|
|
|
#define _CORE__INCLUDE__ASSERT_H_
|
|
|
|
|
|
|
|
/* Genode includes */
|
|
|
|
#include <base/printf.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Assert a condition
|
|
|
|
*
|
|
|
|
* \param expression Expression that must be true
|
|
|
|
*/
|
|
|
|
#define assert(expression) \
|
|
|
|
do { \
|
|
|
|
if (!(expression)) { \
|
|
|
|
PERR("Assertion failed: "#expression""); \
|
|
|
|
PERR(" File: %s:%d", __FILE__, __LINE__); \
|
|
|
|
PERR(" Function: %s", __PRETTY_FUNCTION__); \
|
|
|
|
while (1) ; \
|
|
|
|
} \
|
|
|
|
} while (0) ;
|
|
|
|
|
|
|
|
#endif /* _CORE__INCLUDE__ASSERT_H_ */
|
|
|
|
|