Commit 9f589efb authored by Isaac Dupree's avatar Isaac Dupree

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
parent ffd34380
......@@ -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 )
......
......@@ -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
......
......@@ -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
......
......@@ -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) }
......
......@@ -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}
......@@ -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}
......
......@@ -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}
......@@ -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)
......
......@@ -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 )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment