1 /* -----------------------------------------------------------------------------
2 * $Id: Rts.h,v 1.15 2001/11/25 03:56:39 sof Exp $
4 * (c) The GHC Team, 1998-1999
6 * Top-level include file for the RTS itself
8 * ---------------------------------------------------------------------------*/
22 /* -----------------------------------------------------------------------------
24 -------------------------------------------------------------------------- */
26 #if ! defined(EXIT_SUCCESS) || ! defined(EXIT_FAILURE)
27 /* "stdlib.h" should have defined these; but at least
28 on SunOS 4.1.3, this is not so.
30 #define EXIT_SUCCESS 0
31 #define EXIT_FAILURE 1
34 /* 255 is allegedly used by dynamic linkers to report linking failure */
35 #define EXIT_INTERNAL_ERROR 254
36 #define EXIT_DEADLOCK 253
37 #define EXIT_INTERRUPTED 252
38 #define EXIT_HEAPOVERFLOW 251
39 #define EXIT_KILLED 250
41 /* -----------------------------------------------------------------------------
43 -------------------------------------------------------------------------- */
45 /* declarations for runtime flags/values */
46 #define MAX_RTS_ARGS 32
48 /* -----------------------------------------------------------------------------
49 Assertions and Debuggery
50 -------------------------------------------------------------------------- */
52 #define IF_RTSFLAGS(c,s) if (RtsFlags.c) { s; }
54 /* -----------------------------------------------------------------------------
55 Assertions and Debuggery
56 -------------------------------------------------------------------------- */
59 #define IF_DEBUG(c,s) if (RtsFlags.DebugFlags.c) { s; }
61 #define IF_DEBUG(c,s) doNothing()
64 #if defined(GRAN) && defined(DEBUG)
65 #define IF_GRAN_DEBUG(c,s) if (RtsFlags.GranFlags.Debug.c) { s; }
67 #define IF_GRAN_DEBUG(c,s) doNothing()
70 #if defined(PAR) && defined(DEBUG)
71 #define IF_PAR_DEBUG(c,s) if (RtsFlags.ParFlags.Debug.c) { s; }
73 #define IF_PAR_DEBUG(c,s) doNothing()
76 /* -----------------------------------------------------------------------------
78 -------------------------------------------------------------------------- */
80 #ifdef __GNUC__ /* Avoid spurious warnings */
81 #if __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
82 #define STG_NORETURN __attribute__ ((noreturn))
83 #define STG_UNUSED __attribute__ ((unused))
93 /* -----------------------------------------------------------------------------
94 Useful macros and inline functions
95 -------------------------------------------------------------------------- */
97 #define stg_min(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _a : _b; })
98 #define stg_max(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _b : _a; })
100 /* -------------------------------------------------------------------------- */