From 9fd23f53af8c45b75b8a4b01d0e6fa1ad6f34aa9 Mon Sep 17 00:00:00 2001 From: simonmar Date: Thu, 26 Apr 2001 13:52:57 +0000 Subject: [PATCH] [project @ 2001-04-26 13:52:57 by simonmar] correct the sanity checking for -ohi --- ghc/compiler/main/Main.hs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index 6bbded7..99b9629 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -1,6 +1,6 @@ {-# OPTIONS -fno-warn-incomplete-patterns #-} ----------------------------------------------------------------------------- --- $Id: Main.hs,v 1.62 2001/03/28 11:01:19 simonmar Exp $ +-- $Id: Main.hs,v 1.63 2001/04/26 13:52:57 simonmar Exp $ -- -- GHC Driver program -- @@ -261,15 +261,21 @@ main = -- mkdependHS is special when (mode == DoMkDependHS) beginMkDependHS + -- -ohi sanity checking + ohi <- readIORef v_Output_hi + if (isJust ohi && + (mode == DoMake || mode == DoInteractive || length srcs > 1)) + then throwDyn (UsageError "-ohi can only be used when compiling a single source file") + else do + -- make/interactive require invoking the compilation manager if (mode == DoMake) then beginMake srcs else do if (mode == DoInteractive) then beginInteractive srcs else do - -- sanity checking + -- -o sanity checking o_file <- readIORef v_Output_file - ohi <- readIORef v_Output_hi - if length srcs > 1 && (isJust ohi || (isJust o_file && mode /= DoLink && mode /= DoMkDLL)) - then throwDyn (UsageError "can't apply -o or -ohi options to multiple source files") + if (length srcs > 1 && isJust o_file && mode /= DoLink && mode /= DoMkDLL) + then throwDyn (UsageError "can't apply -o to multiple source files") else do if null srcs then throwDyn (UsageError "no input files") else do -- 1.7.10.4