Warning fix for unused and redundant imports
[ghc-hetmet.git] / compiler / main / DriverPipeline.hs
index fba4afb..16a1725 100644 (file)
@@ -30,7 +30,6 @@ import Packages
 import HeaderInfo
 import DriverPhases
 import SysTools
-import qualified SysTools      
 import HscMain
 import Finder
 import HscTypes
@@ -60,7 +59,6 @@ import Control.Monad
 import Data.List       ( isSuffixOf )
 import Data.Maybe
 import System.Exit
-import System.Cmd
 import System.Environment
 
 -- ---------------------------------------------------------------------------
@@ -250,7 +248,7 @@ compileStub dflags mod location = do
 -- ---------------------------------------------------------------------------
 -- Link
 
-link :: GhcMode                        -- interactive or batch
+link :: GhcLink                        -- interactive or batch
      -> DynFlags               -- dynamic flags
      -> Bool                   -- attempt linking in batch mode?
      -> HomePackageTable       -- what to link
@@ -264,15 +262,15 @@ link :: GhcMode                   -- interactive or batch
 -- will succeed.
 
 #ifdef GHCI
-link Interactive dflags batch_attempt_linking hpt
+link LinkInMemory dflags batch_attempt_linking hpt
     = do -- Not Linking...(demand linker will do the job)
         return Succeeded
 #endif
 
-link JustTypecheck dflags batch_attempt_linking hpt
+link NoLink dflags batch_attempt_linking hpt
    = return Succeeded
 
-link BatchCompile dflags batch_attempt_linking hpt
+link LinkBinary dflags batch_attempt_linking hpt
    | batch_attempt_linking
    = do 
        let 
@@ -317,7 +315,7 @@ link BatchCompile dflags batch_attempt_linking hpt
        -- Don't showPass in Batch mode; doLink will do that for us.
        let link = case ghcLink dflags of
                MkDLL       -> doMkDLL
-               StaticLink  -> staticLink
+               LinkBinary  -> staticLink
        link dflags obj_files pkg_deps
 
         debugTraceMsg dflags 3 (text "link: done")
@@ -377,7 +375,7 @@ doLink dflags stop_phase o_files
   | otherwise
   = case ghcLink dflags of
        NoLink     -> return ()
-       StaticLink -> staticLink dflags o_files link_pkgs
+       LinkBinary -> staticLink dflags o_files link_pkgs
        MkDLL      -> doMkDLL dflags o_files link_pkgs
   where
    -- Always link in the haskell98 package for static linking.  Other
@@ -1066,9 +1064,9 @@ runPhase_MoveBinary dflags input_fn
            pvm_executable_base = "=" ++ input_fn
            pvm_executable = pvm_root ++ "/bin/" ++ pvm_arch ++ "/" ++ pvm_executable_base
         -- nuke old binary; maybe use configur'ed names for cp and rm?
-        system ("rm -f " ++ pvm_executable)
+        Panic.try (removeFile pvm_executable)
         -- move the newly created binary into PVM land
-        system ("cp -p " ++ input_fn ++ " " ++ pvm_executable)
+        copy dflags "copying PVM executable" input_fn pvm_executable
         -- generate a wrapper script for running a parallel prg under PVM
         writeFile input_fn (mk_pvm_wrapper_script pvm_executable pvm_executable_base sysMan)
        return True
@@ -1106,18 +1104,18 @@ mk_pvm_wrapper_script pvm_executable pvm_executable_base sysMan = unlines $
   "",
   "args: while ($a = shift(@ARGV)) {",
   "    if ( $a eq '+RTS' ) {",
-  "    $in_RTS_args = 1;",
+  "        $in_RTS_args = 1;",
   "    } elsif ( $a eq '-RTS' ) {",
-  "    $in_RTS_args = 0;",
+  "        $in_RTS_args = 0;",
   "    }",
   "    if ( $a eq '-d' && $in_RTS_args ) {",
-  "    $debug = '-';",
+  "        $debug = '-';",
   "    } elsif ( $a =~ /^-qN(\\d+)/ && $in_RTS_args ) {",
-  "    $nprocessors = $1;",
+  "        $nprocessors = $1;",
   "    } elsif ( $a =~ /^-qp(\\d+)/ && $in_RTS_args ) {",
-  "    $nprocessors = $1;",
+  "        $nprocessors = $1;",
   "    } else {",
-  "    push(@nonPVM_args, $a);",
+  "        push(@nonPVM_args, $a);",
   "    }",
   "}",
   "",