From: simonmar Date: Wed, 14 Jun 2000 11:21:06 +0000 (+0000) Subject: [project @ 2000-06-14 11:21:06 by simonmar] X-Git-Tag: Approximately_9120_patches~4201 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=90bf4766fc89fc02d76ef7a71b94f1da1c6fe90c;p=ghc-hetmet.git [project @ 2000-06-14 11:21:06 by simonmar] Produce a gcc-like "ghc: no input files" when called with nothing to do. Note at the top of the file that we don't support the old driver's "Enter your Haskell program..." nonsense. --- diff --git a/ghc/driver/Main.hs b/ghc/driver/Main.hs index 07adca7..db6563b 100644 --- a/ghc/driver/Main.hs +++ b/ghc/driver/Main.hs @@ -45,6 +45,7 @@ name = global (value) :: IORef (ty); \ ----------------------------------------------------------------------------- -- Differences vs. old driver: +-- No more "Enter your Haskell program, end with ^D (on a line of its own):" -- consistency checking removed (may do this properly later) -- removed -noC -- no hi diffs (could be added later) @@ -114,6 +115,7 @@ data BarfKind | WayCombinationNotSupported [WayName] | PhaseFailed String ExitCode | Interrupted + | NoInputFiles deriving Eq GLOBAL_VAR(prog_name, "ghc", String) @@ -138,6 +140,8 @@ showBarf (WayCombinationNotSupported ws) = showString "combination not supported: " . foldr1 (\a b -> a . showChar '/' . b) (map (showString . wayName . lkupWay) ws) +showBarf (NoInputFiles) + = showString "no input files" barfKindTc = mkTyCon "BarfKind" @@ -1041,13 +1045,16 @@ main = then throwDyn MultipleSrcsOneOutput else do + if null unknown_srcs && null phase_srcs + then throwDyn NoInputFiles + else do + -- if we have unknown files, and we're not doing linking, complain -- (otherwise pass them through to the linker). if not (null unknown_srcs) && not do_linking then throwDyn (UnknownFileType (head unknown_srcs)) else do - let compileFile :: (Phase, String) -> IO String compileFile (phase, src) = do let (orig_base, _) = split_filename src