Delete all /* ! __GLASGOW_HASKELL__ */ code
[ghc.git] / compiler / HsVersions.h
1 #ifndef HSVERSIONS_H
2 #define HSVERSIONS_H
3
4 #if 0
5
6 IMPORTANT! If you put extra tabs/spaces in these macro definitions,
7 you will screw up the layout where they are used in case expressions!
8
9 (This is cpp-dependent, of course)
10
11 #endif
12
13 /* Useful in the headers that we share with the RTS */
14 #define COMPILING_GHC 1
15
16 /* Pull in all the platform defines for this build (foo_TARGET_ARCH etc.) */
17 #include "ghc_boot_platform.h"
18
19 /* Pull in the autoconf defines (HAVE_FOO), but don't include
20 * ghcconfig.h, because that will include ghcplatform.h which has the
21 * wrong platform settings for the compiler (it has the platform
22 * settings for the target plat instead). */
23 #include "../includes/ghcautoconf.h"
24
25 #define GLOBAL_VAR(name,value,ty) \
26 {-# NOINLINE name #-}; \
27 name :: IORef (ty); \
28 name = Util.global (value);
29
30 #define GLOBAL_VAR_M(name,value,ty) \
31 {-# NOINLINE name #-}; \
32 name :: IORef (ty); \
33 name = Util.globalM (value);
34
35 #define ASSERT(e) if debugIsOn && not (e) then (assertPanic __FILE__ __LINE__) else
36 #define ASSERT2(e,msg) if debugIsOn && not (e) then (assertPprPanic __FILE__ __LINE__ (msg)) else
37 #define WARN( e, msg ) (warnPprTrace (e) __FILE__ __LINE__ (msg)) $
38
39 -- Examples: Assuming flagSet :: String -> m Bool
40 --
41 -- do { c <- getChar; MASSERT( isUpper c ); ... }
42 -- do { c <- getChar; MASSERT2( isUpper c, text "Bad" ); ... }
43 -- do { str <- getStr; ASSERTM( flagSet str ); .. }
44 -- do { str <- getStr; ASSERTM2( flagSet str, text "Bad" ); .. }
45 -- do { str <- getStr; WARNM2( flagSet str, text "Flag is set" ); .. }
46 #define MASSERT(e) ASSERT(e) return ()
47 #define MASSERT2(e,msg) ASSERT2(e,msg) return ()
48 #define ASSERTM(e) do { bool <- e; MASSERT(bool) }
49 #define ASSERTM2(e,msg) do { bool <- e; MASSERT2(bool,msg) }
50 #define WARNM2(e,msg) do { bool <- e; WARN(bool, msg) return () }
51
52 -- Useful for declaring arguments to be strict
53 #define STRICT1(f) f a | a `seq` False = undefined
54 #define STRICT2(f) f a b | a `seq` b `seq` False = undefined
55 #define STRICT3(f) f a b c | a `seq` b `seq` c `seq` False = undefined
56 #define STRICT4(f) f a b c d | a `seq` b `seq` c `seq` d `seq` False = undefined
57 #define STRICT5(f) f a b c d e | a `seq` b `seq` c `seq` d `seq` e `seq` False = undefined
58 #define STRICT6(f) f a b c d e f | a `seq` b `seq` c `seq` d `seq` e `seq` f `seq` False = undefined
59
60 #endif /* HsVersions.h */
61