[commit: ghc] master: Fix #elfi -> #elif; unbreak -Werror. (7d16d8a)

git at git.haskell.org git at git.haskell.org
Mon Nov 20 02:15:44 UTC 2017


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

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

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

commit 7d16d8a20d5ba6ca38c0fdf5732e3edaa6b14827
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Sun Nov 19 18:46:01 2017 -0500

    Fix #elfi -> #elif; unbreak -Werror.
    
    Reviewers: bgamari, erikd
    
    Reviewed By: bgamari
    
    Subscribers: rwbarton, thomie
    
    Differential Revision: https://phabricator.haskell.org/D4209


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

7d16d8a20d5ba6ca38c0fdf5732e3edaa6b14827
 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