1987-03-10 17:51:10 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1986-03-10 13:07:55 +00:00
|
|
|
/* $Header$ */
|
|
|
|
/* A S S E R T I O N M A C R O D E F I N I T I O N */
|
|
|
|
|
|
|
|
/* At some points in the program, it must be sure that some condition
|
|
|
|
holds true, due to further, successful, processing. As long as
|
|
|
|
there is no reasonable method to prove that a program is 100%
|
|
|
|
correct, these assertions are needed in some places.
|
|
|
|
*/
|
|
|
|
#include "debug.h" /* UF */
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
/* Note: this macro uses parameter substitution inside strings */
|
1988-09-26 11:37:38 +00:00
|
|
|
#define ASSERT(exp) (exp || crash("in %s, %u: assertion %s failed", \
|
1986-03-10 13:07:55 +00:00
|
|
|
__FILE__, __LINE__, "exp"))
|
1988-09-26 11:37:38 +00:00
|
|
|
#define NOTREACHED() crash("in %s, %u: unreachable statement reached", \
|
|
|
|
__FILE__, __LINE__)
|
1986-03-10 13:07:55 +00:00
|
|
|
#else
|
|
|
|
#define ASSERT(exp)
|
1988-09-26 11:37:38 +00:00
|
|
|
#define NOTREACHED()
|
1991-12-17 14:11:15 +00:00
|
|
|
#endif /* DEBUG */
|