From 2ae018a0269ace8d2b6d3e65d616cc1b0b61686b Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 5 Jan 2004 14:54:06 +0000 Subject: [PATCH] [project @ 2004-01-05 14:54:06 by simonmar] Fix bug in genOutputFilenameFunc: the -keep-blah-files options weren't being considered for the final phase. Upshot: -keep-hc-files wasn't working in --make mode (see driver060 & driver061 tests). MERGE TO STABLE --- ghc/compiler/main/DriverPipeline.hs | 40 +++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/ghc/compiler/main/DriverPipeline.hs b/ghc/compiler/main/DriverPipeline.hs index d11ff1f..d1d5c3b 100644 --- a/ghc/compiler/main/DriverPipeline.hs +++ b/ghc/compiler/main/DriverPipeline.hs @@ -382,7 +382,8 @@ pipeLoop phase stop_phase input_fn orig_basename orig_suff genOutputFilenameFunc :: Bool -> Maybe FilePath -> Phase -> String -> IO (Phase{-next phase-} -> Maybe ModLocation -> IO FilePath) -genOutputFilenameFunc keep_output maybe_output_filename stop_phase basename +genOutputFilenameFunc keep_final_output maybe_output_filename + stop_phase basename = do hcsuf <- readIORef v_HC_suf odir <- readIORef v_Output_dir @@ -400,23 +401,30 @@ genOutputFilenameFunc keep_output maybe_output_filename stop_phase basename myPhaseInputExt other = phaseInputExt other func next_phase maybe_location - | next_phase == stop_phase - = case maybe_output_filename of - Just file -> return file - Nothing - | Ln <- next_phase -> return odir_persistent - | keep_output -> return persistent - | otherwise -> newTempName suffix - -- sometimes, we keep output from intermediate stages - | otherwise - = case next_phase of - Ln -> return odir_persistent - Mangle | keep_raw_s -> return persistent - As | keep_s -> return persistent - HCc | keep_hc -> return persistent - _other -> newTempName suffix + | is_last_phase, Just f <- maybe_output_filename = return f + | is_last_phase && keep_final_output = persistent_fn + | keep_this_output = persistent_fn + | otherwise = newTempName suffix + where + is_last_phase = next_phase == stop_phase + + -- sometimes, we keep output from intermediate stages + keep_this_output = + case next_phase of + Ln -> True + Mangle | keep_raw_s -> True + As | keep_s -> True + HCc | keep_hc -> True + _other -> False + suffix = myPhaseInputExt next_phase + + -- persistent object files get put in odir + persistent_fn + | Ln <- next_phase = return odir_persistent + | otherwise = return persistent + persistent = basename ++ '.':suffix odir_persistent -- 1.7.10.4