1 /* -----------------------------------------------------------------------------
2 * $Id: Rts.h,v 1.10 2000/01/12 15:15:17 simonmar Exp $
4 * (c) The GHC Team, 1998-1999
6 * Top-level include file for the RTS itself
8 * ---------------------------------------------------------------------------*/
18 /* -----------------------------------------------------------------------------
20 -------------------------------------------------------------------------- */
22 #if ! defined(EXIT_SUCCESS) || ! defined(EXIT_FAILURE)
23 /* "stdlib.h" should have defined these; but at least
24 on SunOS 4.1.3, this is not so.
26 #define EXIT_SUCCESS 0
27 #define EXIT_FAILURE 1
30 /* declarations for runtime flags/values */
31 #define MAX_RTS_ARGS 32
33 /* -----------------------------------------------------------------------------
35 -------------------------------------------------------------------------- */
37 typedef unsigned int nat; /* at least 32 bits (like int) */
38 typedef unsigned long lnat; /* at least 32 bits */
39 typedef unsigned long long ullong; /* at least 32 bits */
46 /* -----------------------------------------------------------------------------
47 Assertions and Debuggery
48 -------------------------------------------------------------------------- */
51 #define IF_DEBUG(c,s) if (RtsFlags.DebugFlags.c) { s; }
53 #define IF_DEBUG(c,s) doNothing()
56 #if defined(GRAN) && defined(DEBUG)
57 #define IF_GRAN_DEBUG(c,s) if (RtsFlags.GranFlags.Debug.c) { s; }
59 #define IF_GRAN_DEBUG(c,s) doNothing()
62 #if defined(PAR) && defined(DEBUG)
63 #define IF_PAR_DEBUG(c,s) if (RtsFlags.ParFlags.Debug.c) { s; }
65 #define IF_PAR_DEBUG(c,s) doNothing()
68 /* -----------------------------------------------------------------------------
70 -------------------------------------------------------------------------- */
72 #ifdef __GNUC__ /* Avoid spurious warnings */
73 #if __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
74 #define STG_NORETURN __attribute__ ((noreturn))
75 #define STG_UNUSED __attribute__ ((unused))
85 /* -----------------------------------------------------------------------------
86 Useful macros and inline functions
87 -------------------------------------------------------------------------- */
90 * Use this on the RHS of macros which expand to nothing
91 * to make sure that the macro can be used in a context which
92 * demands a non-empty statement.
95 #define doNothing() do { } while (0)
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; })