From: Isaac Dupree Date: Tue, 5 Jun 2007 23:53:01 +0000 (+0000) Subject: remove #if branches for pre-ghc-6.0 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=9f589efb688f22cb0637f9c1164dd9027b4378a3 remove #if branches for pre-ghc-6.0 I skipped utils/hsc2hs/Main.hs since its ifs also involved checking for old versions of nhc98 (I don't want to figure that out), but removed everything else I found relating to building with pre-6.0 --- diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index ca8c050..02344cf 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -41,10 +41,7 @@ import Util import FastString #ifndef mingw32_HOST_OS -import System.Posix -#if __GLASGOW_HASKELL__ > 504 - hiding (getEnv) -#endif +import System.Posix hiding (getEnv) #else import GHC.ConsoleHandler ( flushConsole ) import System.Win32 ( setConsoleCP, setConsoleOutputCP ) diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index f6a5134..f53fddc 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -267,14 +267,9 @@ import System.Time ( ClockTime ) import Control.Exception as Exception hiding (handle) import Data.IORef import System.IO -import System.IO.Error ( isDoesNotExistError ) +import System.IO.Error ( try, isDoesNotExistError ) import Prelude hiding (init) -#if __GLASGOW_HASKELL__ < 600 -import System.IO as System.IO.Error ( try ) -#else -import System.IO.Error ( try ) -#endif -- ----------------------------------------------------------------------------- -- Exception handlers diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs index a76cb53..e58270d 100644 --- a/compiler/main/SysTools.lhs +++ b/compiler/main/SysTools.lhs @@ -57,11 +57,7 @@ import Data.Maybe import Data.List #ifndef mingw32_HOST_OS -#if __GLASGOW_HASKELL__ > 504 import qualified System.Posix.Internals -#else -import qualified Posix -#endif #else /* Must be Win32 */ import Foreign import CString ( CString, peekCString ) @@ -877,12 +873,9 @@ getBaseDir = return Nothing #ifdef mingw32_HOST_OS foreign import ccall unsafe "_getpid" getProcessID :: IO Int -- relies on Int == Int32 on Windows -#elif __GLASGOW_HASKELL__ > 504 -getProcessID :: IO Int -getProcessID = System.Posix.Internals.c_getpid >>= return . fromIntegral #else getProcessID :: IO Int -getProcessID = Posix.getProcessID +getProcessID = System.Posix.Internals.c_getpid >>= return . fromIntegral #endif -- Divvy up text stream into lines, taking platform dependent diff --git a/compiler/utils/Binary.hs b/compiler/utils/Binary.hs index 6bce832..6941370 100644 --- a/compiler/utils/Binary.hs +++ b/compiler/utils/Binary.hs @@ -660,16 +660,6 @@ getFS bh = do -- go 0 -#if __GLASGOW_HASKELL__ < 600 -mallocForeignPtrBytes :: Int -> IO (ForeignPtr a) -mallocForeignPtrBytes n = do - r <- mallocBytes n - newForeignPtr r (finalizerFree r) - -foreign import ccall unsafe "stdlib.h free" - finalizerFree :: Ptr a -> IO () -#endif - instance Binary PackageId where put_ bh pid = put_ bh (packageIdFS pid) get bh = do { fs <- get bh; return (fsToPackageId fs) } diff --git a/compiler/utils/FastString.lhs b/compiler/utils/FastString.lhs index 26f687c..4aa10ae 100644 --- a/compiler/utils/FastString.lhs +++ b/compiler/utils/FastString.lhs @@ -489,21 +489,7 @@ pokeCAString ptr str = in go str 0 -#if __GLASGOW_HASKELL__ < 600 - -mallocForeignPtrBytes :: Int -> IO (ForeignPtr a) -mallocForeignPtrBytes n = do - r <- mallocBytes n - newForeignPtr r (finalizerFree r) - -foreign import ccall unsafe "stdlib.h free" - finalizerFree :: Ptr a -> IO () - +#if __GLASGOW_HASKELL__ <= 602 peekCAStringLen = peekCStringLen - -#elif __GLASGOW_HASKELL__ <= 602 - -peekCAStringLen = peekCStringLen - #endif \end{code} diff --git a/compiler/utils/Panic.lhs b/compiler/utils/Panic.lhs index 300e7fc..ffc3c37 100644 --- a/compiler/utils/Panic.lhs +++ b/compiler/utils/Panic.lhs @@ -28,11 +28,7 @@ import Config import FastTypes #ifndef mingw32_HOST_OS -# if __GLASGOW_HASKELL__ > 504 import System.Posix.Signals -# else -import Posix ( Handler(Catch), installHandler, sigINT, sigQUIT ) -# endif /* GHC > 504 */ #endif /* mingw32_HOST_OS */ #if defined(mingw32_HOST_OS) && __GLASGOW_HASKELL__ >= 603 @@ -171,11 +167,7 @@ tryMost action = do r <- try action; filter r tryUser :: IO a -> IO (Either Exception.Exception a) tryUser action = tryJust tc_errors action where -#if __GLASGOW_HASKELL__ > 504 tc_errors e@(Exception.IOException ioe) | isUserError ioe = Just e -#else - tc_errors e@(Exception.IOException ioe) | isUserError e = Just e -#endif tc_errors _other = Nothing \end{code} diff --git a/compiler/utils/StringBuffer.lhs b/compiler/utils/StringBuffer.lhs index 28a7f67..69caf0e 100644 --- a/compiler/utils/StringBuffer.lhs +++ b/compiler/utils/StringBuffer.lhs @@ -224,19 +224,4 @@ parseUnsignedInteger buf len radix char_to_int inlinePerformIO :: IO a -> a inlinePerformIO (IO m) = case m realWorld# of (# _, r #) -> r -#if __GLASGOW_HASKELL__ < 600 -mallocForeignPtrArray :: Storable a => Int -> IO (ForeignPtr a) -mallocForeignPtrArray = doMalloc undefined - where - doMalloc :: Storable b => b -> Int -> IO (ForeignPtr b) - doMalloc dummy size = mallocForeignPtrBytes (size * sizeOf dummy) - -mallocForeignPtrBytes :: Int -> IO (ForeignPtr a) -mallocForeignPtrBytes n = do - r <- mallocBytes n - newForeignPtr r (finalizerFree r) - -foreign import ccall unsafe "stdlib.h free" - finalizerFree :: Ptr a -> IO () -#endif \end{code} diff --git a/utils/genapply/GenApply.hs b/utils/genapply/GenApply.hs index e9f335d..1a03140 100644 --- a/utils/genapply/GenApply.hs +++ b/utils/genapply/GenApply.hs @@ -6,7 +6,6 @@ module Main(main) where #include "../../includes/Constants.h" -#if __GLASGOW_HASKELL__ >= 504 import Text.PrettyPrint import Data.Word import Data.Bits @@ -14,14 +13,6 @@ import Data.List ( intersperse ) import System.Exit import System.Environment import System.IO -#else -import System -import IO -import Bits -import Word -import Pretty -import List ( intersperse ) -#endif -- ----------------------------------------------------------------------------- -- Argument kinds (rougly equivalent to PrimRep) diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index 19be560..b180fb7 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -34,18 +34,10 @@ import Prelude #include "../../includes/ghcconfig.h" -#if __GLASGOW_HASKELL__ >= 504 import System.Console.GetOpt import Text.PrettyPrint import qualified Control.Exception as Exception import Data.Maybe -#else -import GetOpt -import Pretty -import qualified Exception -import Maybe -#endif - import Data.Char ( isSpace ) import Monad import Directory @@ -53,21 +45,12 @@ import System ( getArgs, getProgName, getEnv, exitWith, ExitCode(..) ) import System.IO -#if __GLASGOW_HASKELL__ >= 600 import System.IO.Error (try) -#else -import System.IO (try) -#endif import Data.List ( isPrefixOf, isSuffixOf, intersperse, sortBy ) #ifdef mingw32_HOST_OS import Foreign - -#if __GLASGOW_HASKELL__ >= 504 import Foreign.C.String -#else -import CString -#endif #endif import IO ( isPermissionError, isDoesNotExistError )