[commit: ghc] master: Add __GLASGOW_HASKELL_TH__=YES/NO to CPP definitions (c211f8e)

git at git.haskell.org git at git.haskell.org
Thu Oct 30 04:15:53 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c211f8e55b8dd1d43854ce3c4554ffbafb0009f9/ghc

>---------------------------------------------------------------

commit c211f8e55b8dd1d43854ce3c4554ffbafb0009f9
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Wed Oct 29 23:15:07 2014 -0500

    Add __GLASGOW_HASKELL_TH__=YES/NO to CPP definitions
    
    Test Plan: None really.
    
    Reviewers: austin
    
    Reviewed By: austin
    
    Subscribers: thomie, carter, simonmar
    
    Differential Revision: https://phabricator.haskell.org/D386
    
    GHC Trac Issues: #9734


>---------------------------------------------------------------

c211f8e55b8dd1d43854ce3c4554ffbafb0009f9
 compiler/main/DriverPipeline.hs |  6 ++++++
 docs/users_guide/phases.xml     | 15 +++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 6bc67e7..66c6e97 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -2100,6 +2100,11 @@ doCpp dflags raw input_fn output_fn = do
 
     backend_defs <- getBackendDefs dflags
 
+#ifdef GHCI
+    let th_defs = [ "-D__GLASGOW_HASKELL_TH__=YES" ]
+#else
+    let th_defs = [ "-D__GLASGOW_HASKELL_TH__=NO" ]
+#endif
     -- Default CPP defines in Haskell source
     ghcVersionH <- getGhcVersionPathName dflags
     let hsSourceCppOpts =
@@ -2112,6 +2117,7 @@ doCpp dflags raw input_fn output_fn = do
                     ++ map SysTools.Option hsSourceCppOpts
                     ++ map SysTools.Option target_defs
                     ++ map SysTools.Option backend_defs
+                    ++ map SysTools.Option th_defs
                     ++ map SysTools.Option hscpp_opts
                     ++ map SysTools.Option sse_defs
                     ++ map SysTools.Option avx_defs
diff --git a/docs/users_guide/phases.xml b/docs/users_guide/phases.xml
index 085ebbf..b05de99 100644
--- a/docs/users_guide/phases.xml
+++ b/docs/users_guide/phases.xml
@@ -468,6 +468,21 @@ $ cat foo.hspp</screen>
 
       <varlistentry>
         <term>
+          <constant>__GLASGOW_HASKELL_TH__</constant>
+          <indexterm><primary><constant>__GLASGOW_HASKELL_TH__</constant></primary></indexterm>
+        </term>
+        <listitem>
+          <para>
+          This is set to <literal>YES</literal> when the compiler supports Template Haskell, and to
+          <literal>NO</literal> when not. The latter is the case for a stage-1 compiler during bootstrapping, or
+          on architectures where the interpreter is not available.
+          </para>
+        </listitem>
+      </varlistentry>
+
+
+      <varlistentry>
+        <term>
           <constant>__GLASGOW_HASKELL_LLVM__</constant>
           <indexterm><primary><constant>__GLASGOW_HASKELL_LLVM__</constant></primary></indexterm>
         </term>



More information about the ghc-commits mailing list