From e440a5e262dfa09fa02e4d69192948278e734387 Mon Sep 17 00:00:00 2001 From: simonpj Date: Fri, 21 Feb 2003 13:27:01 +0000 Subject: [PATCH] [project @ 2003-02-21 13:26:58 by simonpj] Import pruning, use mingw32_TARGET not HOST, use old-style foreign import (for 4.08 compat) --- ghc/compiler/main/DriverFlags.hs | 4 ++-- ghc/compiler/main/HscMain.lhs | 2 +- ghc/compiler/main/MkIface.lhs | 2 +- ghc/compiler/main/SysTools.lhs | 28 ++++++++++++++-------------- ghc/compiler/main/TidyPgm.lhs | 5 ++--- 5 files changed, 20 insertions(+), 21 deletions(-) diff --git a/ghc/compiler/main/DriverFlags.hs b/ghc/compiler/main/DriverFlags.hs index 14fa847..a015de2 100644 --- a/ghc/compiler/main/DriverFlags.hs +++ b/ghc/compiler/main/DriverFlags.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverFlags.hs,v 1.112 2003/02/07 09:39:02 simonpj Exp $ +-- $Id: DriverFlags.hs,v 1.113 2003/02/21 13:26:58 simonpj Exp $ -- -- Driver flags -- @@ -362,7 +362,7 @@ dynamic_flags = [ -- on all other systems, quoting is necessary, to avoid interpretation -- of shell metacharacters in the arguments (e.g. green-card's -- -DBEGIN_GHC_ONLY='}-' trick). -#ifndef mingw32_HOST_OS +#ifndef mingw32_TARGET_OS , ( "D", Prefix (\s -> addOpt_P ("-D'"++s++"'") ) ) , ( "U", Prefix (\s -> addOpt_P ("-U'"++s++"'") ) ) #else diff --git a/ghc/compiler/main/HscMain.lhs b/ghc/compiler/main/HscMain.lhs index d360dd9..80397da 100644 --- a/ghc/compiler/main/HscMain.lhs +++ b/ghc/compiler/main/HscMain.lhs @@ -74,7 +74,7 @@ import MkExternalCore ( emitExternalCore ) import ParserCore import ParserCoreUtils import FiniteMap ( emptyFM ) -import Name ( nameModule, getName ) +import Name ( nameModule ) import NameEnv ( emptyNameEnv, mkNameEnv ) import NameSet ( emptyNameSet ) import Module ( Module, ModLocation(..), showModMsg ) diff --git a/ghc/compiler/main/MkIface.lhs b/ghc/compiler/main/MkIface.lhs index b01dacd..f8e4a62 100644 --- a/ghc/compiler/main/MkIface.lhs +++ b/ghc/compiler/main/MkIface.lhs @@ -53,7 +53,7 @@ import TyCon ( DataConDetails(..), tyConTyVars, tyConDataCons, tyConTheta, isFunTyCon, isPrimTyCon, isNewTyCon, isClassTyCon, isSynTyCon, isAlgTyCon, isForeignTyCon, getSynTyConDefn, tyConGenInfo, tyConDataConDetails, tyConArity ) -import Class ( classExtraBigSig, classTyCon, DefMeth(..) ) +import Class ( classExtraBigSig, classTyCon ) import FieldLabel ( fieldLabelType ) import TcType ( tcSplitForAllTys, tcFunResultTy, tidyTopType, deNoteType, tyClsNamesOfDFunHead ) import SrcLoc ( noSrcLoc ) diff --git a/ghc/compiler/main/SysTools.lhs b/ghc/compiler/main/SysTools.lhs index 9c7ddce..15d5c88 100644 --- a/ghc/compiler/main/SysTools.lhs +++ b/ghc/compiler/main/SysTools.lhs @@ -86,11 +86,11 @@ import Directory ( doesFileExist, removeFile ) -- GHC <= 4.08 didn't have rawSystem, and runs into problems with long command -- lines on mingw32, so we disallow it now. -#if defined(mingw32_HOST_OS) && (__GLASGOW_HASKELL__ <= 408) +#if defined(mingw32_TARGET_OS) && (__GLASGOW_HASKELL__ <= 408) #error GHC <= 4.08 is not supported for bootstrapping GHC on i386-unknown-mingw32 #endif -#ifndef mingw32_HOST_OS +#ifndef mingw32_TARGET_OS #if __GLASGOW_HASKELL__ > 504 import qualified GHC.Posix #else @@ -103,7 +103,7 @@ import Foreign import CString ( CString, peekCString ) #endif -#ifdef mingw32_HOST_OS +#ifdef mingw32_TARGET_OS #if __GLASGOW_HASKELL__ > 504 import System.Cmd ( rawSystem ) #else @@ -272,7 +272,7 @@ initSysTools minusB_args | am_installed = installed_bin cGHC_MANGLER_PGM | otherwise = inplace cGHC_MANGLER_DIR_REL cGHC_MANGLER_PGM -#ifndef mingw32_HOST_OS +#ifndef mingw32_TARGET_OS -- check whether TMPDIR is set in the environment ; IO.try (do dir <- getEnv "TMPDIR" -- fails if not set setTmpDir dir @@ -314,7 +314,7 @@ initSysTools minusB_args throwDyn (InstallationError ("Can't find package.conf as " ++ pkgconfig_path)) -#if defined(mingw32_HOST_OS) +#if defined(mingw32_TARGET_OS) -- WINDOWS-SPECIFIC STUFF -- On Windows, gcc and friends are distributed with GHC, -- so when "installed" we look in TopDir/bin @@ -417,8 +417,8 @@ initSysTools minusB_args ; return () } -#if defined(mingw32_HOST_OS) -foreign import stdcall unsafe "GetTempPathA" getTempPath :: Int -> CString -> IO Int32 +#if defined(mingw32_TARGET_OS) +foreign import stdcall "GetTempPathA" unsafe getTempPath :: Int -> CString -> IO Int32 #endif \end{code} @@ -701,7 +701,7 @@ runSomething :: String -- For -v message runSomething phase_name pgm args = traceCmd phase_name cmd_line $ do { -#ifndef mingw32_HOST_OS +#ifndef mingw32_TARGET_OS exit_code <- system cmd_line #else exit_code <- rawSystem cmd_line @@ -772,7 +772,7 @@ pgmPath :: String -- Directory string in Unix format -#if defined(mingw32_HOST_OS) +#if defined(mingw32_TARGET_OS) --------------------- Windows version ------------------ dosifyPaths xs = map dosifyPath xs @@ -832,7 +832,7 @@ slash s1 s2 = s1 ++ ('/' : s2) ----------------------------------------------------------------------------- -- Define getExecDir :: IO (Maybe String) -#if defined(mingw32_HOST_OS) +#if defined(mingw32_TARGET_OS) getExecDir :: IO (Maybe String) getExecDir = do let len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32. buf <- mallocArray len @@ -843,14 +843,14 @@ getExecDir = do let len = (2048::Int) -- plenty, PATH_MAX is 512 under Win32. return (Just (reverse (dropList "/bin/ghc.exe" (reverse (unDosifyPath s))))) -foreign import stdcall unsafe "GetModuleFileNameA" +foreign import stdcall "GetModuleFileNameA" unsafe getModuleFileName :: Ptr () -> CString -> Int -> IO Int32 #else getExecDir :: IO (Maybe String) = do return Nothing #endif -#ifdef mingw32_HOST_OS -foreign import ccall unsafe "_getpid" getProcessID :: IO Int -- relies on Int == Int32 on Windows +#ifdef mingw32_TARGET_OS +foreign import ccall "_getpid" unsafe getProcessID :: IO Int -- relies on Int == Int32 on Windows #elif __GLASGOW_HASKELL__ > 504 getProcessID :: IO Int getProcessID = GHC.Posix.c_getpid >>= return . fromIntegral @@ -860,7 +860,7 @@ getProcessID = Posix.getProcessID #endif quote :: String -> String -#if defined(mingw32_HOST_OS) +#if defined(mingw32_TARGET_OS) quote "" = "" quote s = "\"" ++ s ++ "\"" #else diff --git a/ghc/compiler/main/TidyPgm.lhs b/ghc/compiler/main/TidyPgm.lhs index 943e32e..9346a92 100644 --- a/ghc/compiler/main/TidyPgm.lhs +++ b/ghc/compiler/main/TidyPgm.lhs @@ -26,20 +26,19 @@ import Id ( idType, idInfo, idName, idCoreRules, import IdInfo {- loads of stuff -} import NewDemand ( isBottomingSig, topSig ) import BasicTypes ( isNeverActive ) -import Name ( getOccName, nameOccName, mkInternalName, mkExternalName, +import Name ( getOccName, nameOccName, mkInternalName, localiseName, isExternalName, nameSrcLoc ) import RnEnv ( lookupOrigNameCache, newExternalName ) import NameEnv ( filterNameEnv ) import OccName ( TidyOccEnv, initTidyOccEnv, tidyOccName ) import Type ( tidyTopType ) -import Module ( Module, moduleName ) +import Module ( Module ) import HscTypes ( PersistentCompilerState( pcs_nc ), NameCache( nsNames, nsUniqs ), TypeEnv, extendTypeEnvList, typeEnvIds, ModGuts(..), ModGuts, TyThing(..) ) -import FiniteMap ( lookupFM, addToFM ) import Maybes ( orElse ) import ErrUtils ( showPass, dumpIfSet_core ) import UniqFM ( mapUFM ) -- 1.7.10.4