From 8245241e08dd6b27da051344a0e42790e25494e1 Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 14 Jun 2001 11:46:55 +0000 Subject: [PATCH] [project @ 2001-06-14 11:46:55 by simonmar] just move some code around. --- ghc/compiler/main/DriverPipeline.hs | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs index 39052ae..e2bddc4 100644 --- a/ghc/compiler/main/DriverPipeline.hs +++ b/ghc/compiler/main/DriverPipeline.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverPipeline.hs,v 1.76 2001/06/08 20:09:43 sof Exp $ +-- $Id: DriverPipeline.hs,v 1.77 2001/06/14 11:46:55 simonmar Exp $ -- -- GHC Driver -- @@ -194,8 +194,13 @@ genPipeline todo stop_flag persistent_output lang filename | otherwise = [ ] -- just pass this file through to the linker -- ToDo: this is somewhat cryptic - not_valid = throwDyn (UsageError ("invalid option combination")) + + stop_phase = case todo of + StopBefore As | split -> SplitAs + StopBefore phase -> phase + DoMkDependHS -> Ln + DoLink -> Ln ----------- ----- ---- --- -- -- - - - -- this shouldn't happen. @@ -204,6 +209,17 @@ genPipeline todo stop_flag persistent_output lang filename ++ filename)) else do + -- if we can't find the phase we're supposed to stop before, + -- something has gone wrong. This test carefully avoids the + -- case where we aren't supposed to do any compilation, because the file + -- is already in linkable form (for example). + if start_phase `elem` pipeline && + (stop_phase /= Ln && stop_phase `notElem` pipeline) + then throwDyn (UsageError + ("flag " ++ stop_flag + ++ " is incompatible with source file `" ++ filename ++ "'")) + else do + let -- .o and .hc suffixes can be overriden by command-line options: myPhaseInputExt Ln | Just s <- osuf = s @@ -235,28 +251,12 @@ genPipeline todo stop_flag persistent_output lang filename -- the suffix on an output file is determined by the next phase -- in the pipeline, so we add linking to the end of the pipeline -- to force the output from the final phase to be a .o file. - stop_phase = case todo of - StopBefore As | split -> SplitAs - StopBefore phase -> phase - DoMkDependHS -> Ln - DoLink -> Ln annotated_pipeline = annotatePipeline (pipeline ++ [Ln]) stop_phase phase_ne p (p1,_,_) = (p1 /= p) ----------- ----- ---- --- -- -- - - - - -- if we can't find the phase we're supposed to stop before, - -- something has gone wrong. This test carefully avoids the - -- case where we aren't supposed to do any compilation, because the file - -- is already in linkable form (for example). - if start_phase `elem` pipeline && - (stop_phase /= Ln && stop_phase `notElem` pipeline) - then throwDyn (UsageError - ("flag " ++ stop_flag - ++ " is incompatible with source file `" ++ filename ++ "'")) - else do - return ( takeWhile (phase_ne stop_phase ) $ dropWhile (phase_ne start_phase) $ -- 1.7.10.4