From 69e62273a69dbfd974c6a721176438b1b03345d2 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 22 Jun 2005 08:24:22 +0000 Subject: [PATCH] [project @ 2005-06-22 08:24:22 by simonmar] Check the result of GHC.depanal for errors. --- ghc/compiler/main/DriverMkDepend.hs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ghc/compiler/main/DriverMkDepend.hs b/ghc/compiler/main/DriverMkDepend.hs index f161d64..22e8904 100644 --- a/ghc/compiler/main/DriverMkDepend.hs +++ b/ghc/compiler/main/DriverMkDepend.hs @@ -30,19 +30,20 @@ import Panic import SrcLoc ( unLoc ) import CmdLineParser +#if __GLASGOW_HASKELL__ <= 408 +import Panic ( catchJust, ioErrors ) +#endif +import ErrUtils ( debugTraceMsg, printErrorsAndWarnings ) + import DATA_IOREF ( IORef, readIORef, writeIORef ) import EXCEPTION +import System ( ExitCode(..), exitWith ) import Directory import IO import Monad ( when ) import Maybe ( isJust ) -#if __GLASGOW_HASKELL__ <= 408 -import Panic ( catchJust, ioErrors ) -#endif -import ErrUtils ( debugTraceMsg ) - ----------------------------------------------------------------- -- -- The main function @@ -59,22 +60,24 @@ doMkDependHS session srcs ; targets <- mapM (\s -> GHC.guessTarget s Nothing) srcs ; GHC.setTargets session targets ; excl_mods <- readIORef v_Dep_exclude_mods - ; GHC.depanal session excl_mods - ; mod_summaries <- GHC.getModuleGraph session + ; r <- GHC.depanal session excl_mods + ; case r of + Left e -> do printErrorsAndWarnings e; exitWith (ExitFailure 1) + Right mod_summaries -> do { -- Sort into dependency order -- There should be no cycles - ; let sorted = GHC.topSortModuleGraph False mod_summaries Nothing + let sorted = GHC.topSortModuleGraph False mod_summaries Nothing -- Print out the dependencies if wanted ; debugTraceMsg dflags 2 (showSDoc (text "Module dependencies" $$ ppr sorted)) - + -- Prcess them one by one, dumping results into makefile -- and complaining about cycles ; mapM (processDeps session excl_mods (mkd_tmp_hdl files)) sorted -- Tidy up - ; endMkDependHS dflags files } + ; endMkDependHS dflags files }} ----------------------------------------------------------------- -- -- 1.7.10.4