Skip to content
This repository was archived by the owner on Apr 25, 2020. It is now read-only.

Commit f149c05

Browse files
committed
Remove 'SPEC' ifdefs
1 parent d88cd4b commit f149c05

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

GhcModExe/Find.hs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{-# LANGUAGE CPP, BangPatterns, TupleSections, DeriveGeneric #-}
22

33
module GhcModExe.Find
4-
#ifndef SPEC
54
( Symbol
65
, SymbolDb
76
, loadSymbolDb
@@ -14,9 +13,7 @@ module GhcModExe.Find
1413
, AsyncSymbolDb
1514
, newAsyncSymbolDb
1615
, getAsyncSymbolDb
17-
)
18-
#endif
19-
where
16+
) where
2017

2118
import qualified GHC as G
2219
import FastString

core/Language/Haskell/GhcMod/Utils.hs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,18 @@ whenM mb ma = mb >>= flip when ma
7979
-- | Returns the path to the currently running ghc-mod executable. With ghc<7.6
8080
-- this is a guess but >=7.6 uses 'getExecutablePath'.
8181
ghcModExecutable :: IO FilePath
82-
#ifndef SPEC
8382
ghcModExecutable = do
84-
dir <- takeDirectory <$> getExecutablePath'
85-
return $ (if dir == "." then "" else dir) </> "ghc-mod"
86-
#else
87-
ghcModExecutable = do
88-
gpp <- lookupEnv "STACK_EXE"
89-
case gpp of
90-
Just _ -> fmap (</> "ghc-mod") getBinDir
91-
_ -> fmap (</> "dist/build/ghc-mod/ghc-mod") getCurrentDirectory
92-
#endif
83+
exe <- getExecutablePath'
84+
stack <- lookupEnv "STACK_EXE"
85+
case takeBaseName exe of
86+
"spec" | Just _ <- stack ->
87+
(</> "ghc-mod") <$> getBinDir
88+
"spec" ->
89+
(</> "dist/build/ghc-mod-real/ghc-mod-real") <$> getCurrentDirectory
90+
"ghc-mod-real" ->
91+
return exe
92+
_ ->
93+
return $ takeDirectory exe </> "ghc-mod"
9394

9495
getExecutablePath' :: IO FilePath
9596
#if __GLASGOW_HASKELL__ >= 706

ghc-mod.cabal

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ Test-Suite spec
285285
Main-Is: Main.hs
286286
Hs-Source-Dirs: test, src
287287
Ghc-Options: -Wall -fno-warn-deprecations -threaded
288-
CPP-Options: -DSPEC=1
289288
Type: exitcode-stdio-1.0
290289
Other-Modules: Paths_ghc_mod
291290
Dir

0 commit comments

Comments
 (0)