1 /* -----------------------------------------------------------------------------
2 * $Id: Rts.h,v 1.9 1999/11/09 15:47:08 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) doNothing()
53 #define IF_DEBUG(c,s) if (RtsFlags.DebugFlags.c) { s; }
56 /* -----------------------------------------------------------------------------
58 -------------------------------------------------------------------------- */
60 #ifdef __GNUC__ /* Avoid spurious warnings */
61 #if __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
62 #define STG_NORETURN __attribute__ ((noreturn))
63 #define STG_UNUSED __attribute__ ((unused))
73 /* -----------------------------------------------------------------------------
74 Useful macros and inline functions
75 -------------------------------------------------------------------------- */
78 * Use this on the RHS of macros which expand to nothing
79 * to make sure that the macro can be used in a context which
80 * demands a non-empty statement.
83 #define doNothing() do { } while (0)
85 #define stg_min(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _a : _b; })
86 #define stg_max(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _b : _a; })