1 /* -----------------------------------------------------------------------------
2 * $Id: Rts.h,v 1.22 2002/12/19 17:57:39 panne Exp $
4 * (c) The GHC Team, 1998-1999
6 * Top-level include file for the RTS itself
8 * ---------------------------------------------------------------------------*/
22 /* -----------------------------------------------------------------------------
24 -------------------------------------------------------------------------- */
26 /* 255 is allegedly used by dynamic linkers to report linking failure */
27 #define EXIT_INTERNAL_ERROR 254
28 #define EXIT_DEADLOCK 253
29 #define EXIT_INTERRUPTED 252
30 #define EXIT_HEAPOVERFLOW 251
31 #define EXIT_KILLED 250
33 /* -----------------------------------------------------------------------------
35 -------------------------------------------------------------------------- */
37 /* declarations for runtime flags/values */
38 #define MAX_RTS_ARGS 32
41 /* On the yucky side..suppress -Wmissing-declarations warnings when
42 * including <windows.h>
44 extern void* GetCurrentFiber ( void );
45 extern void* GetFiberData ( void );
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()
65 #define DEBUG_ONLY(s) s
67 #define DEBUG_ONLY(s) doNothing()
70 #if defined(GRAN) && defined(DEBUG)
71 #define IF_GRAN_DEBUG(c,s) if (RtsFlags.GranFlags.Debug.c) { s; }
73 #define IF_GRAN_DEBUG(c,s) doNothing()
76 #if defined(PAR) && defined(DEBUG)
77 #define IF_PAR_DEBUG(c,s) if (RtsFlags.ParFlags.Debug.c) { s; }
79 #define IF_PAR_DEBUG(c,s) doNothing()
82 /* -----------------------------------------------------------------------------
84 -------------------------------------------------------------------------- */
86 #ifdef __GNUC__ /* Avoid spurious warnings */
87 #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ >= 3
88 #define STG_NORETURN __attribute__ ((noreturn))
89 #define STG_UNUSED __attribute__ ((unused))
99 /* -----------------------------------------------------------------------------
100 Useful macros and inline functions
101 -------------------------------------------------------------------------- */
103 #define stg_min(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _a : _b; })
104 #define stg_max(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _b : _a; })
106 /* -------------------------------------------------------------------------- */