1 /* -----------------------------------------------------------------------------
2 * $Id: Rts.h,v 1.2 1998/12/02 13:21:21 simonm Exp $
4 * Top-level include file for the RTS itself
6 * ---------------------------------------------------------------------------*/
12 #define NO_REGS /* don't define fixed registers */
16 /* -----------------------------------------------------------------------------
18 -------------------------------------------------------------------------- */
20 #if ! defined(EXIT_SUCCESS) || ! defined(EXIT_FAILURE)
21 /* "stdlib.h" should have defined these; but at least
22 on SunOS 4.1.3, this is not so.
24 #define EXIT_SUCCESS 0
25 #define EXIT_FAILURE 1
28 /* declarations for runtime flags/values */
29 #define MAX_RTS_ARGS 32
31 /* -----------------------------------------------------------------------------
33 -------------------------------------------------------------------------- */
35 typedef unsigned int nat; /* at least 32 bits (like int) */
36 typedef unsigned long lnat; /* at least 32 bits */
37 typedef unsigned long long ullong; /* at least 32 bits */
44 /* -----------------------------------------------------------------------------
45 Assertions and Debuggery
46 -------------------------------------------------------------------------- */
49 #define ASSERT(predicate) /* nothing */
52 void _stgAssert (char *, unsigned int);
54 #define ASSERT(predicate) \
58 _stgAssert(__FILE__, __LINE__)
63 #define IF_DEBUG(c,s) doNothing()
65 #define IF_DEBUG(c,s) if (RtsFlags.DebugFlags.c) { s; }
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; })
101 #define UNUSED __attribute__((unused))