Commit c2867d09 authored by sof's avatar sof
Browse files

[project @ 2001-10-26 05:31:05 by sof]

pipeLoop: Handle pipelines that end with ineffective
final stages (e.g., CPP and/or PP) correctly. i.e.,
need to copy the outcome of the pipeline into the
expected output file, since the final stage didn't.
parent 40f19c21
......@@ -33,7 +33,7 @@ import DriverUtil
import DriverMkDepend
import DriverPhases
import DriverFlags
import SysTools ( newTempName, addFilesToClean, getSysMan )
import SysTools ( newTempName, addFilesToClean, getSysMan, copy )
import qualified SysTools
import HscMain
import Finder
......@@ -285,7 +285,21 @@ pipeLoop (all_phases@((phase, keep, o_suffix):phases))
ofile <- outputFileName True keep final_suffix
return (ofile, final_suffix)
-- carry on ...
Just fn ->
Just fn -> do
Check to see whether we've reached the end of the
pipeline, but did so with an ineffective last stage.
(i.e., it returned the input_fn as the output filename).
If we did and the output is persistent, copy the contents
of input_fn into the file where the pipeline's output is
expected to end up.
atEnd <- finalStage (null phases)
when (atEnd && fn == input_fn)
(copy "Saving away compilation pipeline's output"
Notice that in order to keep the invariant that we can
determine a compilation pipeline's 'start phase' just
......@@ -306,9 +320,14 @@ pipeLoop (all_phases@((phase, keep, o_suffix):phases))
pipeLoop phases (fn, o_suffix) do_linking use_ofile
orig_basename orig_suffix
finalStage lastPhase = do
o_file <- readIORef v_Output_file
return (lastPhase && not do_linking && use_ofile && isJust o_file)
outputFileName last_phase keep suffix
= do o_file <- readIORef v_Output_file
if last_phase && not do_linking && use_ofile && isJust o_file
atEnd <- finalStage last_phase
if atEnd
then case o_file of
Just s -> return s
Nothing -> error "outputFileName"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment