Pristine Ack-5.5
[Ack-5.5.git] / lang / cem / cemcom / assert.h
1 /*
2  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  */
5 /* $Id: assert.h,v 3.4 1994/06/24 12:02:07 ceriel Exp $ */
6 /*       A S S E R T I O N    M A C R O   D E F I N I T I O N           */
7
8 /*      At some points in the program, it must be sure that some condition
9         holds true, due to further, successful, processing.  As long as
10         there is no reasonable method to prove that a program is 100%
11         correct, these assertions are needed in some places.
12 */
13 #include        "debug.h"       /* UF */
14
15 #ifdef  DEBUG
16 /*      Note: this macro uses parameter substitution inside strings */
17 #define ASSERT(exp)     (exp || crash("in %s, %u: assertion %s failed", \
18                                 __FILE__, __LINE__, "exp"))
19 #define NOTREACHED()    crash("in %s, %u: unreachable statement reached", \
20                                 __FILE__, __LINE__)
21 #else
22 #define ASSERT(exp)
23 #define NOTREACHED()
24 #endif  /* DEBUG */