[commit: ghc] wip/nfs-locking: Pass __GLASGOW_HASKELL__ to gcc when compiling directory.c (098c9ec)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:10:31 UTC 2017


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

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/098c9ece49564542cc180a6cba06577695243c7e/ghc

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

commit 098c9ece49564542cc180a6cba06577695243c7e
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Fri Dec 11 00:24:01 2015 +0000

    Pass __GLASGOW_HASKELL__ to gcc when compiling directory.c


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

098c9ece49564542cc180a6cba06577695243c7e
 src/Settings/Builders/Gcc.hs | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/Settings/Builders/Gcc.hs b/src/Settings/Builders/Gcc.hs
index 6a45740..3437a6c 100644
--- a/src/Settings/Builders/Gcc.hs
+++ b/src/Settings/Builders/Gcc.hs
@@ -1,14 +1,21 @@
 module Settings.Builders.Gcc (gccArgs, gccMArgs) where
 
 import Expression
+import GHC
 import Oracles
-import Predicates (stagedBuilder)
+import Predicates (package, stagedBuilder)
 import Settings
 
+-- TODO: I had to define symbol __GLASGOW_HASKELL__ as otherwise directory.c is
+-- effectively empty. I presume it was expected that GHC will be used for
+-- compiling all C files, but I don't know why. It seems that directory.c is the
+-- only file which requires special treatment when using GCC.
 gccArgs :: Args
-gccArgs = stagedBuilder Gcc ? mconcat [ commonGccArgs
-                                      , arg "-c", arg =<< getInput
-                                      , arg "-o", arg =<< getOutput ]
+gccArgs = stagedBuilder Gcc ?
+    mconcat [ commonGccArgs
+            , package directory ? arg "-D__GLASGOW_HASKELL__"
+            , arg "-c", arg =<< getInput
+            , arg "-o", arg =<< getOutput ]
 
 -- TODO: handle custom $1_$2_MKDEPENDC_OPTS and
 gccMArgs :: Args



More information about the ghc-commits mailing list