X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=includes%2FStg.h;h=cae4a3a4aa9b984f5efba69e7d84a3c950f389d4;hb=70a2431f90fa932733ce015714ef7848640ed48f;hp=0344b70fd29996fa5897eb40a0ddfdaa3df4e6ca;hpb=a2a67cd520b9841114d69a87a423dabcb3b4368e;p=ghc-hetmet.git diff --git a/includes/Stg.h b/includes/Stg.h index 0344b70..cae4a3a 100644 --- a/includes/Stg.h +++ b/includes/Stg.h @@ -1,15 +1,12 @@ /* ----------------------------------------------------------------------------- * - * (c) The GHC Team, 1998-2004 + * (c) The GHC Team, 1998-2009 * - * Top-level include file for everything STG-ish. - * - * This file is included *automatically* by all .hc files. - * - * NOTE: always include Stg.h *before* any other headers, because we - * define some register variables which must be done before any inline - * functions are defined (some system headers have been known to - * define the odd inline function). + * Top-level include file for everything required when compiling .hc + * code. NOTE: in .hc files, Stg.h must be included *before* any + * other headers, because we define some register variables which must + * be done before any inline functions are defined (some system + * headers have been known to define the odd inline function). * * We generally try to keep as little visible as possible when * compiling .hc files. So for example the definitions of the @@ -18,6 +15,12 @@ * of these types to generate code which manipulates them directly * with pointer arithmetic. * + * In ordinary C code, do not #include this file directly: #include + * "Rts.h" instead. + * + * To understand the structure of the RTS headers, see the wiki: + * http://hackage.haskell.org/trac/ghc/wiki/Commentary/SourceTree/Includes + * * ---------------------------------------------------------------------------*/ #ifndef STG_H @@ -58,6 +61,27 @@ that depend on config info, such as __USE_FILE_OFFSET64 */ #include +// On Solaris, we don't get the INFINITY and NAN constants unless we +// #define _STDC_C99, and we can't do that unless we also use -std=c99, +// because _STDC_C99 causes the headers to use C99 syntax (e.g. restrict). +// We aren't ready for -std=c99 yet, so define INFINITY/NAN by hand using +// the gcc builtins. +#if !defined(INFINITY) +#if defined(__GNUC__) +#define INFINITY __builtin_inf() +#else +#error No definition for INFINITY +#endif +#endif + +#if !defined(NAN) +#if defined(__GNUC__) +#define NAN __builtin_nan("") +#else +#error No definition for NAN +#endif +#endif + /* ----------------------------------------------------------------------------- Useful definitions -------------------------------------------------------------------------- */ @@ -180,6 +204,7 @@ typedef StgWord W_; typedef StgWord* P_; typedef StgInt I_; typedef StgWord StgWordArray[]; +typedef StgFunPtr F_; #define EI_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8)) #define II_(X) static StgWordArray (X) GNU_ATTRIBUTE(aligned (8))