1 /* -----------------------------------------------------------------------------
2 * $Id: Rts.h,v 1.4 1999/01/21 10:31:43 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 IF_DEBUG(c,s) doNothing()
51 #define IF_DEBUG(c,s) if (RtsFlags.DebugFlags.c) { s; }
54 /* -----------------------------------------------------------------------------
56 -------------------------------------------------------------------------- */
58 #ifdef __GNUC__ /* Avoid spurious warnings */
59 #if __GNUC__ >= 2 && __GNUC_MINOR__ >= 7
60 #define STG_NORETURN __attribute__ ((noreturn))
61 #define STG_UNUSED __attribute__ ((unused))
71 /* -----------------------------------------------------------------------------
72 Useful macros and inline functions
73 -------------------------------------------------------------------------- */
76 * Use this on the RHS of macros which expand to nothing
77 * to make sure that the macro can be used in a context which
78 * demands a non-empty statement.
81 #define doNothing() do { } while (0)
83 #define stg_min(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _a : _b; })
84 #define stg_max(a,b) ({typeof(a) _a = (a), _b = (b); _a <= _b ? _b : _a; })
87 #define UNUSED __attribute__((unused))