From bd10e5c92533dcfa73a2c338bf4e13bfa10b67f7 Mon Sep 17 00:00:00 2001 From: rrt Date: Thu, 18 Oct 2001 13:56:09 +0000 Subject: [PATCH] [project @ 2001-10-18 13:56:09 by rrt] Make catch work with older compilers, and avoid clash between Exception.catch and PrelException's catch. --- ghc/compiler/main/SysTools.lhs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/main/SysTools.lhs b/ghc/compiler/main/SysTools.lhs index fc847b5..b8682aa 100644 --- a/ghc/compiler/main/SysTools.lhs +++ b/ghc/compiler/main/SysTools.lhs @@ -58,10 +58,9 @@ import CmdLineOpts ( dynFlag, verbosity ) import Exception ( throwDyn ) #if __GLASGOW_HASKELL__ > 408 -import Exception ( catch ) +import qualified Exception ( catch ) #else import Exception ( catchAllIO ) -#define catch catchAllIO #endif import IO import Directory ( doesFileExist, removeFile ) @@ -96,8 +95,16 @@ import CError ( throwErrnoIfMinus1 ) -- as can this import System ( system ) #endif + #include "HsVersions.h" +-- Make catch work on older GHCs +#if __GLASGOW_HASKELL__ > 408 +myCatch = Exception.catch +#else +myCatch = catchAllIO +#endif + \end{code} @@ -647,7 +654,7 @@ removeTmpFiles verb fs ("Deleting: " ++ unwords fs) (mapM_ rm fs) where - rm f = removeFile f `catch` + rm f = removeFile f `myCatch` (\_ignored -> when (verb >= 2) $ hPutStrLn stderr ("Warning: deleting non-existent " ++ f) @@ -714,7 +721,7 @@ traceCmd phase_name cmd_line action ; unless n $ do { -- And run it! - ; action `catch` handle_exn verb + ; action `myCatch` handle_exn verb }} where handle_exn verb exn = do { when (verb >= 2) (hPutStr stderr "\n") -- 1.7.10.4