Fix the behaviour of flags like --help and --version; fixes trac #2620
[ghc-hetmet.git] / ghc / Main.hs
1 {-# OPTIONS -fno-warn-incomplete-patterns -optc-DNON_POSIX_SOURCE #-}
2
3 -----------------------------------------------------------------------------
4 --
5 -- GHC Driver program
6 --
7 -- (c) The University of Glasgow 2005
8 --
9 -----------------------------------------------------------------------------
10
11 module Main (main) where
12
13 #include "HsVersions.h"
14
15 -- The official GHC API
16 import qualified GHC
17 import GHC              ( DynFlags(..), HscTarget(..),
18                           GhcMode(..), GhcLink(..),
19                           LoadHowMuch(..), dopt, DynFlag(..) )
20 import CmdLineParser
21
22 -- Implementations of the various modes (--show-iface, mkdependHS. etc.)
23 import LoadIface        ( showIface )
24 import HscMain          ( newHscEnv )
25 import DriverPipeline   ( oneShot, compileFile )
26 import DriverMkDepend   ( doMkDependHS )
27 #ifdef GHCI
28 import InteractiveUI    ( interactiveUI, ghciWelcomeMsg )
29 #endif
30
31 -- Various other random stuff that we need
32 import Config
33 import HscTypes
34 import Packages         ( dumpPackages )
35 import DriverPhases     ( Phase(..), isSourceFilename, anyHsc,
36                           startPhase, isHaskellSrcFilename )
37 import BasicTypes       ( failed )
38 import StaticFlags
39 import StaticFlagParser
40 import DynFlags
41 import ErrUtils
42 import FastString
43 import Outputable
44 import SrcLoc
45 import Util
46 import Panic
47 import MonadUtils       ( liftIO )
48
49 -- Standard Haskell libraries
50 import System.IO
51 import System.Environment
52 import System.Exit
53 import System.FilePath
54 import Control.Monad
55 import Data.List
56 import Data.Maybe
57
58 -----------------------------------------------------------------------------
59 -- ToDo:
60
61 -- time commands when run with -v
62 -- user ways
63 -- Win32 support: proper signal handling
64 -- reading the package configuration file is too slow
65 -- -K<size>
66
67 -----------------------------------------------------------------------------
68 -- GHC's command-line interface
69
70 main :: IO ()
71 main =
72   
73   GHC.defaultErrorHandler defaultDynFlags $ do
74   -- 1. extract the -B flag from the args
75   argv0 <- getArgs
76
77   let
78         (minusB_args, argv1) = partition ("-B" `isPrefixOf`) argv0
79         mbMinusB | null minusB_args = Nothing
80                  | otherwise = Just (drop 2 (last minusB_args))
81
82   let argv1' = map (mkGeneralLocated "on the commandline") argv1
83   (argv2, staticFlagWarnings) <- parseStaticFlags argv1'
84
85   -- 2. Parse the "mode" flags (--make, --interactive etc.)
86   (cli_mode, argv3, modeFlagWarnings) <- parseModeFlags argv2
87
88   -- If all we want to do is to show the version number then do it
89   -- now, before we start a GHC session etc.
90   -- If we do it later then bootstrapping gets confused as it tries
91   -- to find out what version of GHC it's using before package.conf
92   -- exists, so starting the session fails.
93   case cli_mode of
94     ShowInfo                -> do showInfo
95                                   exitWith ExitSuccess
96     ShowSupportedLanguages  -> do showSupportedLanguages
97                                   exitWith ExitSuccess
98     ShowVersion             -> do showVersion
99                                   exitWith ExitSuccess
100     ShowNumVersion          -> do putStrLn cProjectVersion
101                                   exitWith ExitSuccess
102     _                       -> return ()
103
104   -- start our GHC session
105   GHC.runGhc mbMinusB $ do
106
107   dflags0 <- GHC.getSessionDynFlags
108
109   -- set the default GhcMode, HscTarget and GhcLink.  The HscTarget
110   -- can be further adjusted on a module by module basis, using only
111   -- the -fvia-C and -fasm flags.  If the default HscTarget is not
112   -- HscC or HscAsm, -fvia-C and -fasm have no effect.
113   let dflt_target = hscTarget dflags0
114       (mode, lang, link)
115          = case cli_mode of
116                 DoInteractive   -> (CompManager, HscInterpreted, LinkInMemory)
117                 DoEval _        -> (CompManager, HscInterpreted, LinkInMemory)
118                 DoMake          -> (CompManager, dflt_target,    LinkBinary)
119                 DoMkDependHS    -> (MkDepend,    dflt_target,    LinkBinary)
120                 _               -> (OneShot,     dflt_target,    LinkBinary)
121
122   let dflags1 = dflags0{ ghcMode   = mode,
123                          hscTarget = lang,
124                          ghcLink   = link,
125                          -- leave out hscOutName for now
126                          hscOutName = panic "Main.main:hscOutName not set",
127                          verbosity = case cli_mode of
128                                          DoEval _ -> 0
129                                          _other   -> 1
130                         }
131
132       -- turn on -fimplicit-import-qualified for GHCi now, so that it
133       -- can be overriden from the command-line
134       dflags1a | DoInteractive <- cli_mode = imp_qual_enabled
135                | DoEval _      <- cli_mode = imp_qual_enabled
136                | otherwise                 = dflags1
137         where imp_qual_enabled = dflags1 `dopt_set` Opt_ImplicitImportQualified
138
139         -- The rest of the arguments are "dynamic"
140         -- Leftover ones are presumably files
141   (dflags2, fileish_args, dynamicFlagWarnings) <- GHC.parseDynamicFlags dflags1a argv3
142
143   let flagWarnings = staticFlagWarnings
144                   ++ modeFlagWarnings
145                   ++ dynamicFlagWarnings
146   liftIO $ handleFlagWarnings dflags2 flagWarnings
147
148         -- make sure we clean up after ourselves
149   GHC.defaultCleanupHandler dflags2 $ do
150
151   liftIO $ showBanner cli_mode dflags2
152
153   -- we've finished manipulating the DynFlags, update the session
154   GHC.setSessionDynFlags dflags2
155   dflags3 <- GHC.getSessionDynFlags
156   hsc_env <- GHC.getSession
157
158   let
159      -- To simplify the handling of filepaths, we normalise all filepaths right 
160      -- away - e.g., for win32 platforms, backslashes are converted
161      -- into forward slashes.
162     normal_fileish_paths = map (normalise . unLoc) fileish_args
163     (srcs, objs)         = partition_args normal_fileish_paths [] []
164
165   -- Note: have v_Ld_inputs maintain the order in which 'objs' occurred on 
166   --       the command-line.
167   liftIO $ mapM_ (consIORef v_Ld_inputs) (reverse objs)
168
169         ---------------- Display configuration -----------
170   when (verbosity dflags3 >= 4) $
171         liftIO $ dumpPackages dflags3
172
173   when (verbosity dflags3 >= 3) $ do
174         liftIO $ hPutStrLn stderr ("Hsc static flags: " ++ unwords staticFlags)
175
176         ---------------- Final sanity checking -----------
177   liftIO $ checkOptions cli_mode dflags3 srcs objs
178
179   ---------------- Do the business -----------
180   let alreadyHandled = panic (show cli_mode ++
181                               " should already have been handled")
182
183   handleSourceError (\e -> do
184        GHC.printExceptionAndWarnings e
185        liftIO $ exitWith (ExitFailure 1)) $
186     case cli_mode of
187        ShowUsage              -> liftIO $ showGhcUsage dflags3 cli_mode
188        PrintLibdir            -> liftIO $ putStrLn (topDir dflags3)
189        ShowSupportedLanguages -> alreadyHandled
190        ShowVersion            -> alreadyHandled
191        ShowNumVersion         -> alreadyHandled
192        ShowInterface f        -> liftIO $ doShowIface dflags3 f
193        DoMake                 -> doMake srcs
194        DoMkDependHS           -> doMkDependHS (map fst srcs)
195        StopBefore p           -> oneShot hsc_env p srcs >> GHC.printWarnings
196        DoInteractive          -> interactiveUI srcs Nothing
197        DoEval exprs           -> interactiveUI srcs $ Just $ reverse exprs
198
199   liftIO $ dumpFinalStats dflags3
200   liftIO $ exitWith ExitSuccess
201
202 #ifndef GHCI
203 interactiveUI :: b -> c -> Ghc ()
204 interactiveUI _ _ =
205   ghcError (CmdLineError "not built for interactive use")
206 #endif
207
208 -- -----------------------------------------------------------------------------
209 -- Splitting arguments into source files and object files.  This is where we
210 -- interpret the -x <suffix> option, and attach a (Maybe Phase) to each source
211 -- file indicating the phase specified by the -x option in force, if any.
212
213 partition_args :: [String] -> [(String, Maybe Phase)] -> [String]
214                -> ([(String, Maybe Phase)], [String])
215 partition_args [] srcs objs = (reverse srcs, reverse objs)
216 partition_args ("-x":suff:args) srcs objs
217   | "none" <- suff      = partition_args args srcs objs
218   | StopLn <- phase     = partition_args args srcs (slurp ++ objs)
219   | otherwise           = partition_args rest (these_srcs ++ srcs) objs
220         where phase = startPhase suff
221               (slurp,rest) = break (== "-x") args 
222               these_srcs = zip slurp (repeat (Just phase))
223 partition_args (arg:args) srcs objs
224   | looks_like_an_input arg = partition_args args ((arg,Nothing):srcs) objs
225   | otherwise               = partition_args args srcs (arg:objs)
226
227     {-
228       We split out the object files (.o, .dll) and add them
229       to v_Ld_inputs for use by the linker.
230
231       The following things should be considered compilation manager inputs:
232
233        - haskell source files (strings ending in .hs, .lhs or other 
234          haskellish extension),
235
236        - module names (not forgetting hierarchical module names),
237
238        - and finally we consider everything not containing a '.' to be
239          a comp manager input, as shorthand for a .hs or .lhs filename.
240
241       Everything else is considered to be a linker object, and passed
242       straight through to the linker.
243     -}
244 looks_like_an_input :: String -> Bool
245 looks_like_an_input m =  isSourceFilename m 
246                       || looksLikeModuleName m
247                       || '.' `notElem` m
248
249 -- -----------------------------------------------------------------------------
250 -- Option sanity checks
251
252 -- | Ensure sanity of options.
253 --
254 -- Throws 'UsageError' or 'CmdLineError' if not.
255 checkOptions :: CmdLineMode -> DynFlags -> [(String,Maybe Phase)] -> [String] -> IO ()
256      -- Final sanity checking before kicking off a compilation (pipeline).
257 checkOptions cli_mode dflags srcs objs = do
258      -- Complain about any unknown flags
259    let unknown_opts = [ f | (f@('-':_), _) <- srcs ]
260    when (notNull unknown_opts) (unknownFlagsErr unknown_opts)
261
262    when (notNull (filter isRTSWay (wayNames dflags))
263          && isInterpretiveMode cli_mode) $
264         hPutStrLn stderr ("Warning: -debug, -threaded and -ticky are ignored by GHCi")
265
266         -- -prof and --interactive are not a good combination
267    when (notNull (filter (not . isRTSWay) (wayNames dflags))
268          && isInterpretiveMode cli_mode) $
269       do ghcError (UsageError 
270                    "--interactive can't be used with -prof or -unreg.")
271         -- -ohi sanity check
272    if (isJust (outputHi dflags) && 
273       (isCompManagerMode cli_mode || srcs `lengthExceeds` 1))
274         then ghcError (UsageError "-ohi can only be used when compiling a single source file")
275         else do
276
277         -- -o sanity checking
278    if (srcs `lengthExceeds` 1 && isJust (outputFile dflags)
279          && not (isLinkMode cli_mode))
280         then ghcError (UsageError "can't apply -o to multiple source files")
281         else do
282
283    let not_linking = not (isLinkMode cli_mode) || isNoLink (ghcLink dflags)
284
285    when (not_linking && not (null objs)) $
286         hPutStrLn stderr ("Warning: the following files would be used as linker inputs, but linking is not being done: " ++ unwords objs)
287
288         -- Check that there are some input files
289         -- (except in the interactive case)
290    if null srcs && (null objs || not_linking) && needsInputsMode cli_mode
291         then ghcError (UsageError "no input files")
292         else do
293
294      -- Verify that output files point somewhere sensible.
295    verifyOutputFiles dflags
296
297
298 -- Compiler output options
299
300 -- called to verify that the output files & directories
301 -- point somewhere valid. 
302 --
303 -- The assumption is that the directory portion of these output
304 -- options will have to exist by the time 'verifyOutputFiles'
305 -- is invoked.
306 -- 
307 verifyOutputFiles :: DynFlags -> IO ()
308 verifyOutputFiles dflags = do
309   -- not -odir: we create the directory for -odir if it doesn't exist (#2278).
310   let ofile = outputFile dflags
311   when (isJust ofile) $ do
312      let fn = fromJust ofile
313      flg <- doesDirNameExist fn
314      when (not flg) (nonExistentDir "-o" fn)
315   let ohi = outputHi dflags
316   when (isJust ohi) $ do
317      let hi = fromJust ohi
318      flg <- doesDirNameExist hi
319      when (not flg) (nonExistentDir "-ohi" hi)
320  where
321    nonExistentDir flg dir = 
322      ghcError (CmdLineError ("error: directory portion of " ++ 
323                              show dir ++ " does not exist (used with " ++ 
324                              show flg ++ " option.)"))
325
326 -----------------------------------------------------------------------------
327 -- GHC modes of operation
328
329 data CmdLineMode
330   = ShowUsage               -- ghc -?
331   | PrintLibdir             -- ghc --print-libdir
332   | ShowInfo                -- ghc --info
333   | ShowSupportedLanguages  -- ghc --supported-languages
334   | ShowVersion             -- ghc -V/--version
335   | ShowNumVersion          -- ghc --numeric-version
336   | ShowInterface String    -- ghc --show-iface
337   | DoMkDependHS            -- ghc -M
338   | StopBefore Phase        -- ghc -E | -C | -S
339                             -- StopBefore StopLn is the default
340   | DoMake                  -- ghc --make
341   | DoInteractive           -- ghc --interactive
342   | DoEval [String]         -- ghc -e foo -e bar => DoEval ["bar", "foo"]
343   deriving (Show)
344
345 #ifdef GHCI
346 isInteractiveMode :: CmdLineMode -> Bool
347 isInteractiveMode DoInteractive = True
348 isInteractiveMode _             = False
349 #endif
350
351 -- isInterpretiveMode: byte-code compiler involved
352 isInterpretiveMode :: CmdLineMode -> Bool
353 isInterpretiveMode DoInteractive = True
354 isInterpretiveMode (DoEval _)    = True
355 isInterpretiveMode _             = False
356
357 needsInputsMode :: CmdLineMode -> Bool
358 needsInputsMode DoMkDependHS    = True
359 needsInputsMode (StopBefore _)  = True
360 needsInputsMode DoMake          = True
361 needsInputsMode _               = False
362
363 -- True if we are going to attempt to link in this mode.
364 -- (we might not actually link, depending on the GhcLink flag)
365 isLinkMode :: CmdLineMode -> Bool
366 isLinkMode (StopBefore StopLn) = True
367 isLinkMode DoMake              = True
368 isLinkMode DoInteractive       = True
369 isLinkMode (DoEval _)          = True
370 isLinkMode _                   = False
371
372 isCompManagerMode :: CmdLineMode -> Bool
373 isCompManagerMode DoMake        = True
374 isCompManagerMode DoInteractive = True
375 isCompManagerMode (DoEval _)    = True
376 isCompManagerMode _             = False
377
378
379 -- -----------------------------------------------------------------------------
380 -- Parsing the mode flag
381
382 parseModeFlags :: [Located String]
383                -> IO (CmdLineMode, [Located String], [Located String])
384 parseModeFlags args = do
385   let ((leftover, errs, warns), (mode, _, flags')) =
386          runCmdLine (processArgs mode_flags args) (StopBefore StopLn, "", []) 
387   when (not (null errs)) $ ghcError $ errorsToGhcException errs
388   return (mode, flags' ++ leftover, warns)
389
390 type ModeM = CmdLineP (CmdLineMode, String, [Located String])
391   -- mode flags sometimes give rise to new DynFlags (eg. -C, see below)
392   -- so we collect the new ones and return them.
393
394 mode_flags :: [Flag ModeM]
395 mode_flags =
396   [  ------- help / version ----------------------------------------------
397     Flag "?"                    (PassFlag (setMode ShowUsage))
398          Supported
399   , Flag "-help"                (PassFlag (setMode ShowUsage))
400          Supported
401   , Flag "-print-libdir"        (PassFlag (setMode PrintLibdir))
402          Supported
403   , Flag "V"                    (PassFlag (setMode ShowVersion))
404          Supported
405   , Flag "-version"             (PassFlag (setMode ShowVersion))
406          Supported
407   , Flag "-numeric-version"     (PassFlag (setMode ShowNumVersion))
408          Supported
409   , Flag "-info"                (PassFlag (setMode ShowInfo))
410          Supported
411   , Flag "-supported-languages" (PassFlag (setMode ShowSupportedLanguages))
412          Supported
413
414       ------- interfaces ----------------------------------------------------
415   , Flag "-show-iface"  (HasArg (\f -> setMode (ShowInterface f)
416                                                "--show-iface"))
417          Supported
418
419       ------- primary modes ------------------------------------------------
420   , Flag "M"            (PassFlag (setMode DoMkDependHS))
421          Supported
422   , Flag "E"            (PassFlag (setMode (StopBefore anyHsc)))
423          Supported
424   , Flag "C"            (PassFlag (\f -> do setMode (StopBefore HCc) f
425                                             addFlag "-fvia-C"))
426          Supported
427   , Flag "S"            (PassFlag (setMode (StopBefore As)))
428          Supported
429   , Flag "-make"        (PassFlag (setMode DoMake))
430          Supported
431   , Flag "-interactive" (PassFlag (setMode DoInteractive))
432          Supported
433   , Flag "e"            (HasArg   (\s -> updateMode (updateDoEval s) "-e"))
434          Supported
435
436        -- -fno-code says to stop after Hsc but don't generate any code.
437   , Flag "fno-code"     (PassFlag (\f -> do setMode (StopBefore HCc) f
438                                             addFlag "-fno-code"
439                                             addFlag "-fforce-recomp"))
440          Supported
441   ]
442
443 setMode :: CmdLineMode -> String -> ModeM ()
444 setMode m flag = updateMode (\_ -> m) flag
445
446 updateDoEval :: String -> CmdLineMode -> CmdLineMode
447 updateDoEval expr (DoEval exprs) = DoEval (expr : exprs)
448 updateDoEval expr _              = DoEval [expr]
449
450 updateMode :: (CmdLineMode -> CmdLineMode) -> String -> ModeM ()
451 updateMode f flag = do
452   (old_mode, old_flag, flags') <- getCmdLineState
453   let new_mode = f old_mode
454   if null old_flag || flag == old_flag || overridingMode new_mode
455       then putCmdLineState (new_mode, flag, flags')
456       else if overridingMode old_mode then return ()
457       else ghcError (UsageError
458                ("cannot use `" ++ old_flag ++ "' with `" ++ flag ++ "'"))
459
460 -- This returns true for modes that override other modes, e.g.
461 -- "--interactive --help" and "--help --interactive" are both equivalent
462 -- to "--help"
463 overridingMode :: CmdLineMode -> Bool
464 overridingMode ShowUsage      = True
465 overridingMode ShowVersion    = True
466 overridingMode ShowNumVersion = True
467 overridingMode _              = False
468
469 addFlag :: String -> ModeM ()
470 addFlag s = do
471   (m, f, flags') <- getCmdLineState
472   -- XXX Can we get a useful Loc?
473   putCmdLineState (m, f, mkGeneralLocated "addFlag" s : flags')
474
475
476 -- ----------------------------------------------------------------------------
477 -- Run --make mode
478
479 doMake :: [(String,Maybe Phase)] -> Ghc ()
480 doMake []    = ghcError (UsageError "no input files")
481 doMake srcs  = do
482     let (hs_srcs, non_hs_srcs) = partition haskellish srcs
483
484         haskellish (f,Nothing) = 
485           looksLikeModuleName f || isHaskellSrcFilename f || '.' `notElem` f
486         haskellish (_,Just phase) = 
487           phase `notElem` [As, Cc, CmmCpp, Cmm, StopLn]
488
489     hsc_env <- GHC.getSession
490     o_files <- mapM (\x -> do
491                         f <- compileFile hsc_env StopLn x
492                         GHC.printWarnings
493                         return f)
494                  non_hs_srcs
495     liftIO $ mapM_ (consIORef v_Ld_inputs) (reverse o_files)
496
497     targets <- mapM (uncurry GHC.guessTarget) hs_srcs
498     GHC.setTargets targets
499     ok_flag <- GHC.load LoadAllTargets
500
501     when (failed ok_flag) (liftIO $ exitWith (ExitFailure 1))
502     return ()
503
504
505 -- ---------------------------------------------------------------------------
506 -- --show-iface mode
507
508 doShowIface :: DynFlags -> FilePath -> IO ()
509 doShowIface dflags file = do
510   hsc_env <- newHscEnv dflags
511   showIface hsc_env file
512
513 -- ---------------------------------------------------------------------------
514 -- Various banners and verbosity output.
515
516 showBanner :: CmdLineMode -> DynFlags -> IO ()
517 showBanner _cli_mode dflags = do
518    let verb = verbosity dflags
519
520 #ifdef GHCI
521    -- Show the GHCi banner
522    when (isInteractiveMode _cli_mode && verb >= 1) $ putStrLn ghciWelcomeMsg
523 #endif
524
525    -- Display details of the configuration in verbose mode
526    when (verb >= 2) $
527     do hPutStr stderr "Glasgow Haskell Compiler, Version "
528        hPutStr stderr cProjectVersion
529        hPutStr stderr ", for Haskell 98, stage "
530        hPutStr stderr cStage
531        hPutStr stderr " booted by GHC version "
532        hPutStrLn stderr cBooterVersion
533
534 -- We print out a Read-friendly string, but a prettier one than the
535 -- Show instance gives us
536 showInfo :: IO ()
537 showInfo = do
538     let sq x = " [" ++ x ++ "\n ]"
539     putStrLn $ sq $ concat $ intersperse "\n ," $ map show compilerInfo
540     exitWith ExitSuccess
541
542 showSupportedLanguages :: IO ()
543 showSupportedLanguages = do mapM_ putStrLn supportedLanguages
544                             exitWith ExitSuccess
545
546 showVersion :: IO ()
547 showVersion = do
548   putStrLn (cProjectName ++ ", version " ++ cProjectVersion)
549   exitWith ExitSuccess
550
551 showGhcUsage :: DynFlags -> CmdLineMode -> IO ()
552 showGhcUsage dflags cli_mode = do 
553   let usage_path 
554         | DoInteractive <- cli_mode = ghciUsagePath dflags
555         | otherwise                 = ghcUsagePath dflags
556   usage <- readFile usage_path
557   dump usage
558   exitWith ExitSuccess
559   where
560      dump ""          = return ()
561      dump ('$':'$':s) = putStr progName >> dump s
562      dump (c:s)       = putChar c >> dump s
563
564 dumpFinalStats :: DynFlags -> IO ()
565 dumpFinalStats dflags = 
566   when (dopt Opt_D_faststring_stats dflags) $ dumpFastStringStats dflags
567
568 dumpFastStringStats :: DynFlags -> IO ()
569 dumpFastStringStats dflags = do
570   buckets <- getFastStringTable
571   let (entries, longest, is_z, has_z) = countFS 0 0 0 0 buckets
572       msg = text "FastString stats:" $$
573             nest 4 (vcat [text "size:           " <+> int (length buckets),
574                           text "entries:        " <+> int entries,
575                           text "longest chain:  " <+> int longest,
576                           text "z-encoded:      " <+> (is_z `pcntOf` entries),
577                           text "has z-encoding: " <+> (has_z `pcntOf` entries)
578                          ])
579         -- we usually get more "has z-encoding" than "z-encoded", because
580         -- when we z-encode a string it might hash to the exact same string,
581         -- which will is not counted as "z-encoded".  Only strings whose
582         -- Z-encoding is different from the original string are counted in
583         -- the "z-encoded" total.
584   putMsg dflags msg
585   where
586    x `pcntOf` y = int ((x * 100) `quot` y) <> char '%'
587
588 countFS :: Int -> Int -> Int -> Int -> [[FastString]] -> (Int, Int, Int, Int)
589 countFS entries longest is_z has_z [] = (entries, longest, is_z, has_z)
590 countFS entries longest is_z has_z (b:bs) = 
591   let
592         len = length b
593         longest' = max len longest
594         entries' = entries + len
595         is_zs = length (filter isZEncoded b)
596         has_zs = length (filter hasZEncoding b)
597   in
598         countFS entries' longest' (is_z + is_zs) (has_z + has_zs) bs
599
600 -- -----------------------------------------------------------------------------
601 -- Util
602
603 unknownFlagsErr :: [String] -> a
604 unknownFlagsErr fs = ghcError (UsageError ("unrecognised flags: " ++ unwords fs))