summaryrefslogtreecommitdiff
path: root/ghc/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/Main.hs')
-rw-r--r--ghc/Main.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs
index f0539df6cd..d30a50b7cd 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, NondecreasingIndentation #-}
+{-# LANGUAGE CPP, NondecreasingIndentation, TupleSections #-}
{-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
-----------------------------------------------------------------------------
@@ -517,8 +517,11 @@ parseModeFlags args = do
mode = case mModeFlag of
Nothing -> doMakeMode
Just (m, _) -> m
- errs = errs1 ++ map (mkGeneralLocated "on the commandline") errs2
- when (not (null errs)) $ throwGhcException $ errorsToGhcException errs
+
+ -- See Note [Handling errors when parsing commandline flags]
+ unless (null errs1 && null errs2) $ throwGhcException $ errorsToGhcException $
+ map (("on the commandline", )) $ map unLoc errs1 ++ errs2
+
return (mode, flags' ++ leftover, warns)
type ModeM = CmdLineP (Maybe (Mode, String), [String], [Located String])