Files
mercury/runtime/overflow.h
Fergus Henderson f9617ab238 A change to make it more ANSI-compliant.
Estimated hours taken: 0.25

runtime/overflow.h:
	A change to make it more ANSI-compliant.
	(This was needed to compile things in debug grade using lcc.)
1995-12-28 09:19:47 +00:00

71 lines
1.5 KiB
C

/*
** Copyright (C) 1995 University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
*/
/* DEFINITIONS FOR OVERFLOW CHECKS */
#define IF(cond, val) ((cond) ? (val),(void)0 : (void)0)
#ifdef SPEED
#define heap_overflow_check() ((void)0)
#define detstack_overflow_check() ((void)0)
#define detstack_underflow_check() ((void)0)
#define nondstack_overflow_check() ((void)0)
#define nondstack_underflow_check() ((void)0)
#else
#define heap_overflow_check() \
( \
IF (hp >= heapend,( \
fatal_error("heap overflow") \
)), \
IF (hp > heapmax,( \
heapmax = hp \
)), \
(void)0 \
)
#define detstack_overflow_check() \
( \
IF (sp >= detstackend,( \
fatal_error("stack overflow") \
)), \
IF (sp > detstackmax,( \
detstackmax = sp \
)), \
(void)0 \
)
#define detstack_underflow_check() \
( \
IF (sp < detstackmin,( \
fatal_error("stack underflow") \
)), \
(void)0 \
)
#define nondstack_overflow_check() \
( \
IF (maxfr >= nondstackend,( \
fatal_error("nondstack overflow") \
)), \
IF (maxfr > nondstackmax,( \
nondstackmax = maxfr \
)), \
(void)0 \
)
#define nondstack_underflow_check() \
( \
IF (maxfr < nondstackmin,( \
fatal_error("nondstack underflow") \
)), \
(void)0 \
)
#endif