[commit: ghc] wip/angerman/llvmng: #elfi -> #elif; unbreak -Werror. (ab5c5c5)
git at git.haskell.org
git at git.haskell.org
Sun Nov 19 08:31:05 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/angerman/llvmng
Link : http://ghc.haskell.org/trac/ghc/changeset/ab5c5c5a871362a05ac9a19b66e8b2422e2dea81/ghc
>---------------------------------------------------------------
commit ab5c5c5a871362a05ac9a19b66e8b2422e2dea81
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date: Sun Nov 19 15:34:36 2017 +0800
#elfi -> #elif; unbreak -Werror.
# Conflicts:
# hadrian
>---------------------------------------------------------------
ab5c5c5a871362a05ac9a19b66e8b2422e2dea81
compiler/main/SysTools.hs | 3 +++
utils/ghc-pkg/Main.hs | 8 +++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs
index 860b724..da26f8e 100644
--- a/compiler/main/SysTools.hs
+++ b/compiler/main/SysTools.hs
@@ -48,7 +48,10 @@ import Platform
import Util
import DynFlags
+#if defined(darwin_HOST_OS) || defined(linux_HOST_OS)
import System.Environment (getExecutablePath)
+#endif
+
import System.FilePath
import System.IO
import System.Directory
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 3dafffd..9a2c99a 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -65,6 +65,9 @@ import System.Directory ( doesDirectoryExist, getDirectoryContents,
getCurrentDirectory )
import System.Exit ( exitWith, ExitCode(..) )
import System.Environment ( getArgs, getProgName, getEnv )
+#if defined(darwin_HOST_OS) || defined(linux_HOST_OS)
+import System.Environment ( getExecutablePath )
+#endif
import System.IO
import System.IO.Error
import GHC.IO.Exception (IOErrorType(InappropriateType))
@@ -2076,6 +2079,7 @@ dieForcible s = die (s ++ " (use --force to override)")
-----------------------------------------
-- Cut and pasted from ghc/compiler/main/SysTools
+getLibDir :: IO (Maybe String)
#if defined(mingw32_HOST_OS)
subst :: Char -> Char -> String -> String
subst a b ls = map (\ x -> if x == a then b else x) ls
@@ -2083,7 +2087,6 @@ subst a b ls = map (\ x -> if x == a then b else x) ls
unDosifyPath :: FilePath -> FilePath
unDosifyPath xs = subst '\\' '/' xs
-getLibDir :: IO (Maybe String)
getLibDir = do base <- getExecDir "/ghc-pkg.exe"
case base of
Nothing -> return Nothing
@@ -2116,7 +2119,7 @@ getExecPath = try_size 2048 -- plenty, PATH_MAX is 512 under Win32.
foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW"
c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32
-#elfi defined(darwin_HOST_OS) || defined(linux_HOST_OS)
+#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS)
-- TODO: a) this is copy-pasta from SysTools.hs / getBaseDir. Why can't we reuse
-- this here? and parameterise getBaseDir over the executable (for
-- windows)?
@@ -2128,7 +2131,6 @@ foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW"
-- Answer: yes this should happen. No one has found the time just yet.
getLibDir = Just . (\p -> p </> "lib") . takeDirectory . takeDirectory <$> getExecutablePath
#else
-getLibDir :: IO (Maybe String)
getLibDir = return Nothing
#endif
More information about the ghc-commits
mailing list