remove #if branches for pre-ghc-6.0
authorIsaac Dupree <id@isaac.cedarswampstudios.org>
Tue, 5 Jun 2007 23:53:01 +0000 (23:53 +0000)
committerIsaac Dupree <id@isaac.cedarswampstudios.org>
Tue, 5 Jun 2007 23:53:01 +0000 (23:53 +0000)
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

compiler/ghci/InteractiveUI.hs
compiler/main/GHC.hs
compiler/main/SysTools.lhs
compiler/utils/Binary.hs
compiler/utils/FastString.lhs
compiler/utils/Panic.lhs
compiler/utils/StringBuffer.lhs
utils/genapply/GenApply.hs
utils/ghc-pkg/Main.hs

index ca8c050..02344cf 100644 (file)
@@ -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 )
index f6a5134..f53fddc 100644 (file)
@@ -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
index a76cb53..e58270d 100644 (file)
@@ -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
index 6bce832..6941370 100644 (file)
@@ -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) }
index 26f687c..4aa10ae 100644 (file)
@@ -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}
index 300e7fc..ffc3c37 100644 (file)
@@ -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}     
 
index 28a7f67..69caf0e 100644 (file)
@@ -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}
index e9f335d..1a03140 100644 (file)
@@ -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)
index 19be560..b180fb7 100644 (file)
@@ -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 )