root/compiler/HsVersions.h

Revision 86f65fdded19519437846304033d5844393dccf5, 3.3 KB (checked in by Ian Lynagh <igloo@…>, 7 months ago)

Remove unused CPP definitions of COMMA

  • Property mode set to 100644
Line 
1#ifndef HSVERSIONS_H
2#define HSVERSIONS_H
3
4#if 0
5
6IMPORTANT!  If you put extra tabs/spaces in these macro definitions,
7you 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/* Global variables may not work in other Haskell implementations,
26 * but we need them currently! so the conditional on GLASGOW won't do. */
27#ifndef __HADDOCK__
28#if defined(__GLASGOW_HASKELL__) || !defined(__GLASGOW_HASKELL__)
29#define GLOBAL_VAR(name,value,ty)  \
30{-# NOINLINE name #-};             \
31name :: IORef (ty);                \
32name = Util.global (value);
33
34#define GLOBAL_VAR_M(name,value,ty) \
35{-# NOINLINE name #-};              \
36name :: IORef (ty);                 \
37name = Util.globalM (value);
38#endif
39#else /* __HADDOCK__ */
40#define GLOBAL_VAR(name,value,ty)  \
41name :: IORef (ty);                \
42name = Util.global (value);
43
44#define GLOBAL_VAR_M(name,value,ty) \
45name :: IORef (ty);                 \
46name = Util.globalM (value);
47#endif
48
49#ifdef DEBUG
50#define ASSERT(e)      if (not (e)) then (assertPanic __FILE__ __LINE__) else
51#define ASSERT2(e,msg) if (not (e)) then (assertPprPanic __FILE__ __LINE__ (msg)) else
52#define WARN( e, msg ) (warnPprTrace (e) __FILE__ __LINE__ (msg)) $
53#else
54-- We have to actually use all the variables we are given or we may get
55-- unused variable warnings when DEBUG is off.
56#define ASSERT(e)      if False && (not (e)) then panic "ASSERT" else
57#define ASSERT2(e,msg) if False && (const False (e,msg)) then pprPanic "ASSERT2" (msg) else
58#define WARN(e,msg)    if False && (e) then pprPanic "WARN" (msg) else
59-- Here we deliberately don't use when as Control.Monad might not be imported
60#endif
61
62-- Examples:   Assuming   flagSet :: String -> m Bool
63-- 
64--    do { c   <- getChar; MASSERT( isUpper c ); ... }
65--    do { c   <- getChar; MASSERT2( isUpper c, text "Bad" ); ... }
66--    do { str <- getStr;  ASSERTM( flagSet str ); .. }
67--    do { str <- getStr;  ASSERTM2( flagSet str, text "Bad" ); .. }
68--    do { str <- getStr;  WARNM2( flagSet str, text "Flag is set" ); .. }
69#define MASSERT(e)      ASSERT(e) return ()
70#define MASSERT2(e,msg) ASSERT2(e,msg) return ()
71#define ASSERTM(e)      do { bool <- e; MASSERT(bool) }
72#define ASSERTM2(e,msg) do { bool <- e; MASSERT2(bool,msg) }
73#define WARNM2(e,msg)   do { bool <- e; WARN(bool, msg) return () }
74
75-- Useful for declaring arguments to be strict
76#define STRICT1(f) f a | a `seq` False = undefined
77#define STRICT2(f) f a b | a `seq` b `seq` False = undefined
78#define STRICT3(f) f a b c | a `seq` b `seq` c `seq` False = undefined
79#define STRICT4(f) f a b c d | a `seq` b `seq` c `seq` d `seq` False = undefined
80#define STRICT5(f) f a b c d e | a `seq` b `seq` c `seq` d `seq` e `seq` False = undefined
81#define STRICT6(f) f a b c d e f | a `seq` b `seq` c `seq` d `seq` e `seq` f `seq` False = undefined
82
83#endif /* HsVersions.h */
Note: See TracBrowser for help on using the browser.