-parseStaticFlags :: [String] -> IO [String]
-parseStaticFlags args = do
- (leftover, errs) <- processArgs static_flags args
- when (not (null errs)) $ throwDyn (UsageError (unlines errs))
-
- -- deal with the way flags: the way (eg. prof) gives rise to
- -- futher flags, some of which might be static.
- way_flags <- findBuildTag
-
- -- if we're unregisterised, add some more flags
- let unreg_flags | cGhcUnregisterised == "YES" = unregFlags
- | otherwise = []
-
- (more_leftover, errs) <- processArgs static_flags (unreg_flags ++ way_flags)
-
- -- TABLES_NEXT_TO_CODE affects the info table layout.
- -- Be careful to do this *after* all processArgs,
- -- because evaluating tablesNextToCode involves looking at the global
- -- static flags. Those pesky global variables...
- let cg_flags | tablesNextToCode = ["-optc-DTABLES_NEXT_TO_CODE"]
- | otherwise = []
-
- when (not (null errs)) $ ghcError (UsageError (unlines errs))
- return (cg_flags++more_leftover++leftover)
-
-
--- note that ordering is important in the following list: any flag which
--- is a prefix flag (i.e. HasArg, Prefix, OptPrefix, AnySuffix) will override
--- flags further down the list with the same prefix.
-
-static_flags :: [(String, OptKind IO)]
-static_flags = [
- ------- GHCi -------------------------------------------------------
- ( "ignore-dot-ghci", PassFlag addOpt )
- , ( "read-dot-ghci" , NoArg (removeOpt "-ignore-dot-ghci") )
-
- ------- ways --------------------------------------------------------
- , ( "prof" , NoArg (addWay WayProf) )
- , ( "unreg" , NoArg (addWay WayUnreg) )
- , ( "ticky" , NoArg (addWay WayTicky) )
- , ( "parallel" , NoArg (addWay WayPar) )
- , ( "gransim" , NoArg (addWay WayGran) )
- , ( "smp" , NoArg (addWay WayThreaded) ) -- backwards compat.
- , ( "debug" , NoArg (addWay WayDebug) )
- , ( "ndp" , NoArg (addWay WayNDP) )
- , ( "threaded" , NoArg (addWay WayThreaded) )
- -- ToDo: user ways
-
- ------ Debugging ----------------------------------------------------
- , ( "dppr-noprags", PassFlag addOpt )
- , ( "dppr-debug", PassFlag addOpt )
- , ( "dppr-user-length", AnySuffix addOpt )
- -- rest of the debugging flags are dynamic
-
- --------- Profiling --------------------------------------------------
- , ( "auto-all" , NoArg (addOpt "-fauto-sccs-on-all-toplevs") )
- , ( "auto" , NoArg (addOpt "-fauto-sccs-on-exported-toplevs") )
- , ( "caf-all" , NoArg (addOpt "-fauto-sccs-on-individual-cafs") )
- -- "ignore-sccs" doesn't work (ToDo)
-
- , ( "no-auto-all" , NoArg (removeOpt "-fauto-sccs-on-all-toplevs") )
- , ( "no-auto" , NoArg (removeOpt "-fauto-sccs-on-exported-toplevs") )
- , ( "no-caf-all" , NoArg (removeOpt "-fauto-sccs-on-individual-cafs") )
-
- ------- Miscellaneous -----------------------------------------------
- , ( "no-link-chk" , NoArg (return ()) ) -- ignored for backwards compat
-
- ----- Linker --------------------------------------------------------
- , ( "static" , PassFlag addOpt )
- , ( "dynamic" , NoArg (removeOpt "-static") )
- , ( "rdynamic" , NoArg (return ()) ) -- ignored for compat w/ gcc
-
- ----- RTS opts ------------------------------------------------------
- , ( "H" , HasArg (setHeapSize . fromIntegral . decodeSize) )
- , ( "Rghc-timing" , NoArg (enableTimingStats) )
-
- ------ Compiler flags -----------------------------------------------
- -- All other "-fno-<blah>" options cancel out "-f<blah>" on the hsc cmdline
- , ( "fno-", PrefixPred (\s -> isStaticFlag ("f"++s))
- (\s -> removeOpt ("-f"++s)) )
-
- -- Pass all remaining "-f<blah>" options to hsc
- , ( "f", AnySuffixPred (isStaticFlag) addOpt )
- ]