{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}

-------------------------------------------------------------------------------
--
-- | Dynamic flags
--
-- Most flags are dynamic flags, which means they can change from compilation
-- to compilation using @OPTIONS_GHC@ pragmas, and in a multi-session GHC each
-- session can be using different dynamic flags. Dynamic flags can also be set
-- at the prompt in GHCi.
--
-- (c) The University of Glasgow 2005
--
-------------------------------------------------------------------------------

{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}

module GHC.Driver.Session (
        -- * Dynamic flags and associated configuration types
        DumpFlag(..),
        GeneralFlag(..),
        WarningFlag(..), WarnReason(..),
        Language(..),
        PlatformConstants(..),
        FatalMessager, FlushOut(..), FlushErr(..),
        ProfAuto(..),
        glasgowExtsFlags,
        warningGroups, warningHierarchies,
        hasPprDebug, hasNoDebugOutput, hasNoStateHack, hasNoOptCoercion,
        dopt, dopt_set, dopt_unset,
        gopt, gopt_set, gopt_unset, setGeneralFlag', unSetGeneralFlag',
        wopt, wopt_set, wopt_unset,
        wopt_fatal, wopt_set_fatal, wopt_unset_fatal,
        xopt, xopt_set, xopt_unset,
        xopt_set_unlessExplSpec,
        xopt_DuplicateRecordFields,
        xopt_FieldSelectors,
        lang_set,
        DynamicTooState(..), dynamicTooState, setDynamicNow, setDynamicTooFailed,
        dynamicOutputFile,
        sccProfilingEnabled,
        DynFlags(..),
        outputFile, hiSuf, objectSuf, ways,
        FlagSpec(..),
        HasDynFlags(..), ContainsDynFlags(..),
        RtsOptsEnabled(..),
        GhcMode(..), isOneShot,
        GhcLink(..), isNoLink,
        PackageFlag(..), PackageArg(..), ModRenaming(..),
        packageFlagsChanged,
        IgnorePackageFlag(..), TrustFlag(..),
        PackageDBFlag(..), PkgDbRef(..),
        Option(..), showOpt,
        DynLibLoader(..),
        fFlags, fLangFlags, xFlags,
        wWarningFlags,
        dynFlagDependencies,
        makeDynFlagsConsistent,
        positionIndependent,
        optimisationFlags,
        setFlagsFromEnvFile,
        pprDynFlagsDiff,
        flagSpecOf,
        smallestGroups,

        targetProfile,

        -- ** Safe Haskell
        safeHaskellOn, safeHaskellModeEnabled,
        safeImportsOn, safeLanguageOn, safeInferOn,
        packageTrustOn,
        safeDirectImpsReq, safeImplicitImpsReq,
        unsafeFlags, unsafeFlagsForInfer,

        -- ** LLVM Targets
        LlvmTarget(..), LlvmConfig(..),

        -- ** System tool settings and locations
        Settings(..),
        sProgramName,
        sProjectVersion,
        sGhcUsagePath,
        sGhciUsagePath,
        sToolDir,
        sTopDir,
        sTmpDir,
        sGlobalPackageDatabasePath,
        sLdSupportsCompactUnwind,
        sLdSupportsBuildId,
        sLdSupportsFilelist,
        sLdIsGnuLd,
        sGccSupportsNoPie,
        sPgm_L,
        sPgm_P,
        sPgm_F,
        sPgm_c,
        sPgm_a,
        sPgm_l,
        sPgm_lm,
        sPgm_dll,
        sPgm_T,
        sPgm_windres,
        sPgm_libtool,
        sPgm_ar,
        sPgm_ranlib,
        sPgm_lo,
        sPgm_lc,
        sPgm_lcc,
        sPgm_i,
        sOpt_L,
        sOpt_P,
        sOpt_P_fingerprint,
        sOpt_F,
        sOpt_c,
        sOpt_cxx,
        sOpt_a,
        sOpt_l,
        sOpt_lm,
        sOpt_windres,
        sOpt_lo,
        sOpt_lc,
        sOpt_lcc,
        sOpt_i,
        sExtraGccViaCFlags,
        sTargetPlatformString,
        sGhcWithInterpreter,
        sGhcWithSMP,
        sGhcRTSWays,
        sLibFFI,
        sGhcRtsWithLibdw,
        GhcNameVersion(..),
        FileSettings(..),
        PlatformMisc(..),
        settings,
        programName, projectVersion,
        ghcUsagePath, ghciUsagePath, topDir, tmpDir,
        versionedAppDir, versionedFilePath,
        extraGccViaCFlags, globalPackageDatabasePath,
        pgm_L, pgm_P, pgm_F, pgm_c, pgm_a, pgm_l, pgm_lm, pgm_dll, pgm_T,
        pgm_windres, pgm_libtool, pgm_ar, pgm_otool, pgm_install_name_tool,
        pgm_ranlib, pgm_lo, pgm_lc, pgm_lcc, pgm_i,
        opt_L, opt_P, opt_F, opt_c, opt_cxx, opt_a, opt_l, opt_lm, opt_i,
        opt_P_signature,
        opt_windres, opt_lo, opt_lc, opt_lcc,
        updatePlatformConstants,

        -- ** Manipulating DynFlags
        addPluginModuleName,
        defaultDynFlags,                -- Settings -> DynFlags
        initDynFlags,                   -- DynFlags -> IO DynFlags
        defaultFatalMessager,
        defaultFlushOut,
        defaultFlushErr,

        getOpts,                        -- DynFlags -> (DynFlags -> [a]) -> [a]
        getVerbFlags,
        updOptLevel,
        setTmpDir,
        setUnitId,

        TurnOnFlag,
        turnOn,
        turnOff,
        impliedGFlags,
        impliedOffGFlags,
        impliedXFlags,

        -- ** Parsing DynFlags
        parseDynamicFlagsCmdLine,
        parseDynamicFilePragma,
        parseDynamicFlagsFull,

        -- ** Available DynFlags
        allNonDeprecatedFlags,
        flagsAll,
        flagsDynamic,
        flagsPackage,
        flagsForCompletion,

        supportedLanguagesAndExtensions,
        languageExtensions,

        -- ** DynFlags C compiler options
        picCCOpts, picPOpts,

        -- * Compiler configuration suitable for display to the user
        compilerInfo,

        wordAlignment,

        setUnsafeGlobalDynFlags,

        -- * SSE and AVX
        isSseEnabled,
        isSse2Enabled,
        isSse4_2Enabled,
        isBmiEnabled,
        isBmi2Enabled,
        isAvxEnabled,
        isAvx2Enabled,
        isAvx512cdEnabled,
        isAvx512erEnabled,
        isAvx512fEnabled,
        isAvx512pfEnabled,

        -- * Linker/compiler information
        LinkerInfo(..),
        CompilerInfo(..),
        useXLinkerRPath,

        -- * Include specifications
        IncludeSpecs(..), addGlobalInclude, addQuoteInclude, flattenIncludes,
        addImplicitQuoteInclude,

        -- * SDoc
        initSDocContext, initDefaultSDocContext,
  ) where

#include "HsVersions.h"

import GHC.Prelude

import GHC.Platform
import GHC.Platform.Ways
import GHC.Platform.Profile

import GHC.UniqueSubdir (uniqueSubdir)
import GHC.Unit.Types
import GHC.Unit.Parser
import GHC.Unit.Module
import GHC.Builtin.Names ( mAIN_NAME )
import GHC.Driver.Phases ( Phase(..), phaseInputExt )
import GHC.Driver.Flags
import GHC.Driver.Backend
import GHC.Settings.Config
import GHC.Utils.CliOption
import {-# SOURCE #-} GHC.Core.Unfold
import GHC.Driver.CmdLine hiding (WarnReason(..))
import qualified GHC.Driver.CmdLine as Cmd
import GHC.Settings.Constants
import GHC.Utils.Panic
import qualified GHC.Utils.Ppr.Colour as Col
import GHC.Utils.Misc
import GHC.Utils.GlobalVars
import GHC.Data.Maybe
import GHC.Utils.Monad
import GHC.Types.SrcLoc
import GHC.Types.SafeHaskell
import GHC.Types.Basic ( Alignment, alignmentOf, IntWithInf, treatZeroAsInf )
import qualified GHC.Types.FieldLabel as FieldLabel
import GHC.Data.FastString
import GHC.Utils.Fingerprint
import GHC.Utils.Outputable
import GHC.Settings
import GHC.CmmToAsm.CFG.Weight
import {-# SOURCE #-} GHC.Core.Opt.CallerCC

import GHC.SysTools.Terminal ( stderrSupportsAnsiColors )
import GHC.SysTools.BaseDir ( expandToolDir, expandTopDir )

import Data.IORef
import Control.Arrow ((&&&))
import Control.Monad
import Control.Monad.Trans.Class
import Control.Monad.Trans.Writer
import Control.Monad.Trans.Reader
import Control.Monad.Trans.Except

import Data.Ord
import Data.Char
import Data.List (intercalate, sortBy)
import qualified Data.Set as Set
import System.FilePath
import System.Directory
import System.Environment (lookupEnv)
import System.IO
import System.IO.Error
import Text.ParserCombinators.ReadP hiding (char)
import Text.ParserCombinators.ReadP as R

import GHC.Data.EnumSet (EnumSet)
import qualified GHC.Data.EnumSet as EnumSet

import GHC.Foreign (withCString, peekCString)
import qualified GHC.LanguageExtensions as LangExt

-- Note [Updating flag description in the User's Guide]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
-- If you modify anything in this file please make sure that your changes are
-- described in the User's Guide. Please update the flag description in the
-- users guide (docs/users_guide) whenever you add or change a flag.

-- Note [Supporting CLI completion]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
-- The command line interface completion (in for example bash) is an easy way
-- for the developer to learn what flags are available from GHC.
-- GHC helps by separating which flags are available when compiling with GHC,
-- and which flags are available when using GHCi.
-- A flag is assumed to either work in both these modes, or only in one of them.
-- When adding or changing a flag, please consider for which mode the flag will
-- have effect, and annotate it accordingly. For Flags use defFlag, defGhcFlag,
-- defGhciFlag, and for FlagSpec use flagSpec or flagGhciSpec.

-- Note [Adding a language extension]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
-- There are a few steps to adding (or removing) a language extension,
--
--  * Adding the extension to GHC.LanguageExtensions
--
--    The Extension type in libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
--    is the canonical list of language extensions known by GHC.
--
--  * Adding a flag to DynFlags.xFlags
--
--    This is fairly self-explanatory. The name should be concise, memorable,
--    and consistent with any previous implementations of the similar idea in
--    other Haskell compilers.
--
--  * Adding the flag to the documentation
--
--    This is the same as any other flag. See
--    Note [Updating flag description in the User's Guide]
--
--  * Adding the flag to Cabal
--
--    The Cabal library has its own list of all language extensions supported
--    by all major compilers. This is the list that user code being uploaded
--    to Hackage is checked against to ensure language extension validity.
--    Consequently, it is very important that this list remains up-to-date.
--
--    To this end, there is a testsuite test (testsuite/tests/driver/T4437.hs)
--    whose job it is to ensure these GHC's extensions are consistent with
--    Cabal.
--
--    The recommended workflow is,
--
--     1. Temporarily add your new language extension to the
--        expectedGhcOnlyExtensions list in T4437 to ensure the test doesn't
--        break while Cabal is updated.
--
--     2. After your GHC change is accepted, submit a Cabal pull request adding
--        your new extension to Cabal's list (found in
--        Cabal/Language/Haskell/Extension.hs).
--
--     3. After your Cabal change is accepted, let the GHC developers know so
--        they can update the Cabal submodule and remove the extensions from
--        expectedGhcOnlyExtensions.
--
--  * Adding the flag to the GHC Wiki
--
--    There is a change log tracking language extension additions and removals
--    on the GHC wiki:  https://gitlab.haskell.org/ghc/ghc/wikis/language-pragma-history
--
--  See #4437 and #8176.

-- -----------------------------------------------------------------------------
-- DynFlags

-- | Used to differentiate the scope an include needs to apply to.
-- We have to split the include paths to avoid accidentally forcing recursive
-- includes since -I overrides the system search paths. See #14312.
data IncludeSpecs
  = IncludeSpecs { IncludeSpecs -> [[Char]]
includePathsQuote  :: [String]
                 , IncludeSpecs -> [[Char]]
includePathsGlobal :: [String]
                 -- | See note [Implicit include paths]
                 , IncludeSpecs -> [[Char]]
includePathsQuoteImplicit :: [String]
                 }
  deriving Int -> IncludeSpecs -> ShowS
[IncludeSpecs] -> ShowS
IncludeSpecs -> [Char]
(Int -> IncludeSpecs -> ShowS)
-> (IncludeSpecs -> [Char])
-> ([IncludeSpecs] -> ShowS)
-> Show IncludeSpecs
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
showList :: [IncludeSpecs] -> ShowS
$cshowList :: [IncludeSpecs] -> ShowS
show :: IncludeSpecs -> [Char]
$cshow :: IncludeSpecs -> [Char]
showsPrec :: Int -> IncludeSpecs -> ShowS
$cshowsPrec :: Int -> IncludeSpecs -> ShowS
Show

-- | Append to the list of includes a path that shall be included using `-I`
-- when the C compiler is called. These paths override system search paths.
addGlobalInclude :: IncludeSpecs -> [String] -> IncludeSpecs
addGlobalInclude :: IncludeSpecs -> [[Char]] -> IncludeSpecs
addGlobalInclude IncludeSpecs
spec [[Char]]
paths  = let f :: [[Char]]
f = IncludeSpecs -> [[Char]]
includePathsGlobal IncludeSpecs
spec
                               in IncludeSpecs
spec { includePathsGlobal :: [[Char]]
includePathsGlobal = [[Char]]
f [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
paths }

-- | Append to the list of includes a path that shall be included using
-- `-iquote` when the C compiler is called. These paths only apply when quoted
-- includes are used. e.g. #include "foo.h"
addQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs
addQuoteInclude :: IncludeSpecs -> [[Char]] -> IncludeSpecs
addQuoteInclude IncludeSpecs
spec [[Char]]
paths  = let f :: [[Char]]
f = IncludeSpecs -> [[Char]]
includePathsQuote IncludeSpecs
spec
                              in IncludeSpecs
spec { includePathsQuote :: [[Char]]
includePathsQuote = [[Char]]
f [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
paths }

-- | These includes are not considered while fingerprinting the flags for iface
-- | See note [Implicit include paths]
addImplicitQuoteInclude :: IncludeSpecs -> [String] -> IncludeSpecs
addImplicitQuoteInclude :: IncludeSpecs -> [[Char]] -> IncludeSpecs
addImplicitQuoteInclude IncludeSpecs
spec [[Char]]
paths  = let f :: [[Char]]
f = IncludeSpecs -> [[Char]]
includePathsQuoteImplicit IncludeSpecs
spec
                              in IncludeSpecs
spec { includePathsQuoteImplicit :: [[Char]]
includePathsQuoteImplicit = [[Char]]
f [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
paths }


-- | Concatenate and flatten the list of global and quoted includes returning
-- just a flat list of paths.
flattenIncludes :: IncludeSpecs -> [String]
flattenIncludes :: IncludeSpecs -> [[Char]]
flattenIncludes IncludeSpecs
specs =
    IncludeSpecs -> [[Char]]
includePathsQuote IncludeSpecs
specs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++
    IncludeSpecs -> [[Char]]
includePathsQuoteImplicit IncludeSpecs
specs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++
    IncludeSpecs -> [[Char]]
includePathsGlobal IncludeSpecs
specs

{- Note [Implicit include paths]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  The compile driver adds the path to the folder containing the source file being
  compiled to the 'IncludeSpecs', and this change gets recorded in the 'DynFlags'
  that are used later to compute the interface file. Because of this,
  the flags fingerprint derived from these 'DynFlags' and recorded in the
  interface file will end up containing the absolute path to the source folder.

  Build systems with a remote cache like Bazel or Buck (or Shake, see #16956)
  store the build artifacts produced by a build BA for reuse in subsequent builds.

  Embedding source paths in interface fingerprints will thwart these attemps and
  lead to unnecessary recompilations when the source paths in BA differ from the
  source paths in subsequent builds.
 -}


-- | Contains not only a collection of 'GeneralFlag's but also a plethora of
-- information relating to the compilation of a single file or GHC session
data DynFlags = DynFlags {
  DynFlags -> GhcMode
ghcMode               :: GhcMode,
  DynFlags -> GhcLink
ghcLink               :: GhcLink,
  DynFlags -> Backend
backend               :: !Backend,
   -- ^ The backend to use (if any).
   --
   -- Whenever you change the backend, also make sure to set 'ghcLink' to
   -- something sensible.
   --
   -- 'NoBackend' can be used to avoid generating any output, however, note that:
   --
   --  * If a program uses Template Haskell the typechecker may need to run code
   --    from an imported module.  To facilitate this, code generation is enabled
   --    for modules imported by modules that use template haskell, using the
   --    default backend for the platform.
   --    See Note [-fno-code mode].


  -- formerly Settings
  DynFlags -> GhcNameVersion
ghcNameVersion    :: {-# UNPACK #-} !GhcNameVersion,
  DynFlags -> FileSettings
fileSettings      :: {-# UNPACK #-} !FileSettings,
  DynFlags -> Platform
targetPlatform    :: Platform,       -- Filled in by SysTools
  DynFlags -> ToolSettings
toolSettings      :: {-# UNPACK #-} !ToolSettings,
  DynFlags -> PlatformMisc
platformMisc      :: {-# UNPACK #-} !PlatformMisc,
  DynFlags -> [([Char], [Char])]
rawSettings       :: [(String, String)],

  DynFlags -> LlvmConfig
llvmConfig            :: LlvmConfig,
    -- ^ N.B. It's important that this field is lazy since we load the LLVM
    -- configuration lazily. See Note [LLVM Configuration] in "GHC.SysTools".
  DynFlags -> Int
verbosity             :: Int,         -- ^ Verbosity level: see Note [Verbosity levels]
  DynFlags -> Int
optLevel              :: Int,         -- ^ Optimisation level
  DynFlags -> Int
debugLevel            :: Int,         -- ^ How much debug information to produce
  DynFlags -> Int
simplPhases           :: Int,         -- ^ Number of simplifier phases
  DynFlags -> Int
maxSimplIterations    :: Int,         -- ^ Max simplifier iterations
  DynFlags -> Maybe [Char]
ruleCheck             :: Maybe String,
  DynFlags -> Maybe [Char]
inlineCheck           :: Maybe String, -- ^ A prefix to report inlining decisions about
  DynFlags -> [Int]
strictnessBefore      :: [Int],       -- ^ Additional demand analysis

  DynFlags -> Maybe Int
parMakeCount          :: Maybe Int,   -- ^ The number of modules to compile in parallel
                                        --   in --make mode, where Nothing ==> compile as
                                        --   many in parallel as there are CPUs.

  DynFlags -> Bool
enableTimeStats       :: Bool,        -- ^ Enable RTS timing statistics?
  DynFlags -> Maybe Int
ghcHeapSize           :: Maybe Int,   -- ^ The heap size to set.

  DynFlags -> Maybe Int
maxRelevantBinds      :: Maybe Int,   -- ^ Maximum number of bindings from the type envt
                                        --   to show in type error messages
  DynFlags -> Maybe Int
maxValidHoleFits      :: Maybe Int,   -- ^ Maximum number of hole fits to show
                                        --   in typed hole error messages
  DynFlags -> Maybe Int
maxRefHoleFits        :: Maybe Int,   -- ^ Maximum number of refinement hole
                                        --   fits to show in typed hole error
                                        --   messages
  DynFlags -> Maybe Int
refLevelHoleFits      :: Maybe Int,   -- ^ Maximum level of refinement for
                                        --   refinement hole fits in typed hole
                                        --   error messages
  DynFlags -> Int
maxUncoveredPatterns  :: Int,         -- ^ Maximum number of unmatched patterns to show
                                        --   in non-exhaustiveness warnings
  DynFlags -> Int
maxPmCheckModels      :: Int,         -- ^ Soft limit on the number of models
                                        --   the pattern match checker checks
                                        --   a pattern against. A safe guard
                                        --   against exponential blow-up.
  DynFlags -> Int
simplTickFactor       :: Int,         -- ^ Multiplier for simplifier ticks
  DynFlags -> Maybe Int
specConstrThreshold   :: Maybe Int,   -- ^ Threshold for SpecConstr
  DynFlags -> Maybe Int
specConstrCount       :: Maybe Int,   -- ^ Max number of specialisations for any one function
  DynFlags -> Int
specConstrRecursive   :: Int,         -- ^ Max number of specialisations for recursive types
                                        --   Not optional; otherwise ForceSpecConstr can diverge.
  DynFlags -> Word
binBlobThreshold      :: Word,        -- ^ Binary literals (e.g. strings) whose size is above
                                        --   this threshold will be dumped in a binary file
                                        --   by the assembler code generator (0 to disable)
  DynFlags -> Maybe Int
liberateCaseThreshold :: Maybe Int,   -- ^ Threshold for LiberateCase
  DynFlags -> Maybe Int
floatLamArgs          :: Maybe Int,   -- ^ Arg count for lambda floating
                                        --   See 'GHC.Core.Opt.Monad.FloatOutSwitches'

  DynFlags -> Maybe Int
liftLamsRecArgs       :: Maybe Int,   -- ^ Maximum number of arguments after lambda lifting a
                                        --   recursive function.
  DynFlags -> Maybe Int
liftLamsNonRecArgs    :: Maybe Int,   -- ^ Maximum number of arguments after lambda lifting a
                                        --   non-recursive function.
  DynFlags -> Bool
liftLamsKnown         :: Bool,        -- ^ Lambda lift even when this turns a known call
                                        --   into an unknown call.

  DynFlags -> Maybe Int
cmmProcAlignment      :: Maybe Int,   -- ^ Align Cmm functions at this boundary or use default.

  DynFlags -> Int
historySize           :: Int,         -- ^ Simplification history size

  DynFlags -> [[Char]]
importPaths           :: [FilePath],
  DynFlags -> ModuleName
mainModuleNameIs      :: ModuleName,
  DynFlags -> Maybe [Char]
mainFunIs             :: Maybe String,
  DynFlags -> IntWithInf
reductionDepth        :: IntWithInf,   -- ^ Typechecker maximum stack depth
  DynFlags -> IntWithInf
solverIterations      :: IntWithInf,   -- ^ Number of iterations in the constraints solver
                                         --   Typically only 1 is needed

  DynFlags -> UnitId
homeUnitId_             :: UnitId,                 -- ^ Target home unit-id
  DynFlags -> Maybe UnitId
homeUnitInstanceOf_     :: Maybe UnitId,           -- ^ Id of the unit to instantiate
  DynFlags -> [(ModuleName, Module)]
homeUnitInstantiations_ :: [(ModuleName, Module)], -- ^ Module instantiations

  -- ways
  DynFlags -> Ways
targetWays_           :: Ways,         -- ^ Target way flags from the command line

  -- For object splitting
  DynFlags -> Maybe ([Char], Int)
splitInfo             :: Maybe (String,Int),

  -- paths etc.
  DynFlags -> Maybe [Char]
objectDir             :: Maybe String,
  DynFlags -> Maybe [Char]
dylibInstallName      :: Maybe String,
  DynFlags -> Maybe [Char]
hiDir                 :: Maybe String,
  DynFlags -> Maybe [Char]
hieDir                :: Maybe String,
  DynFlags -> Maybe [Char]
stubDir               :: Maybe String,
  DynFlags -> Maybe [Char]
dumpDir               :: Maybe String,

  DynFlags -> [Char]
objectSuf_            :: String,
  DynFlags -> [Char]
hcSuf                 :: String,
  DynFlags -> [Char]
hiSuf_                :: String,
  DynFlags -> [Char]
hieSuf                :: String,

  DynFlags -> IORef Bool
dynamicTooFailed      :: IORef Bool,
  DynFlags -> [Char]
dynObjectSuf_         :: String,
  DynFlags -> [Char]
dynHiSuf_             :: String,

  DynFlags -> Maybe [Char]
outputFile_           :: Maybe String,
  DynFlags -> Maybe [Char]
dynOutputFile_        :: Maybe String,
  DynFlags -> Maybe [Char]
outputHi              :: Maybe String,
  DynFlags -> DynLibLoader
dynLibLoader          :: DynLibLoader,

  DynFlags -> Bool
dynamicNow            :: !Bool, -- ^ Indicate if we are now generating dynamic output
                                  -- because of -dynamic-too. This predicate is
                                  -- used to query the appropriate fields
                                  -- (outputFile/dynOutputFile, ways, etc.)

  -- | This is set by 'GHC.Driver.Pipeline.runPipeline'
  --    or 'ghc.GHCi.UI.runStmt' based on where its output is going.
  DynFlags -> Maybe [Char]
dumpPrefix            :: Maybe FilePath,

  -- | Override the 'dumpPrefix' set by 'GHC.Driver.Pipeline.runPipeline'
  --    or 'ghc.GHCi.UI.runStmt'.
  --    Set by @-ddump-file-prefix@
  DynFlags -> Maybe [Char]
dumpPrefixForce       :: Maybe FilePath,

  DynFlags -> [Option]
ldInputs              :: [Option],

  DynFlags -> IncludeSpecs
includePaths          :: IncludeSpecs,
  DynFlags -> [[Char]]
libraryPaths          :: [String],
  DynFlags -> [[Char]]
frameworkPaths        :: [String],    -- used on darwin only
  DynFlags -> [[Char]]
cmdlineFrameworks     :: [String],    -- ditto

  DynFlags -> Maybe [Char]
rtsOpts               :: Maybe String,
  DynFlags -> RtsOptsEnabled
rtsOptsEnabled        :: RtsOptsEnabled,
  DynFlags -> Bool
rtsOptsSuggestions    :: Bool,

  DynFlags -> [Char]
hpcDir                :: String,      -- ^ Path to store the .mix files

  -- Plugins
  DynFlags -> [ModuleName]
pluginModNames        :: [ModuleName],
  DynFlags -> [(ModuleName, [Char])]
pluginModNameOpts     :: [(ModuleName,String)],
  DynFlags -> [[Char]]
frontendPluginOpts    :: [String],
    -- ^ the @-ffrontend-opt@ flags given on the command line, in *reverse*
    -- order that they're specified on the command line.

  --  For ghc -M
  DynFlags -> [Char]
depMakefile           :: FilePath,
  DynFlags -> Bool
depIncludePkgDeps     :: Bool,
  DynFlags -> Bool
depIncludeCppDeps     :: Bool,
  DynFlags -> [ModuleName]
depExcludeMods        :: [ModuleName],
  DynFlags -> [[Char]]
depSuffixes           :: [String],

  --  Package flags
  DynFlags -> [PackageDBFlag]
packageDBFlags        :: [PackageDBFlag],
        -- ^ The @-package-db@ flags given on the command line, In
        -- *reverse* order that they're specified on the command line.
        -- This is intended to be applied with the list of "initial"
        -- package databases derived from @GHC_PACKAGE_PATH@; see
        -- 'getUnitDbRefs'.

  DynFlags -> [IgnorePackageFlag]
ignorePackageFlags    :: [IgnorePackageFlag],
        -- ^ The @-ignore-package@ flags from the command line.
        -- In *reverse* order that they're specified on the command line.
  DynFlags -> [PackageFlag]
packageFlags          :: [PackageFlag],
        -- ^ The @-package@ and @-hide-package@ flags from the command-line.
        -- In *reverse* order that they're specified on the command line.
  DynFlags -> [PackageFlag]
pluginPackageFlags    :: [PackageFlag],
        -- ^ The @-plugin-package-id@ flags from command line.
        -- In *reverse* order that they're specified on the command line.
  DynFlags -> [TrustFlag]
trustFlags            :: [TrustFlag],
        -- ^ The @-trust@ and @-distrust@ flags.
        -- In *reverse* order that they're specified on the command line.
  DynFlags -> Maybe [Char]
packageEnv            :: Maybe FilePath,
        -- ^ Filepath to the package environment file (if overriding default)


  -- hsc dynamic flags
  DynFlags -> EnumSet DumpFlag
dumpFlags             :: EnumSet DumpFlag,
  DynFlags -> EnumSet GeneralFlag
generalFlags          :: EnumSet GeneralFlag,
  DynFlags -> EnumSet WarningFlag
warningFlags          :: EnumSet WarningFlag,
  DynFlags -> EnumSet WarningFlag
fatalWarningFlags     :: EnumSet WarningFlag,
  -- Don't change this without updating extensionFlags:
  DynFlags -> Maybe Language
language              :: Maybe Language,
  -- | Safe Haskell mode
  DynFlags -> SafeHaskellMode
safeHaskell           :: SafeHaskellMode,
  DynFlags -> Bool
safeInfer             :: Bool,
  DynFlags -> Bool
safeInferred          :: Bool,
  -- We store the location of where some extension and flags were turned on so
  -- we can produce accurate error messages when Safe Haskell fails due to
  -- them.
  DynFlags -> SrcSpan
thOnLoc               :: SrcSpan,
  DynFlags -> SrcSpan
newDerivOnLoc         :: SrcSpan,
  DynFlags -> SrcSpan
deriveViaOnLoc        :: SrcSpan,
  DynFlags -> SrcSpan
overlapInstLoc        :: SrcSpan,
  DynFlags -> SrcSpan
incoherentOnLoc       :: SrcSpan,
  DynFlags -> SrcSpan
pkgTrustOnLoc         :: SrcSpan,
  DynFlags -> SrcSpan
warnSafeOnLoc         :: SrcSpan,
  DynFlags -> SrcSpan
warnUnsafeOnLoc       :: SrcSpan,
  DynFlags -> SrcSpan
trustworthyOnLoc      :: SrcSpan,
  -- Don't change this without updating extensionFlags:
  -- Here we collect the settings of the language extensions
  -- from the command line, the ghci config file and
  -- from interactive :set / :seti commands.
  DynFlags -> [OnOff Extension]
extensions            :: [OnOff LangExt.Extension],
  -- extensionFlags should always be equal to
  --     flattenExtensionFlags language extensions
  -- LangExt.Extension is defined in libraries/ghc-boot so that it can be used
  -- by template-haskell
  DynFlags -> EnumSet Extension
extensionFlags        :: EnumSet LangExt.Extension,

  -- | Unfolding control
  -- See Note [Discounts and thresholds] in GHC.Core.Unfold
  DynFlags -> UnfoldingOpts
unfoldingOpts         :: !UnfoldingOpts,

  DynFlags -> Int
maxWorkerArgs         :: Int,

  DynFlags -> Int
ghciHistSize          :: Int,

  DynFlags -> FlushOut
flushOut              :: FlushOut,
  DynFlags -> FlushErr
flushErr              :: FlushErr,

  DynFlags -> Maybe [Char]
ghcVersionFile        :: Maybe FilePath,
  DynFlags -> Maybe [Char]
haddockOptions        :: Maybe String,

  -- | GHCi scripts specified by -ghci-script, in reverse order
  DynFlags -> [[Char]]
ghciScripts           :: [String],

  -- Output style options
  DynFlags -> Int
pprUserLength         :: Int,
  DynFlags -> Int
pprCols               :: Int,

  DynFlags -> Bool
useUnicode            :: Bool,
  DynFlags -> OverridingBool
useColor              :: OverridingBool,
  DynFlags -> Bool
canUseColor           :: Bool,
  DynFlags -> Scheme
colScheme             :: Col.Scheme,

  -- | what kind of {-# SCC #-} to add automatically
  DynFlags -> ProfAuto
profAuto              :: ProfAuto,
  DynFlags -> [CallerCcFilter]
callerCcFilters       :: [CallerCcFilter],

  DynFlags -> Maybe [Char]
interactivePrint      :: Maybe String,

  DynFlags -> IORef (ModuleEnv Int)
nextWrapperNum        :: IORef (ModuleEnv Int),

  -- | Machine dependent flags (-m\<blah> stuff)
  DynFlags -> Maybe SseVersion
sseVersion            :: Maybe SseVersion,
  DynFlags -> Maybe BmiVersion
bmiVersion            :: Maybe BmiVersion,
  DynFlags -> Bool
avx                   :: Bool,
  DynFlags -> Bool
avx2                  :: Bool,
  DynFlags -> Bool
avx512cd              :: Bool, -- Enable AVX-512 Conflict Detection Instructions.
  DynFlags -> Bool
avx512er              :: Bool, -- Enable AVX-512 Exponential and Reciprocal Instructions.
  DynFlags -> Bool
avx512f               :: Bool, -- Enable AVX-512 instructions.
  DynFlags -> Bool
avx512pf              :: Bool, -- Enable AVX-512 PreFetch Instructions.

  -- | Run-time linker information (what options we need, etc.)
  DynFlags -> IORef (Maybe LinkerInfo)
rtldInfo              :: IORef (Maybe LinkerInfo),

  -- | Run-time compiler information
  DynFlags -> IORef (Maybe CompilerInfo)
rtccInfo              :: IORef (Maybe CompilerInfo),

  -- Constants used to control the amount of optimization done.

  -- | Max size, in bytes, of inline array allocations.
  DynFlags -> Int
maxInlineAllocSize    :: Int,

  -- | Only inline memcpy if it generates no more than this many
  -- pseudo (roughly: Cmm) instructions.
  DynFlags -> Int
maxInlineMemcpyInsns  :: Int,

  -- | Only inline memset if it generates no more than this many
  -- pseudo (roughly: Cmm) instructions.
  DynFlags -> Int
maxInlineMemsetInsns  :: Int,

  -- | Reverse the order of error messages in GHC/GHCi
  DynFlags -> Bool
reverseErrors         :: Bool,

  -- | Limit the maximum number of errors to show
  DynFlags -> Maybe Int
maxErrors             :: Maybe Int,

  -- | Unique supply configuration for testing build determinism
  DynFlags -> Word
initialUnique         :: Word,
  DynFlags -> Int
uniqueIncrement       :: Int,
    -- 'Int' because it can be used to test uniques in decreasing order.

  -- | Temporary: CFG Edge weights for fast iterations
  DynFlags -> Weights
cfgWeights            :: Weights
}

class HasDynFlags m where
    getDynFlags :: m DynFlags

{- It would be desirable to have the more generalised

  instance (MonadTrans t, Monad m, HasDynFlags m) => HasDynFlags (t m) where
      getDynFlags = lift getDynFlags

instance definition. However, that definition would overlap with the
`HasDynFlags (GhcT m)` instance. Instead we define instances for a
couple of common Monad transformers explicitly. -}

instance (Monoid a, Monad m, HasDynFlags m) => HasDynFlags (WriterT a m) where
    getDynFlags :: WriterT a m DynFlags
getDynFlags = m DynFlags -> WriterT a m DynFlags
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m DynFlags
forall (m :: * -> *). HasDynFlags m => m DynFlags
getDynFlags

instance (Monad m, HasDynFlags m) => HasDynFlags (ReaderT a m) where
    getDynFlags :: ReaderT a m DynFlags
getDynFlags = m DynFlags -> ReaderT a m DynFlags
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m DynFlags
forall (m :: * -> *). HasDynFlags m => m DynFlags
getDynFlags

instance (Monad m, HasDynFlags m) => HasDynFlags (MaybeT m) where
    getDynFlags :: MaybeT m DynFlags
getDynFlags = m DynFlags -> MaybeT m DynFlags
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m DynFlags
forall (m :: * -> *). HasDynFlags m => m DynFlags
getDynFlags

instance (Monad m, HasDynFlags m) => HasDynFlags (ExceptT e m) where
    getDynFlags :: ExceptT e m DynFlags
getDynFlags = m DynFlags -> ExceptT e m DynFlags
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m DynFlags
forall (m :: * -> *). HasDynFlags m => m DynFlags
getDynFlags

class ContainsDynFlags t where
    extractDynFlags :: t -> DynFlags

data ProfAuto
  = NoProfAuto         -- ^ no SCC annotations added
  | ProfAutoAll        -- ^ top-level and nested functions are annotated
  | ProfAutoTop        -- ^ top-level functions annotated only
  | ProfAutoExports    -- ^ exported functions annotated only
  | ProfAutoCalls      -- ^ annotate call-sites
  deriving (ProfAuto -> ProfAuto -> Bool
(ProfAuto -> ProfAuto -> Bool)
-> (ProfAuto -> ProfAuto -> Bool) -> Eq ProfAuto
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProfAuto -> ProfAuto -> Bool
$c/= :: ProfAuto -> ProfAuto -> Bool
== :: ProfAuto -> ProfAuto -> Bool
$c== :: ProfAuto -> ProfAuto -> Bool
Eq,Int -> ProfAuto
ProfAuto -> Int
ProfAuto -> [ProfAuto]
ProfAuto -> ProfAuto
ProfAuto -> ProfAuto -> [ProfAuto]
ProfAuto -> ProfAuto -> ProfAuto -> [ProfAuto]
(ProfAuto -> ProfAuto)
-> (ProfAuto -> ProfAuto)
-> (Int -> ProfAuto)
-> (ProfAuto -> Int)
-> (ProfAuto -> [ProfAuto])
-> (ProfAuto -> ProfAuto -> [ProfAuto])
-> (ProfAuto -> ProfAuto -> [ProfAuto])
-> (ProfAuto -> ProfAuto -> ProfAuto -> [ProfAuto])
-> Enum ProfAuto
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: ProfAuto -> ProfAuto -> ProfAuto -> [ProfAuto]
$cenumFromThenTo :: ProfAuto -> ProfAuto -> ProfAuto -> [ProfAuto]
enumFromTo :: ProfAuto -> ProfAuto -> [ProfAuto]
$cenumFromTo :: ProfAuto -> ProfAuto -> [ProfAuto]
enumFromThen :: ProfAuto -> ProfAuto -> [ProfAuto]
$cenumFromThen :: ProfAuto -> ProfAuto -> [ProfAuto]
enumFrom :: ProfAuto -> [ProfAuto]
$cenumFrom :: ProfAuto -> [ProfAuto]
fromEnum :: ProfAuto -> Int
$cfromEnum :: ProfAuto -> Int
toEnum :: Int -> ProfAuto
$ctoEnum :: Int -> ProfAuto
pred :: ProfAuto -> ProfAuto
$cpred :: ProfAuto -> ProfAuto
succ :: ProfAuto -> ProfAuto
$csucc :: ProfAuto -> ProfAuto
Enum)

data LlvmTarget = LlvmTarget
  { LlvmTarget -> [Char]
lDataLayout :: String
  , LlvmTarget -> [Char]
lCPU        :: String
  , LlvmTarget -> [[Char]]
lAttributes :: [String]
  }

-- | See Note [LLVM Configuration] in "GHC.SysTools".
data LlvmConfig = LlvmConfig { LlvmConfig -> [([Char], LlvmTarget)]
llvmTargets :: [(String, LlvmTarget)]
                             , LlvmConfig -> [(Int, [Char])]
llvmPasses  :: [(Int, String)]
                             }

-----------------------------------------------------------------------------
-- Accessessors from 'DynFlags'

-- | "unbuild" a 'Settings' from a 'DynFlags'. This shouldn't be needed in the
-- vast majority of code. But GHCi questionably uses this to produce a default
-- 'DynFlags' from which to compute a flags diff for printing.
settings :: DynFlags -> Settings
settings :: DynFlags -> Settings
settings DynFlags
dflags = Settings
  { sGhcNameVersion :: GhcNameVersion
sGhcNameVersion = DynFlags -> GhcNameVersion
ghcNameVersion DynFlags
dflags
  , sFileSettings :: FileSettings
sFileSettings = DynFlags -> FileSettings
fileSettings DynFlags
dflags
  , sTargetPlatform :: Platform
sTargetPlatform = DynFlags -> Platform
targetPlatform DynFlags
dflags
  , sToolSettings :: ToolSettings
sToolSettings = DynFlags -> ToolSettings
toolSettings DynFlags
dflags
  , sPlatformMisc :: PlatformMisc
sPlatformMisc = DynFlags -> PlatformMisc
platformMisc DynFlags
dflags
  , sRawSettings :: [([Char], [Char])]
sRawSettings = DynFlags -> [([Char], [Char])]
rawSettings DynFlags
dflags
  }

programName :: DynFlags -> String
programName :: DynFlags -> [Char]
programName DynFlags
dflags = GhcNameVersion -> [Char]
ghcNameVersion_programName (GhcNameVersion -> [Char]) -> GhcNameVersion -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> GhcNameVersion
ghcNameVersion DynFlags
dflags
projectVersion :: DynFlags -> String
projectVersion :: DynFlags -> [Char]
projectVersion DynFlags
dflags = GhcNameVersion -> [Char]
ghcNameVersion_projectVersion (DynFlags -> GhcNameVersion
ghcNameVersion DynFlags
dflags)
ghcUsagePath          :: DynFlags -> FilePath
ghcUsagePath :: DynFlags -> [Char]
ghcUsagePath DynFlags
dflags = FileSettings -> [Char]
fileSettings_ghcUsagePath (FileSettings -> [Char]) -> FileSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
ghciUsagePath         :: DynFlags -> FilePath
ghciUsagePath :: DynFlags -> [Char]
ghciUsagePath DynFlags
dflags = FileSettings -> [Char]
fileSettings_ghciUsagePath (FileSettings -> [Char]) -> FileSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
toolDir               :: DynFlags -> Maybe FilePath
toolDir :: DynFlags -> Maybe [Char]
toolDir DynFlags
dflags = FileSettings -> Maybe [Char]
fileSettings_toolDir (FileSettings -> Maybe [Char]) -> FileSettings -> Maybe [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
topDir                :: DynFlags -> FilePath
topDir :: DynFlags -> [Char]
topDir DynFlags
dflags = FileSettings -> [Char]
fileSettings_topDir (FileSettings -> [Char]) -> FileSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
tmpDir                :: DynFlags -> String
tmpDir :: DynFlags -> [Char]
tmpDir DynFlags
dflags = FileSettings -> [Char]
fileSettings_tmpDir (FileSettings -> [Char]) -> FileSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
extraGccViaCFlags     :: DynFlags -> [String]
extraGccViaCFlags :: DynFlags -> [[Char]]
extraGccViaCFlags DynFlags
dflags = ToolSettings -> [[Char]]
toolSettings_extraGccViaCFlags (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
globalPackageDatabasePath   :: DynFlags -> FilePath
globalPackageDatabasePath :: DynFlags -> [Char]
globalPackageDatabasePath DynFlags
dflags = FileSettings -> [Char]
fileSettings_globalPackageDatabase (FileSettings -> [Char]) -> FileSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> FileSettings
fileSettings DynFlags
dflags
pgm_L                 :: DynFlags -> String
pgm_L :: DynFlags -> [Char]
pgm_L DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_L (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_P                 :: DynFlags -> (String,[Option])
pgm_P :: DynFlags -> ([Char], [Option])
pgm_P DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_P (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_F                 :: DynFlags -> String
pgm_F :: DynFlags -> [Char]
pgm_F DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_F (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_c                 :: DynFlags -> String
pgm_c :: DynFlags -> [Char]
pgm_c DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_c (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_a                 :: DynFlags -> (String,[Option])
pgm_a :: DynFlags -> ([Char], [Option])
pgm_a DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_a (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_l                 :: DynFlags -> (String,[Option])
pgm_l :: DynFlags -> ([Char], [Option])
pgm_l DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_l (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_lm                 :: DynFlags -> (String,[Option])
pgm_lm :: DynFlags -> ([Char], [Option])
pgm_lm DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_lm (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_dll               :: DynFlags -> (String,[Option])
pgm_dll :: DynFlags -> ([Char], [Option])
pgm_dll DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_dll (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_T                 :: DynFlags -> String
pgm_T :: DynFlags -> [Char]
pgm_T DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_T (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_windres           :: DynFlags -> String
pgm_windres :: DynFlags -> [Char]
pgm_windres DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_windres (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_libtool           :: DynFlags -> String
pgm_libtool :: DynFlags -> [Char]
pgm_libtool DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_libtool (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_lcc               :: DynFlags -> (String,[Option])
pgm_lcc :: DynFlags -> ([Char], [Option])
pgm_lcc DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_lcc (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_ar                :: DynFlags -> String
pgm_ar :: DynFlags -> [Char]
pgm_ar DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_ar (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_otool             :: DynFlags -> String
pgm_otool :: DynFlags -> [Char]
pgm_otool DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_otool (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_install_name_tool :: DynFlags -> String
pgm_install_name_tool :: DynFlags -> [Char]
pgm_install_name_tool DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_install_name_tool (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_ranlib            :: DynFlags -> String
pgm_ranlib :: DynFlags -> [Char]
pgm_ranlib DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_ranlib (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_lo                :: DynFlags -> (String,[Option])
pgm_lo :: DynFlags -> ([Char], [Option])
pgm_lo DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_lo (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_lc                :: DynFlags -> (String,[Option])
pgm_lc :: DynFlags -> ([Char], [Option])
pgm_lc DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_lc (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_i                 :: DynFlags -> String
pgm_i :: DynFlags -> [Char]
pgm_i DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_i (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_L                 :: DynFlags -> [String]
opt_L :: DynFlags -> [[Char]]
opt_L DynFlags
dflags = ToolSettings -> [[Char]]
toolSettings_opt_L (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_P                 :: DynFlags -> [String]
opt_P :: DynFlags -> [[Char]]
opt_P DynFlags
dflags = (Way -> [[Char]]) -> Ways -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptP (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Ways
ways DynFlags
dflags)
            [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ ToolSettings -> [[Char]]
toolSettings_opt_P (DynFlags -> ToolSettings
toolSettings DynFlags
dflags)

-- This function packages everything that's needed to fingerprint opt_P
-- flags. See Note [Repeated -optP hashing].
opt_P_signature       :: DynFlags -> ([String], Fingerprint)
opt_P_signature :: DynFlags -> ([[Char]], Fingerprint)
opt_P_signature DynFlags
dflags =
  ( (Way -> [[Char]]) -> Ways -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptP (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Ways
ways DynFlags
dflags)
  , ToolSettings -> Fingerprint
toolSettings_opt_P_fingerprint (ToolSettings -> Fingerprint) -> ToolSettings -> Fingerprint
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
  )

opt_F                 :: DynFlags -> [String]
opt_F :: DynFlags -> [[Char]]
opt_F DynFlags
dflags= ToolSettings -> [[Char]]
toolSettings_opt_F (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_c                 :: DynFlags -> [String]
opt_c :: DynFlags -> [[Char]]
opt_c DynFlags
dflags = (Way -> [[Char]]) -> Ways -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptc (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Ways
ways DynFlags
dflags)
            [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ ToolSettings -> [[Char]]
toolSettings_opt_c (DynFlags -> ToolSettings
toolSettings DynFlags
dflags)
opt_cxx               :: DynFlags -> [String]
opt_cxx :: DynFlags -> [[Char]]
opt_cxx DynFlags
dflags= ToolSettings -> [[Char]]
toolSettings_opt_cxx (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_a                 :: DynFlags -> [String]
opt_a :: DynFlags -> [[Char]]
opt_a DynFlags
dflags= ToolSettings -> [[Char]]
toolSettings_opt_a (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_l                 :: DynFlags -> [String]
opt_l :: DynFlags -> [[Char]]
opt_l DynFlags
dflags = (Way -> [[Char]]) -> Ways -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptl (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Ways
ways DynFlags
dflags)
            [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ ToolSettings -> [[Char]]
toolSettings_opt_l (DynFlags -> ToolSettings
toolSettings DynFlags
dflags)
opt_lm                :: DynFlags -> [String]
opt_lm :: DynFlags -> [[Char]]
opt_lm DynFlags
dflags= ToolSettings -> [[Char]]
toolSettings_opt_lm (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_windres           :: DynFlags -> [String]
opt_windres :: DynFlags -> [[Char]]
opt_windres DynFlags
dflags= ToolSettings -> [[Char]]
toolSettings_opt_windres (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_lcc                :: DynFlags -> [String]
opt_lcc :: DynFlags -> [[Char]]
opt_lcc DynFlags
dflags= ToolSettings -> [[Char]]
toolSettings_opt_lcc (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_lo                :: DynFlags -> [String]
opt_lo :: DynFlags -> [[Char]]
opt_lo DynFlags
dflags= ToolSettings -> [[Char]]
toolSettings_opt_lo (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_lc                :: DynFlags -> [String]
opt_lc :: DynFlags -> [[Char]]
opt_lc DynFlags
dflags= ToolSettings -> [[Char]]
toolSettings_opt_lc (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
opt_i                 :: DynFlags -> [String]
opt_i :: DynFlags -> [[Char]]
opt_i DynFlags
dflags= ToolSettings -> [[Char]]
toolSettings_opt_i (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags

-- | The directory for this version of ghc in the user's app directory
-- (typically something like @~/.ghc/x86_64-linux-7.6.3@)
--
versionedAppDir :: String -> ArchOS -> MaybeT IO FilePath
versionedAppDir :: [Char] -> ArchOS -> MaybeT IO [Char]
versionedAppDir [Char]
appname ArchOS
platform = do
  -- Make sure we handle the case the HOME isn't set (see #11678)
  [Char]
appdir <- IO [Char] -> MaybeT IO [Char]
forall a. IO a -> MaybeT IO a
tryMaybeT (IO [Char] -> MaybeT IO [Char]) -> IO [Char] -> MaybeT IO [Char]
forall a b. (a -> b) -> a -> b
$ XdgDirectory -> [Char] -> IO [Char]
getXdgDirectory XdgDirectory
XdgData [Char]
appname
  [Char] -> MaybeT IO [Char]
forall (m :: * -> *) a. Monad m => a -> m a
return ([Char] -> MaybeT IO [Char]) -> [Char] -> MaybeT IO [Char]
forall a b. (a -> b) -> a -> b
$ [Char]
appdir [Char] -> ShowS
</> ArchOS -> [Char]
versionedFilePath ArchOS
platform

versionedFilePath :: ArchOS -> FilePath
versionedFilePath :: ArchOS -> [Char]
versionedFilePath ArchOS
platform = ArchOS -> [Char]
uniqueSubdir ArchOS
platform

-- | The 'GhcMode' tells us whether we're doing multi-module
-- compilation (controlled via the "GHC" API) or one-shot
-- (single-module) compilation.  This makes a difference primarily to
-- the "GHC.Unit.Finder": in one-shot mode we look for interface files for
-- imported modules, but in multi-module mode we look for source files
-- in order to check whether they need to be recompiled.
data GhcMode
  = CompManager         -- ^ @\-\-make@, GHCi, etc.
  | OneShot             -- ^ @ghc -c Foo.hs@
  | MkDepend            -- ^ @ghc -M@, see "GHC.Unit.Finder" for why we need this
  deriving GhcMode -> GhcMode -> Bool
(GhcMode -> GhcMode -> Bool)
-> (GhcMode -> GhcMode -> Bool) -> Eq GhcMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GhcMode -> GhcMode -> Bool
$c/= :: GhcMode -> GhcMode -> Bool
== :: GhcMode -> GhcMode -> Bool
$c== :: GhcMode -> GhcMode -> Bool
Eq

instance Outputable GhcMode where
  ppr :: GhcMode -> SDoc
ppr GhcMode
CompManager = [Char] -> SDoc
text [Char]
"CompManager"
  ppr GhcMode
OneShot     = [Char] -> SDoc
text [Char]
"OneShot"
  ppr GhcMode
MkDepend    = [Char] -> SDoc
text [Char]
"MkDepend"

isOneShot :: GhcMode -> Bool
isOneShot :: GhcMode -> Bool
isOneShot GhcMode
OneShot = Bool
True
isOneShot GhcMode
_other  = Bool
False

-- | What to do in the link step, if there is one.
data GhcLink
  = NoLink              -- ^ Don't link at all
  | LinkBinary          -- ^ Link object code into a binary
  | LinkInMemory        -- ^ Use the in-memory dynamic linker (works for both
                        --   bytecode and object code).
  | LinkDynLib          -- ^ Link objects into a dynamic lib (DLL on Windows, DSO on ELF platforms)
  | LinkStaticLib       -- ^ Link objects into a static lib
  deriving (GhcLink -> GhcLink -> Bool
(GhcLink -> GhcLink -> Bool)
-> (GhcLink -> GhcLink -> Bool) -> Eq GhcLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GhcLink -> GhcLink -> Bool
$c/= :: GhcLink -> GhcLink -> Bool
== :: GhcLink -> GhcLink -> Bool
$c== :: GhcLink -> GhcLink -> Bool
Eq, Int -> GhcLink -> ShowS
[GhcLink] -> ShowS
GhcLink -> [Char]
(Int -> GhcLink -> ShowS)
-> (GhcLink -> [Char]) -> ([GhcLink] -> ShowS) -> Show GhcLink
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
showList :: [GhcLink] -> ShowS
$cshowList :: [GhcLink] -> ShowS
show :: GhcLink -> [Char]
$cshow :: GhcLink -> [Char]
showsPrec :: Int -> GhcLink -> ShowS
$cshowsPrec :: Int -> GhcLink -> ShowS
Show)

isNoLink :: GhcLink -> Bool
isNoLink :: GhcLink -> Bool
isNoLink GhcLink
NoLink = Bool
True
isNoLink GhcLink
_      = Bool
False

-- | We accept flags which make packages visible, but how they select
-- the package varies; this data type reflects what selection criterion
-- is used.
data PackageArg =
      PackageArg String    -- ^ @-package@, by 'PackageName'
    | UnitIdArg Unit       -- ^ @-package-id@, by 'Unit'
  deriving (PackageArg -> PackageArg -> Bool
(PackageArg -> PackageArg -> Bool)
-> (PackageArg -> PackageArg -> Bool) -> Eq PackageArg
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageArg -> PackageArg -> Bool
$c/= :: PackageArg -> PackageArg -> Bool
== :: PackageArg -> PackageArg -> Bool
$c== :: PackageArg -> PackageArg -> Bool
Eq, Int -> PackageArg -> ShowS
[PackageArg] -> ShowS
PackageArg -> [Char]
(Int -> PackageArg -> ShowS)
-> (PackageArg -> [Char])
-> ([PackageArg] -> ShowS)
-> Show PackageArg
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
showList :: [PackageArg] -> ShowS
$cshowList :: [PackageArg] -> ShowS
show :: PackageArg -> [Char]
$cshow :: PackageArg -> [Char]
showsPrec :: Int -> PackageArg -> ShowS
$cshowsPrec :: Int -> PackageArg -> ShowS
Show)

instance Outputable PackageArg where
    ppr :: PackageArg -> SDoc
ppr (PackageArg [Char]
pn) = [Char] -> SDoc
text [Char]
"package" SDoc -> SDoc -> SDoc
<+> [Char] -> SDoc
text [Char]
pn
    ppr (UnitIdArg Unit
uid) = [Char] -> SDoc
text [Char]
"unit" SDoc -> SDoc -> SDoc
<+> Unit -> SDoc
forall a. Outputable a => a -> SDoc
ppr Unit
uid

-- | Represents the renaming that may be associated with an exposed
-- package, e.g. the @rns@ part of @-package "foo (rns)"@.
--
-- Here are some example parsings of the package flags (where
-- a string literal is punned to be a 'ModuleName':
--
--      * @-package foo@ is @ModRenaming True []@
--      * @-package foo ()@ is @ModRenaming False []@
--      * @-package foo (A)@ is @ModRenaming False [("A", "A")]@
--      * @-package foo (A as B)@ is @ModRenaming False [("A", "B")]@
--      * @-package foo with (A as B)@ is @ModRenaming True [("A", "B")]@
data ModRenaming = ModRenaming {
    ModRenaming -> Bool
modRenamingWithImplicit :: Bool, -- ^ Bring all exposed modules into scope?
    ModRenaming -> [(ModuleName, ModuleName)]
modRenamings :: [(ModuleName, ModuleName)] -- ^ Bring module @m@ into scope
                                               --   under name @n@.
  } deriving (ModRenaming -> ModRenaming -> Bool
(ModRenaming -> ModRenaming -> Bool)
-> (ModRenaming -> ModRenaming -> Bool) -> Eq ModRenaming
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModRenaming -> ModRenaming -> Bool
$c/= :: ModRenaming -> ModRenaming -> Bool
== :: ModRenaming -> ModRenaming -> Bool
$c== :: ModRenaming -> ModRenaming -> Bool
Eq)
instance Outputable ModRenaming where
    ppr :: ModRenaming -> SDoc
ppr (ModRenaming Bool
b [(ModuleName, ModuleName)]
rns) = Bool -> SDoc
forall a. Outputable a => a -> SDoc
ppr Bool
b SDoc -> SDoc -> SDoc
<+> SDoc -> SDoc
parens ([(ModuleName, ModuleName)] -> SDoc
forall a. Outputable a => a -> SDoc
ppr [(ModuleName, ModuleName)]
rns)

-- | Flags for manipulating the set of non-broken packages.
newtype IgnorePackageFlag = IgnorePackage String -- ^ @-ignore-package@
  deriving (IgnorePackageFlag -> IgnorePackageFlag -> Bool
(IgnorePackageFlag -> IgnorePackageFlag -> Bool)
-> (IgnorePackageFlag -> IgnorePackageFlag -> Bool)
-> Eq IgnorePackageFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IgnorePackageFlag -> IgnorePackageFlag -> Bool
$c/= :: IgnorePackageFlag -> IgnorePackageFlag -> Bool
== :: IgnorePackageFlag -> IgnorePackageFlag -> Bool
$c== :: IgnorePackageFlag -> IgnorePackageFlag -> Bool
Eq)

-- | Flags for manipulating package trust.
data TrustFlag
  = TrustPackage    String -- ^ @-trust@
  | DistrustPackage String -- ^ @-distrust@
  deriving (TrustFlag -> TrustFlag -> Bool
(TrustFlag -> TrustFlag -> Bool)
-> (TrustFlag -> TrustFlag -> Bool) -> Eq TrustFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrustFlag -> TrustFlag -> Bool
$c/= :: TrustFlag -> TrustFlag -> Bool
== :: TrustFlag -> TrustFlag -> Bool
$c== :: TrustFlag -> TrustFlag -> Bool
Eq)

-- | Flags for manipulating packages visibility.
data PackageFlag
  = ExposePackage   String PackageArg ModRenaming -- ^ @-package@, @-package-id@
  | HidePackage     String -- ^ @-hide-package@
  deriving (PackageFlag -> PackageFlag -> Bool
(PackageFlag -> PackageFlag -> Bool)
-> (PackageFlag -> PackageFlag -> Bool) -> Eq PackageFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageFlag -> PackageFlag -> Bool
$c/= :: PackageFlag -> PackageFlag -> Bool
== :: PackageFlag -> PackageFlag -> Bool
$c== :: PackageFlag -> PackageFlag -> Bool
Eq) -- NB: equality instance is used by packageFlagsChanged

data PackageDBFlag
  = PackageDB PkgDbRef
  | NoUserPackageDB
  | NoGlobalPackageDB
  | ClearPackageDBs
  deriving (PackageDBFlag -> PackageDBFlag -> Bool
(PackageDBFlag -> PackageDBFlag -> Bool)
-> (PackageDBFlag -> PackageDBFlag -> Bool) -> Eq PackageDBFlag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PackageDBFlag -> PackageDBFlag -> Bool
$c/= :: PackageDBFlag -> PackageDBFlag -> Bool
== :: PackageDBFlag -> PackageDBFlag -> Bool
$c== :: PackageDBFlag -> PackageDBFlag -> Bool
Eq)

packageFlagsChanged :: DynFlags -> DynFlags -> Bool
packageFlagsChanged :: DynFlags -> DynFlags -> Bool
packageFlagsChanged DynFlags
idflags1 DynFlags
idflags0 =
  DynFlags -> [PackageFlag]
packageFlags DynFlags
idflags1 [PackageFlag] -> [PackageFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [PackageFlag]
packageFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
  DynFlags -> [IgnorePackageFlag]
ignorePackageFlags DynFlags
idflags1 [IgnorePackageFlag] -> [IgnorePackageFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [IgnorePackageFlag]
ignorePackageFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
  DynFlags -> [PackageFlag]
pluginPackageFlags DynFlags
idflags1 [PackageFlag] -> [PackageFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [PackageFlag]
pluginPackageFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
  DynFlags -> [TrustFlag]
trustFlags DynFlags
idflags1 [TrustFlag] -> [TrustFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [TrustFlag]
trustFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
  DynFlags -> [PackageDBFlag]
packageDBFlags DynFlags
idflags1 [PackageDBFlag] -> [PackageDBFlag] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [PackageDBFlag]
packageDBFlags DynFlags
idflags0 Bool -> Bool -> Bool
||
  DynFlags -> [Bool]
packageGFlags DynFlags
idflags1 [Bool] -> [Bool] -> Bool
forall a. Eq a => a -> a -> Bool
/= DynFlags -> [Bool]
packageGFlags DynFlags
idflags0
 where
   packageGFlags :: DynFlags -> [Bool]
packageGFlags DynFlags
dflags = (GeneralFlag -> Bool) -> [GeneralFlag] -> [Bool]
forall a b. (a -> b) -> [a] -> [b]
map (GeneralFlag -> DynFlags -> Bool
`gopt` DynFlags
dflags)
     [ GeneralFlag
Opt_HideAllPackages
     , GeneralFlag
Opt_HideAllPluginPackages
     , GeneralFlag
Opt_AutoLinkPackages ]

instance Outputable PackageFlag where
    ppr :: PackageFlag -> SDoc
ppr (ExposePackage [Char]
n PackageArg
arg ModRenaming
rn) = [Char] -> SDoc
text [Char]
n SDoc -> SDoc -> SDoc
<> SDoc -> SDoc
braces (PackageArg -> SDoc
forall a. Outputable a => a -> SDoc
ppr PackageArg
arg SDoc -> SDoc -> SDoc
<+> ModRenaming -> SDoc
forall a. Outputable a => a -> SDoc
ppr ModRenaming
rn)
    ppr (HidePackage [Char]
str) = [Char] -> SDoc
text [Char]
"-hide-package" SDoc -> SDoc -> SDoc
<+> [Char] -> SDoc
text [Char]
str

data DynLibLoader
  = Deployable
  | SystemDependent
  deriving DynLibLoader -> DynLibLoader -> Bool
(DynLibLoader -> DynLibLoader -> Bool)
-> (DynLibLoader -> DynLibLoader -> Bool) -> Eq DynLibLoader
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DynLibLoader -> DynLibLoader -> Bool
$c/= :: DynLibLoader -> DynLibLoader -> Bool
== :: DynLibLoader -> DynLibLoader -> Bool
$c== :: DynLibLoader -> DynLibLoader -> Bool
Eq

data RtsOptsEnabled
  = RtsOptsNone | RtsOptsIgnore | RtsOptsIgnoreAll | RtsOptsSafeOnly
  | RtsOptsAll
  deriving (Int -> RtsOptsEnabled -> ShowS
[RtsOptsEnabled] -> ShowS
RtsOptsEnabled -> [Char]
(Int -> RtsOptsEnabled -> ShowS)
-> (RtsOptsEnabled -> [Char])
-> ([RtsOptsEnabled] -> ShowS)
-> Show RtsOptsEnabled
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
showList :: [RtsOptsEnabled] -> ShowS
$cshowList :: [RtsOptsEnabled] -> ShowS
show :: RtsOptsEnabled -> [Char]
$cshow :: RtsOptsEnabled -> [Char]
showsPrec :: Int -> RtsOptsEnabled -> ShowS
$cshowsPrec :: Int -> RtsOptsEnabled -> ShowS
Show)

-- | Are we building with @-fPIE@ or @-fPIC@ enabled?
positionIndependent :: DynFlags -> Bool
positionIndependent :: DynFlags -> Bool
positionIndependent DynFlags
dflags = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIC DynFlags
dflags Bool -> Bool -> Bool
|| GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIE DynFlags
dflags

-- Note [-dynamic-too business]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
-- With -dynamic-too flag, we try to build both the non-dynamic and dynamic
-- objects in a single run of the compiler: the pipeline is the same down to
-- Core optimisation, then the backend (from Core to object code) is executed
-- twice.
--
-- The implementation is currently rather hacky: recompilation avoidance is
-- broken (#17968), we don't clearly separate non-dynamic and dynamic loaded
-- interfaces (#9176), etc.
--
-- To make matters worse, we automatically enable -dynamic-too when some modules
-- need Template-Haskell and GHC is dynamically linked (cf
-- GHC.Driver.Pipeline.compileOne').
--
-- This somewhat explains why we have "dynamicTooFailed :: IORef Bool" in
-- DynFlags: when -dynamic-too is enabled, we try to build the dynamic objects,
-- but we may fail and we shouldn't abort the whole compilation because the user
-- may not even have asked for -dynamic-too in the first place. So instead we
-- use this global variable to indicate that we can't build dynamic objects and
-- compilation continues to build non-dynamic objects only. At the end of the
-- non-dynamic pipeline, if this value indicates that the dynamic compilation
-- failed, we run the whole pipeline again for the dynamic way (except on
-- Windows...). See GHC.Driver.Pipeline.runPipeline.

data DynamicTooState
   = DT_Dont    -- ^ Don't try to build dynamic objects too
   | DT_Failed  -- ^ Won't try to generate dynamic objects for some reason
   | DT_OK      -- ^ Will still try to generate dynamic objects
   | DT_Dyn     -- ^ Currently generating dynamic objects (in the backend)
   deriving (DynamicTooState -> DynamicTooState -> Bool
(DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> Eq DynamicTooState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DynamicTooState -> DynamicTooState -> Bool
$c/= :: DynamicTooState -> DynamicTooState -> Bool
== :: DynamicTooState -> DynamicTooState -> Bool
$c== :: DynamicTooState -> DynamicTooState -> Bool
Eq,Int -> DynamicTooState -> ShowS
[DynamicTooState] -> ShowS
DynamicTooState -> [Char]
(Int -> DynamicTooState -> ShowS)
-> (DynamicTooState -> [Char])
-> ([DynamicTooState] -> ShowS)
-> Show DynamicTooState
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
showList :: [DynamicTooState] -> ShowS
$cshowList :: [DynamicTooState] -> ShowS
show :: DynamicTooState -> [Char]
$cshow :: DynamicTooState -> [Char]
showsPrec :: Int -> DynamicTooState -> ShowS
$cshowsPrec :: Int -> DynamicTooState -> ShowS
Show,Eq DynamicTooState
Eq DynamicTooState
-> (DynamicTooState -> DynamicTooState -> Ordering)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> Bool)
-> (DynamicTooState -> DynamicTooState -> DynamicTooState)
-> (DynamicTooState -> DynamicTooState -> DynamicTooState)
-> Ord DynamicTooState
DynamicTooState -> DynamicTooState -> Bool
DynamicTooState -> DynamicTooState -> Ordering
DynamicTooState -> DynamicTooState -> DynamicTooState
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: DynamicTooState -> DynamicTooState -> DynamicTooState
$cmin :: DynamicTooState -> DynamicTooState -> DynamicTooState
max :: DynamicTooState -> DynamicTooState -> DynamicTooState
$cmax :: DynamicTooState -> DynamicTooState -> DynamicTooState
>= :: DynamicTooState -> DynamicTooState -> Bool
$c>= :: DynamicTooState -> DynamicTooState -> Bool
> :: DynamicTooState -> DynamicTooState -> Bool
$c> :: DynamicTooState -> DynamicTooState -> Bool
<= :: DynamicTooState -> DynamicTooState -> Bool
$c<= :: DynamicTooState -> DynamicTooState -> Bool
< :: DynamicTooState -> DynamicTooState -> Bool
$c< :: DynamicTooState -> DynamicTooState -> Bool
compare :: DynamicTooState -> DynamicTooState -> Ordering
$ccompare :: DynamicTooState -> DynamicTooState -> Ordering
Ord)

dynamicTooState :: MonadIO m => DynFlags -> m DynamicTooState
dynamicTooState :: forall (m :: * -> *). MonadIO m => DynFlags -> m DynamicTooState
dynamicTooState DynFlags
dflags
   | Bool -> Bool
not (GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_BuildDynamicToo DynFlags
dflags) = DynamicTooState -> m DynamicTooState
forall (m :: * -> *) a. Monad m => a -> m a
return DynamicTooState
DT_Dont
   | Bool
otherwise = do
      Bool
failed <- IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ IORef Bool -> IO Bool
forall a. IORef a -> IO a
readIORef (DynFlags -> IORef Bool
dynamicTooFailed DynFlags
dflags)
      if Bool
failed
         then DynamicTooState -> m DynamicTooState
forall (m :: * -> *) a. Monad m => a -> m a
return DynamicTooState
DT_Failed
         else if DynFlags -> Bool
dynamicNow DynFlags
dflags
               then DynamicTooState -> m DynamicTooState
forall (m :: * -> *) a. Monad m => a -> m a
return DynamicTooState
DT_Dyn
               else DynamicTooState -> m DynamicTooState
forall (m :: * -> *) a. Monad m => a -> m a
return DynamicTooState
DT_OK

setDynamicNow :: DynFlags -> DynFlags
setDynamicNow :: DynFlags -> DynFlags
setDynamicNow DynFlags
dflags0 =
   DynFlags
dflags0
      { dynamicNow :: Bool
dynamicNow = Bool
True
      }

setDynamicTooFailed :: MonadIO m => DynFlags -> m ()
setDynamicTooFailed :: forall (m :: * -> *). MonadIO m => DynFlags -> m ()
setDynamicTooFailed DynFlags
dflags =
   IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ IORef Bool -> Bool -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef (DynFlags -> IORef Bool
dynamicTooFailed DynFlags
dflags) Bool
True

-- | Compute the path of the dynamic object corresponding to an object file.
dynamicOutputFile :: DynFlags -> FilePath -> FilePath
dynamicOutputFile :: DynFlags -> ShowS
dynamicOutputFile DynFlags
dflags [Char]
outputFile = ShowS
dynOut [Char]
outputFile
  where
    dynOut :: ShowS
dynOut = ([Char] -> ShowS) -> [Char] -> ShowS
forall a b c. (a -> b -> c) -> b -> a -> c
flip [Char] -> ShowS
addExtension (DynFlags -> [Char]
dynObjectSuf_ DynFlags
dflags) ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShowS
dropExtension

-----------------------------------------------------------------------------

-- | Used by 'GHC.runGhc' to partially initialize a new 'DynFlags' value
initDynFlags :: DynFlags -> IO DynFlags
initDynFlags :: DynFlags -> IO DynFlags
initDynFlags DynFlags
dflags = do
 let -- We can't build with dynamic-too on Windows, as labels before
     -- the fork point are different depending on whether we are
     -- building dynamically or not.
     platformCanGenerateDynamicToo :: Bool
platformCanGenerateDynamicToo
         = Platform -> OS
platformOS (DynFlags -> Platform
targetPlatform DynFlags
dflags) OS -> OS -> Bool
forall a. Eq a => a -> a -> Bool
/= OS
OSMinGW32
 IORef Bool
refDynamicTooFailed <- Bool -> IO (IORef Bool)
forall a. a -> IO (IORef a)
newIORef (Bool -> Bool
not Bool
platformCanGenerateDynamicToo)
 IORef (Maybe LinkerInfo)
refRtldInfo <- Maybe LinkerInfo -> IO (IORef (Maybe LinkerInfo))
forall a. a -> IO (IORef a)
newIORef Maybe LinkerInfo
forall a. Maybe a
Nothing
 IORef (Maybe CompilerInfo)
refRtccInfo <- Maybe CompilerInfo -> IO (IORef (Maybe CompilerInfo))
forall a. a -> IO (IORef a)
newIORef Maybe CompilerInfo
forall a. Maybe a
Nothing
 IORef (ModuleEnv Int)
wrapperNum <- ModuleEnv Int -> IO (IORef (ModuleEnv Int))
forall a. a -> IO (IORef a)
newIORef ModuleEnv Int
forall a. ModuleEnv a
emptyModuleEnv
 Bool
canUseUnicode <- do let enc :: TextEncoding
enc = TextEncoding
localeEncoding
                         str :: [Char]
str = [Char]
"‘’"
                     (TextEncoding -> [Char] -> (CString -> IO Bool) -> IO Bool
forall a. TextEncoding -> [Char] -> (CString -> IO a) -> IO a
withCString TextEncoding
enc [Char]
str ((CString -> IO Bool) -> IO Bool)
-> (CString -> IO Bool) -> IO Bool
forall a b. (a -> b) -> a -> b
$ \CString
cstr ->
                          do [Char]
str' <- TextEncoding -> CString -> IO [Char]
peekCString TextEncoding
enc CString
cstr
                             Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return ([Char]
str [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
str'))
                         IO Bool -> (IOError -> IO Bool) -> IO Bool
forall a. IO a -> (IOError -> IO a) -> IO a
`catchIOError` \IOError
_ -> Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
False
 Maybe [Char]
ghcNoUnicodeEnv <- [Char] -> IO (Maybe [Char])
lookupEnv [Char]
"GHC_NO_UNICODE"
 let useUnicode' :: Bool
useUnicode' = Maybe [Char] -> Bool
forall a. Maybe a -> Bool
isNothing Maybe [Char]
ghcNoUnicodeEnv Bool -> Bool -> Bool
&& Bool
canUseUnicode
 Maybe [Char]
maybeGhcColorsEnv  <- [Char] -> IO (Maybe [Char])
lookupEnv [Char]
"GHC_COLORS"
 Maybe [Char]
maybeGhcColoursEnv <- [Char] -> IO (Maybe [Char])
lookupEnv [Char]
"GHC_COLOURS"
 let adjustCols :: Maybe [Char]
-> (OverridingBool, Scheme) -> (OverridingBool, Scheme)
adjustCols (Just [Char]
env) = [Char] -> (OverridingBool, Scheme) -> (OverridingBool, Scheme)
Col.parseScheme [Char]
env
     adjustCols Maybe [Char]
Nothing    = (OverridingBool, Scheme) -> (OverridingBool, Scheme)
forall a. a -> a
id
 let (OverridingBool
useColor', Scheme
colScheme') =
       (Maybe [Char]
-> (OverridingBool, Scheme) -> (OverridingBool, Scheme)
adjustCols Maybe [Char]
maybeGhcColoursEnv ((OverridingBool, Scheme) -> (OverridingBool, Scheme))
-> ((OverridingBool, Scheme) -> (OverridingBool, Scheme))
-> (OverridingBool, Scheme)
-> (OverridingBool, Scheme)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe [Char]
-> (OverridingBool, Scheme) -> (OverridingBool, Scheme)
adjustCols Maybe [Char]
maybeGhcColorsEnv)
       (DynFlags -> OverridingBool
useColor DynFlags
dflags, DynFlags -> Scheme
colScheme DynFlags
dflags)
 DynFlags -> IO DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return DynFlags
dflags{
        dynamicTooFailed :: IORef Bool
dynamicTooFailed = IORef Bool
refDynamicTooFailed,
        nextWrapperNum :: IORef (ModuleEnv Int)
nextWrapperNum = IORef (ModuleEnv Int)
wrapperNum,
        useUnicode :: Bool
useUnicode    = Bool
useUnicode',
        useColor :: OverridingBool
useColor      = OverridingBool
useColor',
        canUseColor :: Bool
canUseColor   = Bool
stderrSupportsAnsiColors,
        colScheme :: Scheme
colScheme     = Scheme
colScheme',
        rtldInfo :: IORef (Maybe LinkerInfo)
rtldInfo      = IORef (Maybe LinkerInfo)
refRtldInfo,
        rtccInfo :: IORef (Maybe CompilerInfo)
rtccInfo      = IORef (Maybe CompilerInfo)
refRtccInfo
        }

-- | The normal 'DynFlags'. Note that they are not suitable for use in this form
-- and must be fully initialized by 'GHC.runGhc' first.
defaultDynFlags :: Settings -> LlvmConfig -> DynFlags
defaultDynFlags :: Settings -> LlvmConfig -> DynFlags
defaultDynFlags Settings
mySettings LlvmConfig
llvmConfig =
-- See Note [Updating flag description in the User's Guide]
     DynFlags {
        ghcMode :: GhcMode
ghcMode                 = GhcMode
CompManager,
        ghcLink :: GhcLink
ghcLink                 = GhcLink
LinkBinary,
        backend :: Backend
backend                 = Platform -> Backend
platformDefaultBackend (Settings -> Platform
sTargetPlatform Settings
mySettings),
        verbosity :: Int
verbosity               = Int
0,
        optLevel :: Int
optLevel                = Int
0,
        debugLevel :: Int
debugLevel              = Int
0,
        simplPhases :: Int
simplPhases             = Int
2,
        maxSimplIterations :: Int
maxSimplIterations      = Int
4,
        ruleCheck :: Maybe [Char]
ruleCheck               = Maybe [Char]
forall a. Maybe a
Nothing,
        inlineCheck :: Maybe [Char]
inlineCheck             = Maybe [Char]
forall a. Maybe a
Nothing,
        binBlobThreshold :: Word
binBlobThreshold        = Word
500000, -- 500K is a good default (see #16190)
        maxRelevantBinds :: Maybe Int
maxRelevantBinds        = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
6,
        maxValidHoleFits :: Maybe Int
maxValidHoleFits   = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
6,
        maxRefHoleFits :: Maybe Int
maxRefHoleFits     = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
6,
        refLevelHoleFits :: Maybe Int
refLevelHoleFits   = Maybe Int
forall a. Maybe a
Nothing,
        maxUncoveredPatterns :: Int
maxUncoveredPatterns    = Int
4,
        maxPmCheckModels :: Int
maxPmCheckModels        = Int
30,
        simplTickFactor :: Int
simplTickFactor         = Int
100,
        specConstrThreshold :: Maybe Int
specConstrThreshold     = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
2000,
        specConstrCount :: Maybe Int
specConstrCount         = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
3,
        specConstrRecursive :: Int
specConstrRecursive     = Int
3,
        liberateCaseThreshold :: Maybe Int
liberateCaseThreshold   = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
2000,
        floatLamArgs :: Maybe Int
floatLamArgs            = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
0, -- Default: float only if no fvs
        liftLamsRecArgs :: Maybe Int
liftLamsRecArgs         = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
5, -- Default: the number of available argument hardware registers on x86_64
        liftLamsNonRecArgs :: Maybe Int
liftLamsNonRecArgs      = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
5, -- Default: the number of available argument hardware registers on x86_64
        liftLamsKnown :: Bool
liftLamsKnown           = Bool
False,  -- Default: don't turn known calls into unknown ones
        cmmProcAlignment :: Maybe Int
cmmProcAlignment        = Maybe Int
forall a. Maybe a
Nothing,

        historySize :: Int
historySize             = Int
20,
        strictnessBefore :: [Int]
strictnessBefore        = [],

        parMakeCount :: Maybe Int
parMakeCount            = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
1,

        enableTimeStats :: Bool
enableTimeStats         = Bool
False,
        ghcHeapSize :: Maybe Int
ghcHeapSize             = Maybe Int
forall a. Maybe a
Nothing,

        importPaths :: [[Char]]
importPaths             = [[Char]
"."],
        mainModuleNameIs :: ModuleName
mainModuleNameIs        = ModuleName
mAIN_NAME,
        mainFunIs :: Maybe [Char]
mainFunIs               = Maybe [Char]
forall a. Maybe a
Nothing,
        reductionDepth :: IntWithInf
reductionDepth          = Int -> IntWithInf
treatZeroAsInf Int
mAX_REDUCTION_DEPTH,
        solverIterations :: IntWithInf
solverIterations        = Int -> IntWithInf
treatZeroAsInf Int
mAX_SOLVER_ITERATIONS,

        homeUnitId_ :: UnitId
homeUnitId_             = UnitId
mainUnitId,
        homeUnitInstanceOf_ :: Maybe UnitId
homeUnitInstanceOf_     = Maybe UnitId
forall a. Maybe a
Nothing,
        homeUnitInstantiations_ :: [(ModuleName, Module)]
homeUnitInstantiations_ = [],

        objectDir :: Maybe [Char]
objectDir               = Maybe [Char]
forall a. Maybe a
Nothing,
        dylibInstallName :: Maybe [Char]
dylibInstallName        = Maybe [Char]
forall a. Maybe a
Nothing,
        hiDir :: Maybe [Char]
hiDir                   = Maybe [Char]
forall a. Maybe a
Nothing,
        hieDir :: Maybe [Char]
hieDir                  = Maybe [Char]
forall a. Maybe a
Nothing,
        stubDir :: Maybe [Char]
stubDir                 = Maybe [Char]
forall a. Maybe a
Nothing,
        dumpDir :: Maybe [Char]
dumpDir                 = Maybe [Char]
forall a. Maybe a
Nothing,

        objectSuf_ :: [Char]
objectSuf_              = Phase -> [Char]
phaseInputExt Phase
StopLn,
        hcSuf :: [Char]
hcSuf                   = Phase -> [Char]
phaseInputExt Phase
HCc,
        hiSuf_ :: [Char]
hiSuf_                  = [Char]
"hi",
        hieSuf :: [Char]
hieSuf                  = [Char]
"hie",

        dynamicTooFailed :: IORef Bool
dynamicTooFailed        = [Char] -> IORef Bool
forall a. [Char] -> a
panic [Char]
"defaultDynFlags: No dynamicTooFailed",
        dynObjectSuf_ :: [Char]
dynObjectSuf_           = [Char]
"dyn_" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ Phase -> [Char]
phaseInputExt Phase
StopLn,
        dynHiSuf_ :: [Char]
dynHiSuf_               = [Char]
"dyn_hi",
        dynamicNow :: Bool
dynamicNow              = Bool
False,

        pluginModNames :: [ModuleName]
pluginModNames          = [],
        pluginModNameOpts :: [(ModuleName, [Char])]
pluginModNameOpts       = [],
        frontendPluginOpts :: [[Char]]
frontendPluginOpts      = [],

        outputFile_ :: Maybe [Char]
outputFile_             = Maybe [Char]
forall a. Maybe a
Nothing,
        dynOutputFile_ :: Maybe [Char]
dynOutputFile_          = Maybe [Char]
forall a. Maybe a
Nothing,
        outputHi :: Maybe [Char]
outputHi                = Maybe [Char]
forall a. Maybe a
Nothing,
        dynLibLoader :: DynLibLoader
dynLibLoader            = DynLibLoader
SystemDependent,
        dumpPrefix :: Maybe [Char]
dumpPrefix              = Maybe [Char]
forall a. Maybe a
Nothing,
        dumpPrefixForce :: Maybe [Char]
dumpPrefixForce         = Maybe [Char]
forall a. Maybe a
Nothing,
        ldInputs :: [Option]
ldInputs                = [],
        includePaths :: IncludeSpecs
includePaths            = [[Char]] -> [[Char]] -> [[Char]] -> IncludeSpecs
IncludeSpecs [] [] [],
        libraryPaths :: [[Char]]
libraryPaths            = [],
        frameworkPaths :: [[Char]]
frameworkPaths          = [],
        cmdlineFrameworks :: [[Char]]
cmdlineFrameworks       = [],
        rtsOpts :: Maybe [Char]
rtsOpts                 = Maybe [Char]
forall a. Maybe a
Nothing,
        rtsOptsEnabled :: RtsOptsEnabled
rtsOptsEnabled          = RtsOptsEnabled
RtsOptsSafeOnly,
        rtsOptsSuggestions :: Bool
rtsOptsSuggestions      = Bool
True,

        hpcDir :: [Char]
hpcDir                  = [Char]
".hpc",

        packageDBFlags :: [PackageDBFlag]
packageDBFlags          = [],
        packageFlags :: [PackageFlag]
packageFlags            = [],
        pluginPackageFlags :: [PackageFlag]
pluginPackageFlags      = [],
        ignorePackageFlags :: [IgnorePackageFlag]
ignorePackageFlags      = [],
        trustFlags :: [TrustFlag]
trustFlags              = [],
        packageEnv :: Maybe [Char]
packageEnv              = Maybe [Char]
forall a. Maybe a
Nothing,
        targetWays_ :: Ways
targetWays_             = Ways
forall a. Set a
Set.empty,
        splitInfo :: Maybe ([Char], Int)
splitInfo               = Maybe ([Char], Int)
forall a. Maybe a
Nothing,

        ghcNameVersion :: GhcNameVersion
ghcNameVersion = Settings -> GhcNameVersion
sGhcNameVersion Settings
mySettings,
        fileSettings :: FileSettings
fileSettings = Settings -> FileSettings
sFileSettings Settings
mySettings,
        toolSettings :: ToolSettings
toolSettings = Settings -> ToolSettings
sToolSettings Settings
mySettings,
        targetPlatform :: Platform
targetPlatform = Settings -> Platform
sTargetPlatform Settings
mySettings,
        platformMisc :: PlatformMisc
platformMisc = Settings -> PlatformMisc
sPlatformMisc Settings
mySettings,
        rawSettings :: [([Char], [Char])]
rawSettings = Settings -> [([Char], [Char])]
sRawSettings Settings
mySettings,

        -- See Note [LLVM configuration].
        llvmConfig :: LlvmConfig
llvmConfig              = LlvmConfig
llvmConfig,

        -- ghc -M values
        depMakefile :: [Char]
depMakefile       = [Char]
"Makefile",
        depIncludePkgDeps :: Bool
depIncludePkgDeps = Bool
False,
        depIncludeCppDeps :: Bool
depIncludeCppDeps = Bool
False,
        depExcludeMods :: [ModuleName]
depExcludeMods    = [],
        depSuffixes :: [[Char]]
depSuffixes       = [],
        -- end of ghc -M values
        ghcVersionFile :: Maybe [Char]
ghcVersionFile = Maybe [Char]
forall a. Maybe a
Nothing,
        haddockOptions :: Maybe [Char]
haddockOptions = Maybe [Char]
forall a. Maybe a
Nothing,
        dumpFlags :: EnumSet DumpFlag
dumpFlags = EnumSet DumpFlag
forall a. EnumSet a
EnumSet.empty,
        generalFlags :: EnumSet GeneralFlag
generalFlags = [GeneralFlag] -> EnumSet GeneralFlag
forall a. Enum a => [a] -> EnumSet a
EnumSet.fromList (Settings -> [GeneralFlag]
defaultFlags Settings
mySettings),
        warningFlags :: EnumSet WarningFlag
warningFlags = [WarningFlag] -> EnumSet WarningFlag
forall a. Enum a => [a] -> EnumSet a
EnumSet.fromList [WarningFlag]
standardWarnings,
        fatalWarningFlags :: EnumSet WarningFlag
fatalWarningFlags = EnumSet WarningFlag
forall a. EnumSet a
EnumSet.empty,
        ghciScripts :: [[Char]]
ghciScripts = [],
        language :: Maybe Language
language = Maybe Language
forall a. Maybe a
Nothing,
        safeHaskell :: SafeHaskellMode
safeHaskell = SafeHaskellMode
Sf_None,
        safeInfer :: Bool
safeInfer   = Bool
True,
        safeInferred :: Bool
safeInferred = Bool
True,
        thOnLoc :: SrcSpan
thOnLoc = SrcSpan
noSrcSpan,
        newDerivOnLoc :: SrcSpan
newDerivOnLoc = SrcSpan
noSrcSpan,
        deriveViaOnLoc :: SrcSpan
deriveViaOnLoc = SrcSpan
noSrcSpan,
        overlapInstLoc :: SrcSpan
overlapInstLoc = SrcSpan
noSrcSpan,
        incoherentOnLoc :: SrcSpan
incoherentOnLoc = SrcSpan
noSrcSpan,
        pkgTrustOnLoc :: SrcSpan
pkgTrustOnLoc = SrcSpan
noSrcSpan,
        warnSafeOnLoc :: SrcSpan
warnSafeOnLoc = SrcSpan
noSrcSpan,
        warnUnsafeOnLoc :: SrcSpan
warnUnsafeOnLoc = SrcSpan
noSrcSpan,
        trustworthyOnLoc :: SrcSpan
trustworthyOnLoc = SrcSpan
noSrcSpan,
        extensions :: [OnOff Extension]
extensions = [],
        extensionFlags :: EnumSet Extension
extensionFlags = Maybe Language -> [OnOff Extension] -> EnumSet Extension
flattenExtensionFlags Maybe Language
forall a. Maybe a
Nothing [],

        unfoldingOpts :: UnfoldingOpts
unfoldingOpts = UnfoldingOpts
defaultUnfoldingOpts,
        maxWorkerArgs :: Int
maxWorkerArgs = Int
10,

        ghciHistSize :: Int
ghciHistSize = Int
50, -- keep a log of length 50 by default

        flushOut :: FlushOut
flushOut = FlushOut
defaultFlushOut,
        flushErr :: FlushErr
flushErr = FlushErr
defaultFlushErr,
        pprUserLength :: Int
pprUserLength = Int
5,
        pprCols :: Int
pprCols = Int
100,
        useUnicode :: Bool
useUnicode = Bool
False,
        useColor :: OverridingBool
useColor = OverridingBool
Auto,
        canUseColor :: Bool
canUseColor = Bool
False,
        colScheme :: Scheme
colScheme = Scheme
Col.defaultScheme,
        profAuto :: ProfAuto
profAuto = ProfAuto
NoProfAuto,
        callerCcFilters :: [CallerCcFilter]
callerCcFilters = [],
        interactivePrint :: Maybe [Char]
interactivePrint = Maybe [Char]
forall a. Maybe a
Nothing,
        nextWrapperNum :: IORef (ModuleEnv Int)
nextWrapperNum = [Char] -> IORef (ModuleEnv Int)
forall a. [Char] -> a
panic [Char]
"defaultDynFlags: No nextWrapperNum",
        sseVersion :: Maybe SseVersion
sseVersion = Maybe SseVersion
forall a. Maybe a
Nothing,
        bmiVersion :: Maybe BmiVersion
bmiVersion = Maybe BmiVersion
forall a. Maybe a
Nothing,
        avx :: Bool
avx = Bool
False,
        avx2 :: Bool
avx2 = Bool
False,
        avx512cd :: Bool
avx512cd = Bool
False,
        avx512er :: Bool
avx512er = Bool
False,
        avx512f :: Bool
avx512f = Bool
False,
        avx512pf :: Bool
avx512pf = Bool
False,
        rtldInfo :: IORef (Maybe LinkerInfo)
rtldInfo = [Char] -> IORef (Maybe LinkerInfo)
forall a. [Char] -> a
panic [Char]
"defaultDynFlags: no rtldInfo",
        rtccInfo :: IORef (Maybe CompilerInfo)
rtccInfo = [Char] -> IORef (Maybe CompilerInfo)
forall a. [Char] -> a
panic [Char]
"defaultDynFlags: no rtccInfo",

        maxInlineAllocSize :: Int
maxInlineAllocSize = Int
128,
        maxInlineMemcpyInsns :: Int
maxInlineMemcpyInsns = Int
32,
        maxInlineMemsetInsns :: Int
maxInlineMemsetInsns = Int
32,

        initialUnique :: Word
initialUnique = Word
0,
        uniqueIncrement :: Int
uniqueIncrement = Int
1,

        reverseErrors :: Bool
reverseErrors = Bool
False,
        maxErrors :: Maybe Int
maxErrors     = Maybe Int
forall a. Maybe a
Nothing,
        cfgWeights :: Weights
cfgWeights    = Weights
defaultWeights
      }

type FatalMessager = String -> IO ()

defaultFatalMessager :: FatalMessager
defaultFatalMessager :: FatalMessager
defaultFatalMessager = Handle -> FatalMessager
hPutStrLn Handle
stderr


newtype FlushOut = FlushOut (IO ())

defaultFlushOut :: FlushOut
defaultFlushOut :: FlushOut
defaultFlushOut = IO () -> FlushOut
FlushOut (IO () -> FlushOut) -> IO () -> FlushOut
forall a b. (a -> b) -> a -> b
$ Handle -> IO ()
hFlush Handle
stdout

newtype FlushErr = FlushErr (IO ())

defaultFlushErr :: FlushErr
defaultFlushErr :: FlushErr
defaultFlushErr = IO () -> FlushErr
FlushErr (IO () -> FlushErr) -> IO () -> FlushErr
forall a b. (a -> b) -> a -> b
$ Handle -> IO ()
hFlush Handle
stderr

{-
Note [Verbosity levels]
~~~~~~~~~~~~~~~~~~~~~~~
    0   |   print errors & warnings only
    1   |   minimal verbosity: print "compiling M ... done." for each module.
    2   |   equivalent to -dshow-passes
    3   |   equivalent to existing "ghc -v"
    4   |   "ghc -v -ddump-most"
    5   |   "ghc -v -ddump-all"
-}

data OnOff a = On a
             | Off a
  deriving (OnOff a -> OnOff a -> Bool
(OnOff a -> OnOff a -> Bool)
-> (OnOff a -> OnOff a -> Bool) -> Eq (OnOff a)
forall a. Eq a => OnOff a -> OnOff a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OnOff a -> OnOff a -> Bool
$c/= :: forall a. Eq a => OnOff a -> OnOff a -> Bool
== :: OnOff a -> OnOff a -> Bool
$c== :: forall a. Eq a => OnOff a -> OnOff a -> Bool
Eq, Int -> OnOff a -> ShowS
[OnOff a] -> ShowS
OnOff a -> [Char]
(Int -> OnOff a -> ShowS)
-> (OnOff a -> [Char]) -> ([OnOff a] -> ShowS) -> Show (OnOff a)
forall a. Show a => Int -> OnOff a -> ShowS
forall a. Show a => [OnOff a] -> ShowS
forall a. Show a => OnOff a -> [Char]
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
showList :: [OnOff a] -> ShowS
$cshowList :: forall a. Show a => [OnOff a] -> ShowS
show :: OnOff a -> [Char]
$cshow :: forall a. Show a => OnOff a -> [Char]
showsPrec :: Int -> OnOff a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> OnOff a -> ShowS
Show)

instance Outputable a => Outputable (OnOff a) where
  ppr :: OnOff a -> SDoc
ppr (On a
x)  = [Char] -> SDoc
text [Char]
"On" SDoc -> SDoc -> SDoc
<+> a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
x
  ppr (Off a
x) = [Char] -> SDoc
text [Char]
"Off" SDoc -> SDoc -> SDoc
<+> a -> SDoc
forall a. Outputable a => a -> SDoc
ppr a
x

-- OnOffs accumulate in reverse order, so we use foldr in order to
-- process them in the right order
flattenExtensionFlags :: Maybe Language -> [OnOff LangExt.Extension] -> EnumSet LangExt.Extension
flattenExtensionFlags :: Maybe Language -> [OnOff Extension] -> EnumSet Extension
flattenExtensionFlags Maybe Language
ml = (OnOff Extension -> EnumSet Extension -> EnumSet Extension)
-> EnumSet Extension -> [OnOff Extension] -> EnumSet Extension
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr OnOff Extension -> EnumSet Extension -> EnumSet Extension
forall {a}. Enum a => OnOff a -> EnumSet a -> EnumSet a
f EnumSet Extension
defaultExtensionFlags
    where f :: OnOff a -> EnumSet a -> EnumSet a
f (On a
f)  EnumSet a
flags = a -> EnumSet a -> EnumSet a
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.insert a
f EnumSet a
flags
          f (Off a
f) EnumSet a
flags = a -> EnumSet a -> EnumSet a
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.delete a
f EnumSet a
flags
          defaultExtensionFlags :: EnumSet Extension
defaultExtensionFlags = [Extension] -> EnumSet Extension
forall a. Enum a => [a] -> EnumSet a
EnumSet.fromList (Maybe Language -> [Extension]
languageExtensions Maybe Language
ml)

-- | The language extensions implied by the various language variants.
-- When updating this be sure to update the flag documentation in
-- @docs/users_guide/exts@.
languageExtensions :: Maybe Language -> [LangExt.Extension]

-- Nothing: the default case
languageExtensions :: Maybe Language -> [Extension]
languageExtensions Maybe Language
Nothing = Maybe Language -> [Extension]
languageExtensions (Language -> Maybe Language
forall a. a -> Maybe a
Just Language
GHC2021)

languageExtensions (Just Language
Haskell98)
    = [Extension
LangExt.ImplicitPrelude,
       -- See Note [When is StarIsType enabled]
       Extension
LangExt.StarIsType,
       Extension
LangExt.CUSKs,
       Extension
LangExt.MonomorphismRestriction,
       Extension
LangExt.NPlusKPatterns,
       Extension
LangExt.DatatypeContexts,
       Extension
LangExt.TraditionalRecordSyntax,
       Extension
LangExt.FieldSelectors,
       Extension
LangExt.NondecreasingIndentation
           -- strictly speaking non-standard, but we always had this
           -- on implicitly before the option was added in 7.1, and
           -- turning it off breaks code, so we're keeping it on for
           -- backwards compatibility.  Cabal uses -XHaskell98 by
           -- default unless you specify another language.
      ]

languageExtensions (Just Language
Haskell2010)
    = [Extension
LangExt.ImplicitPrelude,
       -- See Note [When is StarIsType enabled]
       Extension
LangExt.StarIsType,
       Extension
LangExt.CUSKs,
       Extension
LangExt.MonomorphismRestriction,
       Extension
LangExt.DatatypeContexts,
       Extension
LangExt.TraditionalRecordSyntax,
       Extension
LangExt.EmptyDataDecls,
       Extension
LangExt.ForeignFunctionInterface,
       Extension
LangExt.PatternGuards,
       Extension
LangExt.DoAndIfThenElse,
       Extension
LangExt.FieldSelectors,
       Extension
LangExt.RelaxedPolyRec]

languageExtensions (Just Language
GHC2021)
    = [Extension
LangExt.ImplicitPrelude,
       -- See Note [When is StarIsType enabled]
       Extension
LangExt.StarIsType,
       Extension
LangExt.MonomorphismRestriction,
       Extension
LangExt.TraditionalRecordSyntax,
       Extension
LangExt.EmptyDataDecls,
       Extension
LangExt.ForeignFunctionInterface,
       Extension
LangExt.PatternGuards,
       Extension
LangExt.DoAndIfThenElse,
       Extension
LangExt.FieldSelectors,
       Extension
LangExt.RelaxedPolyRec,
       -- Now the new extensions (not in Haskell2010)
       Extension
LangExt.BangPatterns,
       Extension
LangExt.BinaryLiterals,
       Extension
LangExt.ConstrainedClassMethods,
       Extension
LangExt.ConstraintKinds,
       Extension
LangExt.DeriveDataTypeable,
       Extension
LangExt.DeriveFoldable,
       Extension
LangExt.DeriveFunctor,
       Extension
LangExt.DeriveGeneric,
       Extension
LangExt.DeriveLift,
       Extension
LangExt.DeriveTraversable,
       Extension
LangExt.EmptyCase,
       Extension
LangExt.EmptyDataDeriving,
       Extension
LangExt.ExistentialQuantification,
       Extension
LangExt.ExplicitForAll,
       Extension
LangExt.FlexibleContexts,
       Extension
LangExt.FlexibleInstances,
       Extension
LangExt.GADTSyntax,
       Extension
LangExt.GeneralizedNewtypeDeriving,
       Extension
LangExt.HexFloatLiterals,
       Extension
LangExt.ImportQualifiedPost,
       Extension
LangExt.InstanceSigs,
       Extension
LangExt.KindSignatures,
       Extension
LangExt.MultiParamTypeClasses,
       Extension
LangExt.RecordPuns,
       Extension
LangExt.NamedWildCards,
       Extension
LangExt.NumericUnderscores,
       Extension
LangExt.PolyKinds,
       Extension
LangExt.PostfixOperators,
       Extension
LangExt.RankNTypes,
       Extension
LangExt.ScopedTypeVariables,
       Extension
LangExt.StandaloneDeriving,
       Extension
LangExt.StandaloneKindSignatures,
       Extension
LangExt.TupleSections,
       Extension
LangExt.TypeApplications,
       Extension
LangExt.TypeOperators,
       Extension
LangExt.TypeSynonymInstances]

hasPprDebug :: DynFlags -> Bool
hasPprDebug :: DynFlags -> Bool
hasPprDebug = DumpFlag -> DynFlags -> Bool
dopt DumpFlag
Opt_D_ppr_debug

hasNoDebugOutput :: DynFlags -> Bool
hasNoDebugOutput :: DynFlags -> Bool
hasNoDebugOutput = DumpFlag -> DynFlags -> Bool
dopt DumpFlag
Opt_D_no_debug_output

hasNoStateHack :: DynFlags -> Bool
hasNoStateHack :: DynFlags -> Bool
hasNoStateHack = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_G_NoStateHack

hasNoOptCoercion :: DynFlags -> Bool
hasNoOptCoercion :: DynFlags -> Bool
hasNoOptCoercion = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_G_NoOptCoercion


-- | Test whether a 'DumpFlag' is set
dopt :: DumpFlag -> DynFlags -> Bool
dopt :: DumpFlag -> DynFlags -> Bool
dopt DumpFlag
f DynFlags
dflags = (DumpFlag
f DumpFlag -> EnumSet DumpFlag -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
`EnumSet.member` DynFlags -> EnumSet DumpFlag
dumpFlags DynFlags
dflags)
             Bool -> Bool -> Bool
|| (DynFlags -> Int
verbosity DynFlags
dflags Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
4 Bool -> Bool -> Bool
&& DumpFlag -> Bool
enableIfVerbose DumpFlag
f)
    where enableIfVerbose :: DumpFlag -> Bool
enableIfVerbose DumpFlag
Opt_D_dump_tc_trace               = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_rn_trace               = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_cs_trace               = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_if_trace               = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_vt_trace               = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_tc                     = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_rn                     = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_rn_stats               = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_hi_diffs               = Bool
False
          enableIfVerbose DumpFlag
Opt_D_verbose_core2core           = Bool
False
          enableIfVerbose DumpFlag
Opt_D_verbose_stg2stg             = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_splices                = Bool
False
          enableIfVerbose DumpFlag
Opt_D_th_dec_file                 = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_rule_firings           = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_rule_rewrites          = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_simpl_trace            = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_rtti                   = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_inlinings              = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_core_stats             = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_asm_stats              = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_types                  = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_simpl_iterations       = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_ticked                 = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_view_pattern_commoning = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_mod_cycles             = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_mod_map                = Bool
False
          enableIfVerbose DumpFlag
Opt_D_dump_ec_trace               = Bool
False
          enableIfVerbose DumpFlag
_                                 = Bool
True

-- | Set a 'DumpFlag'
dopt_set :: DynFlags -> DumpFlag -> DynFlags
dopt_set :: DynFlags -> DumpFlag -> DynFlags
dopt_set DynFlags
dfs DumpFlag
f = DynFlags
dfs{ dumpFlags :: EnumSet DumpFlag
dumpFlags = DumpFlag -> EnumSet DumpFlag -> EnumSet DumpFlag
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.insert DumpFlag
f (DynFlags -> EnumSet DumpFlag
dumpFlags DynFlags
dfs) }

-- | Unset a 'DumpFlag'
dopt_unset :: DynFlags -> DumpFlag -> DynFlags
dopt_unset :: DynFlags -> DumpFlag -> DynFlags
dopt_unset DynFlags
dfs DumpFlag
f = DynFlags
dfs{ dumpFlags :: EnumSet DumpFlag
dumpFlags = DumpFlag -> EnumSet DumpFlag -> EnumSet DumpFlag
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.delete DumpFlag
f (DynFlags -> EnumSet DumpFlag
dumpFlags DynFlags
dfs) }

-- | Test whether a 'GeneralFlag' is set
--
-- Note that `dynamicNow` (i.e., dynamic objects built with `-dynamic-too`)
-- always implicitly enables Opt_PIC, Opt_ExternalDynamicRefs, and disables
-- Opt_SplitSections.
--
gopt :: GeneralFlag -> DynFlags -> Bool
gopt :: GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIC DynFlags
dflags
   | DynFlags -> Bool
dynamicNow DynFlags
dflags = Bool
True
gopt GeneralFlag
Opt_ExternalDynamicRefs DynFlags
dflags
   | DynFlags -> Bool
dynamicNow DynFlags
dflags = Bool
True
gopt GeneralFlag
Opt_SplitSections DynFlags
dflags
   | DynFlags -> Bool
dynamicNow DynFlags
dflags = Bool
False
gopt GeneralFlag
f DynFlags
dflags = GeneralFlag
f GeneralFlag -> EnumSet GeneralFlag -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
`EnumSet.member` DynFlags -> EnumSet GeneralFlag
generalFlags DynFlags
dflags

-- | Set a 'GeneralFlag'
gopt_set :: DynFlags -> GeneralFlag -> DynFlags
gopt_set :: DynFlags -> GeneralFlag -> DynFlags
gopt_set DynFlags
dfs GeneralFlag
f = DynFlags
dfs{ generalFlags :: EnumSet GeneralFlag
generalFlags = GeneralFlag -> EnumSet GeneralFlag -> EnumSet GeneralFlag
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.insert GeneralFlag
f (DynFlags -> EnumSet GeneralFlag
generalFlags DynFlags
dfs) }

-- | Unset a 'GeneralFlag'
gopt_unset :: DynFlags -> GeneralFlag -> DynFlags
gopt_unset :: DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dfs GeneralFlag
f = DynFlags
dfs{ generalFlags :: EnumSet GeneralFlag
generalFlags = GeneralFlag -> EnumSet GeneralFlag -> EnumSet GeneralFlag
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.delete GeneralFlag
f (DynFlags -> EnumSet GeneralFlag
generalFlags DynFlags
dfs) }

-- | Test whether a 'WarningFlag' is set
wopt :: WarningFlag -> DynFlags -> Bool
wopt :: WarningFlag -> DynFlags -> Bool
wopt WarningFlag
f DynFlags
dflags  = WarningFlag
f WarningFlag -> EnumSet WarningFlag -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
`EnumSet.member` DynFlags -> EnumSet WarningFlag
warningFlags DynFlags
dflags

-- | Set a 'WarningFlag'
wopt_set :: DynFlags -> WarningFlag -> DynFlags
wopt_set :: DynFlags -> WarningFlag -> DynFlags
wopt_set DynFlags
dfs WarningFlag
f = DynFlags
dfs{ warningFlags :: EnumSet WarningFlag
warningFlags = WarningFlag -> EnumSet WarningFlag -> EnumSet WarningFlag
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.insert WarningFlag
f (DynFlags -> EnumSet WarningFlag
warningFlags DynFlags
dfs) }

-- | Unset a 'WarningFlag'
wopt_unset :: DynFlags -> WarningFlag -> DynFlags
wopt_unset :: DynFlags -> WarningFlag -> DynFlags
wopt_unset DynFlags
dfs WarningFlag
f = DynFlags
dfs{ warningFlags :: EnumSet WarningFlag
warningFlags = WarningFlag -> EnumSet WarningFlag -> EnumSet WarningFlag
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.delete WarningFlag
f (DynFlags -> EnumSet WarningFlag
warningFlags DynFlags
dfs) }

-- | Test whether a 'WarningFlag' is set as fatal
wopt_fatal :: WarningFlag -> DynFlags -> Bool
wopt_fatal :: WarningFlag -> DynFlags -> Bool
wopt_fatal WarningFlag
f DynFlags
dflags = WarningFlag
f WarningFlag -> EnumSet WarningFlag -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
`EnumSet.member` DynFlags -> EnumSet WarningFlag
fatalWarningFlags DynFlags
dflags

-- | Mark a 'WarningFlag' as fatal (do not set the flag)
wopt_set_fatal :: DynFlags -> WarningFlag -> DynFlags
wopt_set_fatal :: DynFlags -> WarningFlag -> DynFlags
wopt_set_fatal DynFlags
dfs WarningFlag
f
    = DynFlags
dfs { fatalWarningFlags :: EnumSet WarningFlag
fatalWarningFlags = WarningFlag -> EnumSet WarningFlag -> EnumSet WarningFlag
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.insert WarningFlag
f (DynFlags -> EnumSet WarningFlag
fatalWarningFlags DynFlags
dfs) }

-- | Mark a 'WarningFlag' as not fatal
wopt_unset_fatal :: DynFlags -> WarningFlag -> DynFlags
wopt_unset_fatal :: DynFlags -> WarningFlag -> DynFlags
wopt_unset_fatal DynFlags
dfs WarningFlag
f
    = DynFlags
dfs { fatalWarningFlags :: EnumSet WarningFlag
fatalWarningFlags = WarningFlag -> EnumSet WarningFlag -> EnumSet WarningFlag
forall a. Enum a => a -> EnumSet a -> EnumSet a
EnumSet.delete WarningFlag
f (DynFlags -> EnumSet WarningFlag
fatalWarningFlags DynFlags
dfs) }

-- | Test whether a 'LangExt.Extension' is set
xopt :: LangExt.Extension -> DynFlags -> Bool
xopt :: Extension -> DynFlags -> Bool
xopt Extension
f DynFlags
dflags = Extension
f Extension -> EnumSet Extension -> Bool
forall a. Enum a => a -> EnumSet a -> Bool
`EnumSet.member` DynFlags -> EnumSet Extension
extensionFlags DynFlags
dflags

-- | Set a 'LangExt.Extension'
xopt_set :: DynFlags -> LangExt.Extension -> DynFlags
xopt_set :: DynFlags -> Extension -> DynFlags
xopt_set DynFlags
dfs Extension
f
    = let onoffs :: [OnOff Extension]
onoffs = Extension -> OnOff Extension
forall a. a -> OnOff a
On Extension
f OnOff Extension -> [OnOff Extension] -> [OnOff Extension]
forall a. a -> [a] -> [a]
: DynFlags -> [OnOff Extension]
extensions DynFlags
dfs
      in DynFlags
dfs { extensions :: [OnOff Extension]
extensions = [OnOff Extension]
onoffs,
               extensionFlags :: EnumSet Extension
extensionFlags = Maybe Language -> [OnOff Extension] -> EnumSet Extension
flattenExtensionFlags (DynFlags -> Maybe Language
language DynFlags
dfs) [OnOff Extension]
onoffs }

-- | Unset a 'LangExt.Extension'
xopt_unset :: DynFlags -> LangExt.Extension -> DynFlags
xopt_unset :: DynFlags -> Extension -> DynFlags
xopt_unset DynFlags
dfs Extension
f
    = let onoffs :: [OnOff Extension]
onoffs = Extension -> OnOff Extension
forall a. a -> OnOff a
Off Extension
f OnOff Extension -> [OnOff Extension] -> [OnOff Extension]
forall a. a -> [a] -> [a]
: DynFlags -> [OnOff Extension]
extensions DynFlags
dfs
      in DynFlags
dfs { extensions :: [OnOff Extension]
extensions = [OnOff Extension]
onoffs,
               extensionFlags :: EnumSet Extension
extensionFlags = Maybe Language -> [OnOff Extension] -> EnumSet Extension
flattenExtensionFlags (DynFlags -> Maybe Language
language DynFlags
dfs) [OnOff Extension]
onoffs }

-- | Set or unset a 'LangExt.Extension', unless it has been explicitly
--   set or unset before.
xopt_set_unlessExplSpec
        :: LangExt.Extension
        -> (DynFlags -> LangExt.Extension -> DynFlags)
        -> DynFlags -> DynFlags
xopt_set_unlessExplSpec :: Extension
-> (DynFlags -> Extension -> DynFlags) -> DynFlags -> DynFlags
xopt_set_unlessExplSpec Extension
ext DynFlags -> Extension -> DynFlags
setUnset DynFlags
dflags =
    let referedExts :: [Extension]
referedExts = OnOff Extension -> Extension
forall {a}. OnOff a -> a
stripOnOff (OnOff Extension -> Extension) -> [OnOff Extension] -> [Extension]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> DynFlags -> [OnOff Extension]
extensions DynFlags
dflags
        stripOnOff :: OnOff a -> a
stripOnOff (On a
x)  = a
x
        stripOnOff (Off a
x) = a
x
    in
        if Extension
ext Extension -> [Extension] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Extension]
referedExts then DynFlags
dflags else DynFlags -> Extension -> DynFlags
setUnset DynFlags
dflags Extension
ext

xopt_DuplicateRecordFields :: DynFlags -> FieldLabel.DuplicateRecordFields
xopt_DuplicateRecordFields :: DynFlags -> DuplicateRecordFields
xopt_DuplicateRecordFields DynFlags
dfs
  | Extension -> DynFlags -> Bool
xopt Extension
LangExt.DuplicateRecordFields DynFlags
dfs = DuplicateRecordFields
FieldLabel.DuplicateRecordFields
  | Bool
otherwise                              = DuplicateRecordFields
FieldLabel.NoDuplicateRecordFields

xopt_FieldSelectors :: DynFlags -> FieldLabel.FieldSelectors
xopt_FieldSelectors :: DynFlags -> FieldSelectors
xopt_FieldSelectors DynFlags
dfs
  | Extension -> DynFlags -> Bool
xopt Extension
LangExt.FieldSelectors DynFlags
dfs = FieldSelectors
FieldLabel.FieldSelectors
  | Bool
otherwise                       = FieldSelectors
FieldLabel.NoFieldSelectors

lang_set :: DynFlags -> Maybe Language -> DynFlags
lang_set :: DynFlags -> Maybe Language -> DynFlags
lang_set DynFlags
dflags Maybe Language
lang =
   DynFlags
dflags {
            language :: Maybe Language
language = Maybe Language
lang,
            extensionFlags :: EnumSet Extension
extensionFlags = Maybe Language -> [OnOff Extension] -> EnumSet Extension
flattenExtensionFlags Maybe Language
lang (DynFlags -> [OnOff Extension]
extensions DynFlags
dflags)
          }

-- | Set the Haskell language standard to use
setLanguage :: Language -> DynP ()
setLanguage :: Language -> DynP ()
setLanguage Language
l = (DynFlags -> DynFlags) -> DynP ()
upd (DynFlags -> Maybe Language -> DynFlags
`lang_set` Language -> Maybe Language
forall a. a -> Maybe a
Just Language
l)

-- | Some modules have dependencies on others through the DynFlags rather than textual imports
dynFlagDependencies :: DynFlags -> [ModuleName]
dynFlagDependencies :: DynFlags -> [ModuleName]
dynFlagDependencies = DynFlags -> [ModuleName]
pluginModNames

-- | Is the -fpackage-trust mode on
packageTrustOn :: DynFlags -> Bool
packageTrustOn :: DynFlags -> Bool
packageTrustOn = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PackageTrust

-- | Is Safe Haskell on in some way (including inference mode)
safeHaskellOn :: DynFlags -> Bool
safeHaskellOn :: DynFlags -> Bool
safeHaskellOn DynFlags
dflags = DynFlags -> Bool
safeHaskellModeEnabled DynFlags
dflags Bool -> Bool -> Bool
|| DynFlags -> Bool
safeInferOn DynFlags
dflags

safeHaskellModeEnabled :: DynFlags -> Bool
safeHaskellModeEnabled :: DynFlags -> Bool
safeHaskellModeEnabled DynFlags
dflags = DynFlags -> SafeHaskellMode
safeHaskell DynFlags
dflags SafeHaskellMode -> [SafeHaskellMode] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [SafeHaskellMode
Sf_Unsafe, SafeHaskellMode
Sf_Trustworthy
                                                   , SafeHaskellMode
Sf_Safe ]


-- | Is the Safe Haskell safe language in use
safeLanguageOn :: DynFlags -> Bool
safeLanguageOn :: DynFlags -> Bool
safeLanguageOn DynFlags
dflags = DynFlags -> SafeHaskellMode
safeHaskell DynFlags
dflags SafeHaskellMode -> SafeHaskellMode -> Bool
forall a. Eq a => a -> a -> Bool
== SafeHaskellMode
Sf_Safe

-- | Is the Safe Haskell safe inference mode active
safeInferOn :: DynFlags -> Bool
safeInferOn :: DynFlags -> Bool
safeInferOn = DynFlags -> Bool
safeInfer

-- | Test if Safe Imports are on in some form
safeImportsOn :: DynFlags -> Bool
safeImportsOn :: DynFlags -> Bool
safeImportsOn DynFlags
dflags = DynFlags -> SafeHaskellMode
safeHaskell DynFlags
dflags SafeHaskellMode -> SafeHaskellMode -> Bool
forall a. Eq a => a -> a -> Bool
== SafeHaskellMode
Sf_Unsafe Bool -> Bool -> Bool
||
                       DynFlags -> SafeHaskellMode
safeHaskell DynFlags
dflags SafeHaskellMode -> SafeHaskellMode -> Bool
forall a. Eq a => a -> a -> Bool
== SafeHaskellMode
Sf_Trustworthy Bool -> Bool -> Bool
||
                       DynFlags -> SafeHaskellMode
safeHaskell DynFlags
dflags SafeHaskellMode -> SafeHaskellMode -> Bool
forall a. Eq a => a -> a -> Bool
== SafeHaskellMode
Sf_Safe

-- | Set a 'Safe Haskell' flag
setSafeHaskell :: SafeHaskellMode -> DynP ()
setSafeHaskell :: SafeHaskellMode -> DynP ()
setSafeHaskell SafeHaskellMode
s = (DynFlags -> DynP DynFlags) -> DynP ()
updM DynFlags -> DynP DynFlags
f
    where f :: DynFlags -> DynP DynFlags
f DynFlags
dfs = do
              let sf :: SafeHaskellMode
sf = DynFlags -> SafeHaskellMode
safeHaskell DynFlags
dfs
              SafeHaskellMode
safeM <- SafeHaskellMode -> SafeHaskellMode -> DynP SafeHaskellMode
combineSafeFlags SafeHaskellMode
sf SafeHaskellMode
s
              case SafeHaskellMode
s of
                SafeHaskellMode
Sf_Safe -> DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return (DynFlags -> DynP DynFlags) -> DynFlags -> DynP DynFlags
forall a b. (a -> b) -> a -> b
$ DynFlags
dfs { safeHaskell :: SafeHaskellMode
safeHaskell = SafeHaskellMode
safeM, safeInfer :: Bool
safeInfer = Bool
False }
                -- leave safe inferrence on in Trustworthy mode so we can warn
                -- if it could have been inferred safe.
                SafeHaskellMode
Sf_Trustworthy -> do
                  SrcSpan
l <- EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc
                  DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return (DynFlags -> DynP DynFlags) -> DynFlags -> DynP DynFlags
forall a b. (a -> b) -> a -> b
$ DynFlags
dfs { safeHaskell :: SafeHaskellMode
safeHaskell = SafeHaskellMode
safeM, trustworthyOnLoc :: SrcSpan
trustworthyOnLoc = SrcSpan
l }
                -- leave safe inference on in Unsafe mode as well.
                SafeHaskellMode
_ -> DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return (DynFlags -> DynP DynFlags) -> DynFlags -> DynP DynFlags
forall a b. (a -> b) -> a -> b
$ DynFlags
dfs { safeHaskell :: SafeHaskellMode
safeHaskell = SafeHaskellMode
safeM }

-- | Are all direct imports required to be safe for this Safe Haskell mode?
-- Direct imports are when the code explicitly imports a module
safeDirectImpsReq :: DynFlags -> Bool
safeDirectImpsReq :: DynFlags -> Bool
safeDirectImpsReq DynFlags
d = DynFlags -> Bool
safeLanguageOn DynFlags
d

-- | Are all implicit imports required to be safe for this Safe Haskell mode?
-- Implicit imports are things in the prelude. e.g System.IO when print is used.
safeImplicitImpsReq :: DynFlags -> Bool
safeImplicitImpsReq :: DynFlags -> Bool
safeImplicitImpsReq DynFlags
d = DynFlags -> Bool
safeLanguageOn DynFlags
d

-- | Combine two Safe Haskell modes correctly. Used for dealing with multiple flags.
-- This makes Safe Haskell very much a monoid but for now I prefer this as I don't
-- want to export this functionality from the module but do want to export the
-- type constructors.
combineSafeFlags :: SafeHaskellMode -> SafeHaskellMode -> DynP SafeHaskellMode
combineSafeFlags :: SafeHaskellMode -> SafeHaskellMode -> DynP SafeHaskellMode
combineSafeFlags SafeHaskellMode
a SafeHaskellMode
b | SafeHaskellMode
a SafeHaskellMode -> SafeHaskellMode -> Bool
forall a. Eq a => a -> a -> Bool
== SafeHaskellMode
Sf_None         = SafeHaskellMode -> DynP SafeHaskellMode
forall (m :: * -> *) a. Monad m => a -> m a
return SafeHaskellMode
b
                     | SafeHaskellMode
b SafeHaskellMode -> SafeHaskellMode -> Bool
forall a. Eq a => a -> a -> Bool
== SafeHaskellMode
Sf_None         = SafeHaskellMode -> DynP SafeHaskellMode
forall (m :: * -> *) a. Monad m => a -> m a
return SafeHaskellMode
a
                     | SafeHaskellMode
a SafeHaskellMode -> SafeHaskellMode -> Bool
forall a. Eq a => a -> a -> Bool
== SafeHaskellMode
Sf_Ignore Bool -> Bool -> Bool
|| SafeHaskellMode
b SafeHaskellMode -> SafeHaskellMode -> Bool
forall a. Eq a => a -> a -> Bool
== SafeHaskellMode
Sf_Ignore = SafeHaskellMode -> DynP SafeHaskellMode
forall (m :: * -> *) a. Monad m => a -> m a
return SafeHaskellMode
Sf_Ignore
                     | SafeHaskellMode
a SafeHaskellMode -> SafeHaskellMode -> Bool
forall a. Eq a => a -> a -> Bool
== SafeHaskellMode
b               = SafeHaskellMode -> DynP SafeHaskellMode
forall (m :: * -> *) a. Monad m => a -> m a
return SafeHaskellMode
a
                     | Bool
otherwise            = [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
addErr [Char]
errm DynP () -> DynP SafeHaskellMode -> DynP SafeHaskellMode
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> SafeHaskellMode -> DynP SafeHaskellMode
forall (f :: * -> *) a. Applicative f => a -> f a
pure SafeHaskellMode
a
    where errm :: [Char]
errm = [Char]
"Incompatible Safe Haskell flags! ("
                    [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ SafeHaskellMode -> [Char]
forall a. Show a => a -> [Char]
show SafeHaskellMode
a [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
", " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ SafeHaskellMode -> [Char]
forall a. Show a => a -> [Char]
show SafeHaskellMode
b [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
")"

-- | A list of unsafe flags under Safe Haskell. Tuple elements are:
--     * name of the flag
--     * function to get srcspan that enabled the flag
--     * function to test if the flag is on
--     * function to turn the flag off
unsafeFlags, unsafeFlagsForInfer
  :: [(String, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)]
unsafeFlags :: [([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
  DynFlags -> DynFlags)]
unsafeFlags = [ ([Char]
"-XGeneralizedNewtypeDeriving", DynFlags -> SrcSpan
newDerivOnLoc,
                    Extension -> DynFlags -> Bool
xopt Extension
LangExt.GeneralizedNewtypeDeriving,
                    (DynFlags -> Extension -> DynFlags)
-> Extension -> DynFlags -> DynFlags
forall a b c. (a -> b -> c) -> b -> a -> c
flip DynFlags -> Extension -> DynFlags
xopt_unset Extension
LangExt.GeneralizedNewtypeDeriving)
              , ([Char]
"-XDerivingVia", DynFlags -> SrcSpan
deriveViaOnLoc,
                    Extension -> DynFlags -> Bool
xopt Extension
LangExt.DerivingVia,
                    (DynFlags -> Extension -> DynFlags)
-> Extension -> DynFlags -> DynFlags
forall a b c. (a -> b -> c) -> b -> a -> c
flip DynFlags -> Extension -> DynFlags
xopt_unset Extension
LangExt.DerivingVia)
              , ([Char]
"-XTemplateHaskell", DynFlags -> SrcSpan
thOnLoc,
                    Extension -> DynFlags -> Bool
xopt Extension
LangExt.TemplateHaskell,
                    (DynFlags -> Extension -> DynFlags)
-> Extension -> DynFlags -> DynFlags
forall a b c. (a -> b -> c) -> b -> a -> c
flip DynFlags -> Extension -> DynFlags
xopt_unset Extension
LangExt.TemplateHaskell)
              ]
unsafeFlagsForInfer :: [([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
  DynFlags -> DynFlags)]
unsafeFlagsForInfer = [([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
  DynFlags -> DynFlags)]
unsafeFlags


-- | Retrieve the options corresponding to a particular @opt_*@ field in the correct order
getOpts :: DynFlags             -- ^ 'DynFlags' to retrieve the options from
        -> (DynFlags -> [a])    -- ^ Relevant record accessor: one of the @opt_*@ accessors
        -> [a]                  -- ^ Correctly ordered extracted options
getOpts :: forall a. DynFlags -> (DynFlags -> [a]) -> [a]
getOpts DynFlags
dflags DynFlags -> [a]
opts = [a] -> [a]
forall a. [a] -> [a]
reverse (DynFlags -> [a]
opts DynFlags
dflags)
        -- We add to the options from the front, so we need to reverse the list

-- | Gets the verbosity flag for the current verbosity level. This is fed to
-- other tools, so GHC-specific verbosity flags like @-ddump-most@ are not included
getVerbFlags :: DynFlags -> [String]
getVerbFlags :: DynFlags -> [[Char]]
getVerbFlags DynFlags
dflags
  | DynFlags -> Int
verbosity DynFlags
dflags Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
4 = [[Char]
"-v"]
  | Bool
otherwise             = []

setObjectDir, setHiDir, setHieDir, setStubDir, setDumpDir, setOutputDir,
         setDynObjectSuf, setDynHiSuf,
         setDylibInstallName,
         setObjectSuf, setHiSuf, setHieSuf, setHcSuf, parseDynLibLoaderMode,
         setPgmP, addOptl, addOptc, addOptcxx, addOptP,
         addCmdlineFramework, addHaddockOpts, addGhciScript,
         setInteractivePrint
   :: String -> DynFlags -> DynFlags
setOutputFile, setDynOutputFile, setOutputHi, setDumpPrefixForce
   :: Maybe String -> DynFlags -> DynFlags

setObjectDir :: [Char] -> DynFlags -> DynFlags
setObjectDir  [Char]
f DynFlags
d = DynFlags
d { objectDir :: Maybe [Char]
objectDir  = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
f}
setHiDir :: [Char] -> DynFlags -> DynFlags
setHiDir      [Char]
f DynFlags
d = DynFlags
d { hiDir :: Maybe [Char]
hiDir      = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
f}
setHieDir :: [Char] -> DynFlags -> DynFlags
setHieDir     [Char]
f DynFlags
d = DynFlags
d { hieDir :: Maybe [Char]
hieDir     = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
f}
setStubDir :: [Char] -> DynFlags -> DynFlags
setStubDir    [Char]
f DynFlags
d = DynFlags
d { stubDir :: Maybe [Char]
stubDir    = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
f
                      , includePaths :: IncludeSpecs
includePaths = IncludeSpecs -> [[Char]] -> IncludeSpecs
addGlobalInclude (DynFlags -> IncludeSpecs
includePaths DynFlags
d) [[Char]
f] }
  -- -stubdir D adds an implicit -I D, so that gcc can find the _stub.h file
  -- \#included from the .hc file when compiling via C (i.e. unregisterised
  -- builds).
setDumpDir :: [Char] -> DynFlags -> DynFlags
setDumpDir    [Char]
f DynFlags
d = DynFlags
d { dumpDir :: Maybe [Char]
dumpDir    = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
f}
setOutputDir :: [Char] -> DynFlags -> DynFlags
setOutputDir  [Char]
f = [Char] -> DynFlags -> DynFlags
setObjectDir [Char]
f
                (DynFlags -> DynFlags)
-> (DynFlags -> DynFlags) -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> DynFlags -> DynFlags
setHieDir [Char]
f
                (DynFlags -> DynFlags)
-> (DynFlags -> DynFlags) -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> DynFlags -> DynFlags
setHiDir [Char]
f
                (DynFlags -> DynFlags)
-> (DynFlags -> DynFlags) -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> DynFlags -> DynFlags
setStubDir [Char]
f
                (DynFlags -> DynFlags)
-> (DynFlags -> DynFlags) -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> DynFlags -> DynFlags
setDumpDir [Char]
f
setDylibInstallName :: [Char] -> DynFlags -> DynFlags
setDylibInstallName  [Char]
f DynFlags
d = DynFlags
d { dylibInstallName :: Maybe [Char]
dylibInstallName = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
f}

setObjectSuf :: [Char] -> DynFlags -> DynFlags
setObjectSuf    [Char]
f DynFlags
d = DynFlags
d { objectSuf_ :: [Char]
objectSuf_    = [Char]
f}
setDynObjectSuf :: [Char] -> DynFlags -> DynFlags
setDynObjectSuf [Char]
f DynFlags
d = DynFlags
d { dynObjectSuf_ :: [Char]
dynObjectSuf_ = [Char]
f}
setHiSuf :: [Char] -> DynFlags -> DynFlags
setHiSuf        [Char]
f DynFlags
d = DynFlags
d { hiSuf_ :: [Char]
hiSuf_        = [Char]
f}
setHieSuf :: [Char] -> DynFlags -> DynFlags
setHieSuf       [Char]
f DynFlags
d = DynFlags
d { hieSuf :: [Char]
hieSuf        = [Char]
f}
setDynHiSuf :: [Char] -> DynFlags -> DynFlags
setDynHiSuf     [Char]
f DynFlags
d = DynFlags
d { dynHiSuf_ :: [Char]
dynHiSuf_     = [Char]
f}
setHcSuf :: [Char] -> DynFlags -> DynFlags
setHcSuf        [Char]
f DynFlags
d = DynFlags
d { hcSuf :: [Char]
hcSuf         = [Char]
f}

setOutputFile :: Maybe [Char] -> DynFlags -> DynFlags
setOutputFile    Maybe [Char]
f DynFlags
d = DynFlags
d { outputFile_ :: Maybe [Char]
outputFile_    = Maybe [Char]
f}
setDynOutputFile :: Maybe [Char] -> DynFlags -> DynFlags
setDynOutputFile Maybe [Char]
f DynFlags
d = DynFlags
d { dynOutputFile_ :: Maybe [Char]
dynOutputFile_ = Maybe [Char]
f}
setOutputHi :: Maybe [Char] -> DynFlags -> DynFlags
setOutputHi      Maybe [Char]
f DynFlags
d = DynFlags
d { outputHi :: Maybe [Char]
outputHi       = Maybe [Char]
f}

parseUnitInsts :: String -> Instantiations
parseUnitInsts :: [Char] -> [(ModuleName, Module)]
parseUnitInsts [Char]
str = case (([(ModuleName, Module)], [Char]) -> Bool)
-> [([(ModuleName, Module)], [Char])]
-> [([(ModuleName, Module)], [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (([Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
==[Char]
"")([Char] -> Bool)
-> (([(ModuleName, Module)], [Char]) -> [Char])
-> ([(ModuleName, Module)], [Char])
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
.([(ModuleName, Module)], [Char]) -> [Char]
forall a b. (a, b) -> b
snd) (ReadP [(ModuleName, Module)] -> ReadS [(ModuleName, Module)]
forall a. ReadP a -> ReadS a
readP_to_S ReadP [(ModuleName, Module)]
parse [Char]
str) of
    [([(ModuleName, Module)]
r, [Char]
"")] -> [(ModuleName, Module)]
r
    [([(ModuleName, Module)], [Char])]
_ -> GhcException -> [(ModuleName, Module)]
forall a. GhcException -> a
throwGhcException (GhcException -> [(ModuleName, Module)])
-> GhcException -> [(ModuleName, Module)]
forall a b. (a -> b) -> a -> b
$ [Char] -> GhcException
CmdLineError ([Char]
"Can't parse -instantiated-with: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
str)
  where parse :: ReadP [(ModuleName, Module)]
parse = ReadP (ModuleName, Module)
-> ReadP Char -> ReadP [(ModuleName, Module)]
forall a sep. ReadP a -> ReadP sep -> ReadP [a]
sepBy ReadP (ModuleName, Module)
parseEntry (Char -> ReadP Char
R.char Char
',')
        parseEntry :: ReadP (ModuleName, Module)
parseEntry = do
            ModuleName
n <- ReadP ModuleName
parseModuleName
            Char
_ <- Char -> ReadP Char
R.char Char
'='
            Module
m <- ReadP Module
parseHoleyModule
            (ModuleName, Module) -> ReadP (ModuleName, Module)
forall (m :: * -> *) a. Monad m => a -> m a
return (ModuleName
n, Module
m)

setUnitInstantiations :: String -> DynFlags -> DynFlags
setUnitInstantiations :: [Char] -> DynFlags -> DynFlags
setUnitInstantiations [Char]
s DynFlags
d =
    DynFlags
d { homeUnitInstantiations_ :: [(ModuleName, Module)]
homeUnitInstantiations_ = [Char] -> [(ModuleName, Module)]
parseUnitInsts [Char]
s }

setUnitInstanceOf :: String -> DynFlags -> DynFlags
setUnitInstanceOf :: [Char] -> DynFlags -> DynFlags
setUnitInstanceOf [Char]
s DynFlags
d =
    DynFlags
d { homeUnitInstanceOf_ :: Maybe UnitId
homeUnitInstanceOf_ = UnitId -> Maybe UnitId
forall a. a -> Maybe a
Just (FastString -> UnitId
UnitId ([Char] -> FastString
fsLit [Char]
s)) }

addPluginModuleName :: String -> DynFlags -> DynFlags
addPluginModuleName :: [Char] -> DynFlags -> DynFlags
addPluginModuleName [Char]
name DynFlags
d = DynFlags
d { pluginModNames :: [ModuleName]
pluginModNames = ([Char] -> ModuleName
mkModuleName [Char]
name) ModuleName -> [ModuleName] -> [ModuleName]
forall a. a -> [a] -> [a]
: (DynFlags -> [ModuleName]
pluginModNames DynFlags
d) }

clearPluginModuleNames :: DynFlags -> DynFlags
clearPluginModuleNames :: DynFlags -> DynFlags
clearPluginModuleNames DynFlags
d =
    DynFlags
d { pluginModNames :: [ModuleName]
pluginModNames = []
      , pluginModNameOpts :: [(ModuleName, [Char])]
pluginModNameOpts = []
      }

addPluginModuleNameOption :: String -> DynFlags -> DynFlags
addPluginModuleNameOption :: [Char] -> DynFlags -> DynFlags
addPluginModuleNameOption [Char]
optflag DynFlags
d = DynFlags
d { pluginModNameOpts :: [(ModuleName, [Char])]
pluginModNameOpts = ([Char] -> ModuleName
mkModuleName [Char]
m, [Char]
option) (ModuleName, [Char])
-> [(ModuleName, [Char])] -> [(ModuleName, [Char])]
forall a. a -> [a] -> [a]
: (DynFlags -> [(ModuleName, [Char])]
pluginModNameOpts DynFlags
d) }
  where ([Char]
m, [Char]
rest) = (Char -> Bool) -> [Char] -> ([Char], [Char])
forall a. (a -> Bool) -> [a] -> ([a], [a])
break (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
':') [Char]
optflag
        option :: [Char]
option = case [Char]
rest of
          [] -> [Char]
"" -- should probably signal an error
          (Char
_:[Char]
plug_opt) -> [Char]
plug_opt -- ignore the ':' from break

addFrontendPluginOption :: String -> DynFlags -> DynFlags
addFrontendPluginOption :: [Char] -> DynFlags -> DynFlags
addFrontendPluginOption [Char]
s DynFlags
d = DynFlags
d { frontendPluginOpts :: [[Char]]
frontendPluginOpts = [Char]
s [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: DynFlags -> [[Char]]
frontendPluginOpts DynFlags
d }

parseDynLibLoaderMode :: [Char] -> DynFlags -> DynFlags
parseDynLibLoaderMode [Char]
f DynFlags
d =
 case Int -> [Char] -> ([Char], [Char])
forall a. Int -> [a] -> ([a], [a])
splitAt Int
8 [Char]
f of
   ([Char]
"deploy", [Char]
"")       -> DynFlags
d { dynLibLoader :: DynLibLoader
dynLibLoader = DynLibLoader
Deployable }
   ([Char]
"sysdep", [Char]
"")       -> DynFlags
d { dynLibLoader :: DynLibLoader
dynLibLoader = DynLibLoader
SystemDependent }
   ([Char], [Char])
_                    -> GhcException -> DynFlags
forall a. GhcException -> a
throwGhcException ([Char] -> GhcException
CmdLineError ([Char]
"Unknown dynlib loader: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
f))

setDumpPrefixForce :: Maybe [Char] -> DynFlags -> DynFlags
setDumpPrefixForce Maybe [Char]
f DynFlags
d = DynFlags
d { dumpPrefixForce :: Maybe [Char]
dumpPrefixForce = Maybe [Char]
f}

-- XXX HACK: Prelude> words "'does not' work" ===> ["'does","not'","work"]
-- Config.hs should really use Option.
setPgmP :: [Char] -> DynFlags -> DynFlags
setPgmP   [Char]
f = (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings (\ToolSettings
s -> ToolSettings
s { toolSettings_pgm_P :: ([Char], [Option])
toolSettings_pgm_P   = ([Char]
pgm, ([Char] -> Option) -> [[Char]] -> [Option]
forall a b. (a -> b) -> [a] -> [b]
map [Char] -> Option
Option [[Char]]
args)})
  where ([Char]
pgm:[[Char]]
args) = [Char] -> [[Char]]
words [Char]
f
addOptl :: [Char] -> DynFlags -> DynFlags
addOptl   [Char]
f = (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings (\ToolSettings
s -> ToolSettings
s { toolSettings_opt_l :: [[Char]]
toolSettings_opt_l   = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_l ToolSettings
s})
addOptc :: [Char] -> DynFlags -> DynFlags
addOptc   [Char]
f = (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings (\ToolSettings
s -> ToolSettings
s { toolSettings_opt_c :: [[Char]]
toolSettings_opt_c   = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_c ToolSettings
s})
addOptcxx :: [Char] -> DynFlags -> DynFlags
addOptcxx [Char]
f = (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings (\ToolSettings
s -> ToolSettings
s { toolSettings_opt_cxx :: [[Char]]
toolSettings_opt_cxx = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_cxx ToolSettings
s})
addOptP :: [Char] -> DynFlags -> DynFlags
addOptP   [Char]
f = (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s
          { toolSettings_opt_P :: [[Char]]
toolSettings_opt_P   = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_P ToolSettings
s
          , toolSettings_opt_P_fingerprint :: Fingerprint
toolSettings_opt_P_fingerprint = [[Char]] -> Fingerprint
fingerprintStrings ([Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_P ToolSettings
s)
          }
          -- See Note [Repeated -optP hashing]
  where
  fingerprintStrings :: [[Char]] -> Fingerprint
fingerprintStrings [[Char]]
ss = [Fingerprint] -> Fingerprint
fingerprintFingerprints ([Fingerprint] -> Fingerprint) -> [Fingerprint] -> Fingerprint
forall a b. (a -> b) -> a -> b
$ ([Char] -> Fingerprint) -> [[Char]] -> [Fingerprint]
forall a b. (a -> b) -> [a] -> [b]
map [Char] -> Fingerprint
fingerprintString [[Char]]
ss


setDepMakefile :: FilePath -> DynFlags -> DynFlags
setDepMakefile :: [Char] -> DynFlags -> DynFlags
setDepMakefile [Char]
f DynFlags
d = DynFlags
d { depMakefile :: [Char]
depMakefile = [Char]
f }

setDepIncludeCppDeps :: Bool -> DynFlags -> DynFlags
setDepIncludeCppDeps :: Bool -> DynFlags -> DynFlags
setDepIncludeCppDeps Bool
b DynFlags
d = DynFlags
d { depIncludeCppDeps :: Bool
depIncludeCppDeps = Bool
b }

setDepIncludePkgDeps :: Bool -> DynFlags -> DynFlags
setDepIncludePkgDeps :: Bool -> DynFlags -> DynFlags
setDepIncludePkgDeps Bool
b DynFlags
d = DynFlags
d { depIncludePkgDeps :: Bool
depIncludePkgDeps = Bool
b }

addDepExcludeMod :: String -> DynFlags -> DynFlags
addDepExcludeMod :: [Char] -> DynFlags -> DynFlags
addDepExcludeMod [Char]
m DynFlags
d
    = DynFlags
d { depExcludeMods :: [ModuleName]
depExcludeMods = [Char] -> ModuleName
mkModuleName [Char]
m ModuleName -> [ModuleName] -> [ModuleName]
forall a. a -> [a] -> [a]
: DynFlags -> [ModuleName]
depExcludeMods DynFlags
d }

addDepSuffix :: FilePath -> DynFlags -> DynFlags
addDepSuffix :: [Char] -> DynFlags -> DynFlags
addDepSuffix [Char]
s DynFlags
d = DynFlags
d { depSuffixes :: [[Char]]
depSuffixes = [Char]
s [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: DynFlags -> [[Char]]
depSuffixes DynFlags
d }

addCmdlineFramework :: [Char] -> DynFlags -> DynFlags
addCmdlineFramework [Char]
f DynFlags
d = DynFlags
d { cmdlineFrameworks :: [[Char]]
cmdlineFrameworks = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: DynFlags -> [[Char]]
cmdlineFrameworks DynFlags
d}

addGhcVersionFile :: FilePath -> DynFlags -> DynFlags
addGhcVersionFile :: [Char] -> DynFlags -> DynFlags
addGhcVersionFile [Char]
f DynFlags
d = DynFlags
d { ghcVersionFile :: Maybe [Char]
ghcVersionFile = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
f }

addHaddockOpts :: [Char] -> DynFlags -> DynFlags
addHaddockOpts [Char]
f DynFlags
d = DynFlags
d { haddockOptions :: Maybe [Char]
haddockOptions = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
f}

addGhciScript :: [Char] -> DynFlags -> DynFlags
addGhciScript [Char]
f DynFlags
d = DynFlags
d { ghciScripts :: [[Char]]
ghciScripts = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: DynFlags -> [[Char]]
ghciScripts DynFlags
d}

setInteractivePrint :: [Char] -> DynFlags -> DynFlags
setInteractivePrint [Char]
f DynFlags
d = DynFlags
d { interactivePrint :: Maybe [Char]
interactivePrint = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
f}

-----------------------------------------------------------------------------
-- Setting the optimisation level

updOptLevel :: Int -> DynFlags -> DynFlags
-- ^ Sets the 'DynFlags' to be appropriate to the optimisation level
updOptLevel :: Int -> DynFlags -> DynFlags
updOptLevel Int
n DynFlags
dfs
  = DynFlags
dfs2{ optLevel :: Int
optLevel = Int
final_n }
  where
   final_n :: Int
final_n = Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
0 (Int -> Int -> Int
forall a. Ord a => a -> a -> a
min Int
2 Int
n)    -- Clamp to 0 <= n <= 2
   dfs1 :: DynFlags
dfs1 = (GeneralFlag -> DynFlags -> DynFlags)
-> DynFlags -> [GeneralFlag] -> DynFlags
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ((DynFlags -> GeneralFlag -> DynFlags)
-> GeneralFlag -> DynFlags -> DynFlags
forall a b c. (a -> b -> c) -> b -> a -> c
flip DynFlags -> GeneralFlag -> DynFlags
gopt_unset) DynFlags
dfs  [GeneralFlag]
remove_gopts
   dfs2 :: DynFlags
dfs2 = (GeneralFlag -> DynFlags -> DynFlags)
-> DynFlags -> [GeneralFlag] -> DynFlags
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr ((DynFlags -> GeneralFlag -> DynFlags)
-> GeneralFlag -> DynFlags -> DynFlags
forall a b c. (a -> b -> c) -> b -> a -> c
flip DynFlags -> GeneralFlag -> DynFlags
gopt_set)   DynFlags
dfs1 [GeneralFlag]
extra_gopts

   extra_gopts :: [GeneralFlag]
extra_gopts  = [ GeneralFlag
f | ([Int]
ns,GeneralFlag
f) <- [([Int], GeneralFlag)]
optLevelFlags, Int
final_n Int -> [Int] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Int]
ns ]
   remove_gopts :: [GeneralFlag]
remove_gopts = [ GeneralFlag
f | ([Int]
ns,GeneralFlag
f) <- [([Int], GeneralFlag)]
optLevelFlags, Int
final_n Int -> [Int] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [Int]
ns ]

{- **********************************************************************
%*                                                                      *
                DynFlags parser
%*                                                                      *
%********************************************************************* -}

-- -----------------------------------------------------------------------------
-- Parsing the dynamic flags.


-- | Parse dynamic flags from a list of command line arguments.  Returns
-- the parsed 'DynFlags', the left-over arguments, and a list of warnings.
-- Throws a 'UsageError' if errors occurred during parsing (such as unknown
-- flags or missing arguments).
parseDynamicFlagsCmdLine :: MonadIO m => DynFlags -> [Located String]
                         -> m (DynFlags, [Located String], [Warn])
                            -- ^ Updated 'DynFlags', left-over arguments, and
                            -- list of warnings.
parseDynamicFlagsCmdLine :: forall (m :: * -> *).
MonadIO m =>
DynFlags
-> [Located [Char]] -> m (DynFlags, [Located [Char]], [Warn])
parseDynamicFlagsCmdLine = [Flag (CmdLineP DynFlags)]
-> Bool
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], [Warn])
forall (m :: * -> *).
MonadIO m =>
[Flag (CmdLineP DynFlags)]
-> Bool
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], [Warn])
parseDynamicFlagsFull [Flag (CmdLineP DynFlags)]
flagsAll Bool
True


-- | Like 'parseDynamicFlagsCmdLine' but does not allow the package flags
-- (-package, -hide-package, -ignore-package, -hide-all-packages, -package-db).
-- Used to parse flags set in a modules pragma.
parseDynamicFilePragma :: MonadIO m => DynFlags -> [Located String]
                       -> m (DynFlags, [Located String], [Warn])
                          -- ^ Updated 'DynFlags', left-over arguments, and
                          -- list of warnings.
parseDynamicFilePragma :: forall (m :: * -> *).
MonadIO m =>
DynFlags
-> [Located [Char]] -> m (DynFlags, [Located [Char]], [Warn])
parseDynamicFilePragma = [Flag (CmdLineP DynFlags)]
-> Bool
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], [Warn])
forall (m :: * -> *).
MonadIO m =>
[Flag (CmdLineP DynFlags)]
-> Bool
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], [Warn])
parseDynamicFlagsFull [Flag (CmdLineP DynFlags)]
flagsDynamic Bool
False


-- | Parses the dynamically set flags for GHC. This is the most general form of
-- the dynamic flag parser that the other methods simply wrap. It allows
-- saying which flags are valid flags and indicating if we are parsing
-- arguments from the command line or from a file pragma.
parseDynamicFlagsFull :: MonadIO m
                  => [Flag (CmdLineP DynFlags)]    -- ^ valid flags to match against
                  -> Bool                          -- ^ are the arguments from the command line?
                  -> DynFlags                      -- ^ current dynamic flags
                  -> [Located String]              -- ^ arguments to parse
                  -> m (DynFlags, [Located String], [Warn])
parseDynamicFlagsFull :: forall (m :: * -> *).
MonadIO m =>
[Flag (CmdLineP DynFlags)]
-> Bool
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], [Warn])
parseDynamicFlagsFull [Flag (CmdLineP DynFlags)]
activeFlags Bool
cmdline DynFlags
dflags0 [Located [Char]]
args = do
  let (([Located [Char]]
leftover, [Err]
errs, [Warn]
warns), DynFlags
dflags1)
          = CmdLineP DynFlags ([Located [Char]], [Err], [Warn])
-> DynFlags -> (([Located [Char]], [Err], [Warn]), DynFlags)
forall s a. CmdLineP s a -> s -> (a, s)
runCmdLine ([Flag (CmdLineP DynFlags)]
-> [Located [Char]]
-> CmdLineP DynFlags ([Located [Char]], [Err], [Warn])
forall (m :: * -> *).
Monad m =>
[Flag m] -> [Located [Char]] -> m ([Located [Char]], [Err], [Warn])
processArgs [Flag (CmdLineP DynFlags)]
activeFlags [Located [Char]]
args) DynFlags
dflags0

  -- See Note [Handling errors when parsing commandline flags]
  let rdr :: SDoc -> [Char]
rdr = SDocContext -> SDoc -> [Char]
renderWithContext (DynFlags -> PprStyle -> SDocContext
initSDocContext DynFlags
dflags0 PprStyle
defaultUserStyle)
  Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless ([Err] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Err]
errs) (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ GhcException -> IO ()
forall a. GhcException -> IO a
throwGhcExceptionIO (GhcException -> IO ()) -> GhcException -> IO ()
forall a b. (a -> b) -> a -> b
$ [([Char], [Char])] -> GhcException
errorsToGhcException ([([Char], [Char])] -> GhcException)
-> [([Char], [Char])] -> GhcException
forall a b. (a -> b) -> a -> b
$
    (Err -> ([Char], [Char])) -> [Err] -> [([Char], [Char])]
forall a b. (a -> b) -> [a] -> [b]
map ((SDoc -> [Char]
rdr (SDoc -> [Char])
-> (Located [Char] -> SDoc) -> Located [Char] -> [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SrcSpan -> SDoc
forall a. Outputable a => a -> SDoc
ppr (SrcSpan -> SDoc)
-> (Located [Char] -> SrcSpan) -> Located [Char] -> SDoc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Located [Char] -> SrcSpan
forall l e. GenLocated l e -> l
getLoc (Located [Char] -> [Char])
-> (Located [Char] -> [Char]) -> Located [Char] -> ([Char], [Char])
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& Located [Char] -> [Char]
forall l e. GenLocated l e -> e
unLoc) (Located [Char] -> ([Char], [Char]))
-> (Err -> Located [Char]) -> Err -> ([Char], [Char])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Err -> Located [Char]
errMsg) ([Err] -> [([Char], [Char])]) -> [Err] -> [([Char], [Char])]
forall a b. (a -> b) -> a -> b
$ [Err]
errs

  -- check for disabled flags in safe haskell
  let (DynFlags
dflags2, [Located [Char]]
sh_warns) = Bool -> DynFlags -> (DynFlags, [Located [Char]])
safeFlagCheck Bool
cmdline DynFlags
dflags1
      theWays :: Ways
theWays = DynFlags -> Ways
ways DynFlags
dflags2

  Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
unless (Ways -> Bool
allowed_combination Ways
theWays) (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$
      GhcException -> IO ()
forall a. GhcException -> IO a
throwGhcExceptionIO ([Char] -> GhcException
CmdLineError ([Char]
"combination not supported: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++
                               [Char] -> [[Char]] -> [Char]
forall a. [a] -> [[a]] -> [a]
intercalate [Char]
"/" ((Way -> [Char]) -> [Way] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Way -> [Char]
wayDesc (Ways -> [Way]
forall a. Set a -> [a]
Set.toAscList Ways
theWays))))

  let dflags3 :: DynFlags
dflags3
        | Just [Char]
outFile <- DynFlags -> Maybe [Char]
outputFile_ DynFlags
dflags2   -- Only iff user specified -o ...
        , Bool -> Bool
not (Maybe [Char] -> Bool
forall a. Maybe a -> Bool
isJust (DynFlags -> Maybe [Char]
dynOutputFile_ DynFlags
dflags2)) -- but not -dyno
        = DynFlags
dflags2 { dynOutputFile_ :: Maybe [Char]
dynOutputFile_ = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just ([Char] -> Maybe [Char]) -> [Char] -> Maybe [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ShowS
dynamicOutputFile DynFlags
dflags2 [Char]
outFile }
        | Bool
otherwise
        = DynFlags
dflags2

  let (DynFlags
dflags4, [Located [Char]]
consistency_warnings) = DynFlags -> (DynFlags, [Located [Char]])
makeDynFlagsConsistent DynFlags
dflags3

  -- Set timer stats & heap size
  Bool -> m () -> m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (DynFlags -> Bool
enableTimeStats DynFlags
dflags4) (m () -> m ()) -> m () -> m ()
forall a b. (a -> b) -> a -> b
$ IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO IO ()
enableTimingStats
  case (DynFlags -> Maybe Int
ghcHeapSize DynFlags
dflags4) of
    Just Int
x -> IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (Int -> IO ()
setHeapSize Int
x)
    Maybe Int
_      -> () -> m ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

  IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ DynFlags -> IO ()
setUnsafeGlobalDynFlags DynFlags
dflags4

  let warns' :: [Warn]
warns' = (Located [Char] -> Warn) -> [Located [Char]] -> [Warn]
forall a b. (a -> b) -> [a] -> [b]
map (WarnReason -> Located [Char] -> Warn
Warn WarnReason
Cmd.NoReason) ([Located [Char]]
consistency_warnings [Located [Char]] -> [Located [Char]] -> [Located [Char]]
forall a. [a] -> [a] -> [a]
++ [Located [Char]]
sh_warns)

  (DynFlags, [Located [Char]], [Warn])
-> m (DynFlags, [Located [Char]], [Warn])
forall (m :: * -> *) a. Monad m => a -> m a
return (DynFlags
dflags4, [Located [Char]]
leftover, [Warn]
warns' [Warn] -> [Warn] -> [Warn]
forall a. [a] -> [a] -> [a]
++ [Warn]
warns)

-- | Check (and potentially disable) any extensions that aren't allowed
-- in safe mode.
--
-- The bool is to indicate if we are parsing command line flags (false means
-- file pragma). This allows us to generate better warnings.
safeFlagCheck :: Bool -> DynFlags -> (DynFlags, [Located String])
safeFlagCheck :: Bool -> DynFlags -> (DynFlags, [Located [Char]])
safeFlagCheck Bool
_ DynFlags
dflags | DynFlags -> Bool
safeLanguageOn DynFlags
dflags = (DynFlags
dflagsUnset, [Located [Char]]
warns)
  where
    -- Handle illegal flags under safe language.
    (DynFlags
dflagsUnset, [Located [Char]]
warns) = ((DynFlags, [Located [Char]])
 -> ([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
     DynFlags -> DynFlags)
 -> (DynFlags, [Located [Char]]))
-> (DynFlags, [Located [Char]])
-> [([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
     DynFlags -> DynFlags)]
-> (DynFlags, [Located [Char]])
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (DynFlags, [Located [Char]])
-> ([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
    DynFlags -> DynFlags)
-> (DynFlags, [Located [Char]])
forall {a} {l}.
(a, [GenLocated l [Char]])
-> ([Char], a -> l, a -> Bool, a -> a)
-> (a, [GenLocated l [Char]])
check_method (DynFlags
dflags, []) [([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
  DynFlags -> DynFlags)]
unsafeFlags

    check_method :: (a, [GenLocated l [Char]])
-> ([Char], a -> l, a -> Bool, a -> a)
-> (a, [GenLocated l [Char]])
check_method (a
df, [GenLocated l [Char]]
warns) ([Char]
str,a -> l
loc,a -> Bool
test,a -> a
fix)
        | a -> Bool
test a
df   = (a -> a
fix a
df, [GenLocated l [Char]]
warns [GenLocated l [Char]]
-> [GenLocated l [Char]] -> [GenLocated l [Char]]
forall a. [a] -> [a] -> [a]
++ l -> [Char] -> [GenLocated l [Char]]
forall {l}. l -> [Char] -> [GenLocated l [Char]]
safeFailure (a -> l
loc a
df) [Char]
str)
        | Bool
otherwise = (a
df, [GenLocated l [Char]]
warns)

    safeFailure :: l -> [Char] -> [GenLocated l [Char]]
safeFailure l
loc [Char]
str
       = [l -> [Char] -> GenLocated l [Char]
forall l e. l -> e -> GenLocated l e
L l
loc ([Char] -> GenLocated l [Char]) -> [Char] -> GenLocated l [Char]
forall a b. (a -> b) -> a -> b
$ [Char]
str [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
" is not allowed in Safe Haskell; ignoring "
           [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
str]

safeFlagCheck Bool
cmdl DynFlags
dflags =
  case DynFlags -> Bool
safeInferOn DynFlags
dflags of
    Bool
True   -> (DynFlags
dflags' { safeInferred :: Bool
safeInferred = Bool
safeFlags }, [Located [Char]]
warn)
    Bool
False  -> (DynFlags
dflags', [Located [Char]]
warn)

  where
    -- dynflags and warn for when -fpackage-trust by itself with no safe
    -- haskell flag
    (DynFlags
dflags', [Located [Char]]
warn)
      | Bool -> Bool
not (DynFlags -> Bool
safeHaskellModeEnabled DynFlags
dflags) Bool -> Bool -> Bool
&& Bool -> Bool
not Bool
cmdl Bool -> Bool -> Bool
&& DynFlags -> Bool
packageTrustOn DynFlags
dflags
      = (DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dflags GeneralFlag
Opt_PackageTrust, [Located [Char]]
pkgWarnMsg)
      | Bool
otherwise = (DynFlags
dflags, [])

    pkgWarnMsg :: [Located [Char]]
pkgWarnMsg = [SrcSpan -> [Char] -> Located [Char]
forall l e. l -> e -> GenLocated l e
L (DynFlags -> SrcSpan
pkgTrustOnLoc DynFlags
dflags') ([Char] -> Located [Char]) -> [Char] -> Located [Char]
forall a b. (a -> b) -> a -> b
$
                    [Char]
"-fpackage-trust ignored;" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++
                    [Char]
" must be specified with a Safe Haskell flag"]

    -- Have we inferred Unsafe? See Note [GHC.Driver.Main . Safe Haskell Inference]
    safeFlags :: Bool
safeFlags = (([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
  DynFlags -> DynFlags)
 -> Bool)
-> [([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
     DynFlags -> DynFlags)]
-> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
all (\([Char]
_,DynFlags -> SrcSpan
_,DynFlags -> Bool
t,DynFlags -> DynFlags
_) -> Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ DynFlags -> Bool
t DynFlags
dflags) [([Char], DynFlags -> SrcSpan, DynFlags -> Bool,
  DynFlags -> DynFlags)]
unsafeFlagsForInfer


{- **********************************************************************
%*                                                                      *
                DynFlags specifications
%*                                                                      *
%********************************************************************* -}

-- | All dynamic flags option strings without the deprecated ones.
-- These are the user facing strings for enabling and disabling options.
allNonDeprecatedFlags :: [String]
allNonDeprecatedFlags :: [[Char]]
allNonDeprecatedFlags = Bool -> [[Char]]
allFlagsDeps Bool
False

-- | All flags with possibility to filter deprecated ones
allFlagsDeps :: Bool -> [String]
allFlagsDeps :: Bool -> [[Char]]
allFlagsDeps Bool
keepDeprecated = [ Char
'-'Char -> ShowS
forall a. a -> [a] -> [a]
:Flag (CmdLineP DynFlags) -> [Char]
forall (m :: * -> *). Flag m -> [Char]
flagName Flag (CmdLineP DynFlags)
flag
                              | (Deprecation
deprecated, Flag (CmdLineP DynFlags)
flag) <- [(Deprecation, Flag (CmdLineP DynFlags))]
flagsAllDeps
                              , Bool
keepDeprecated Bool -> Bool -> Bool
|| Bool -> Bool
not (Deprecation -> Bool
isDeprecated Deprecation
deprecated)]
  where isDeprecated :: Deprecation -> Bool
isDeprecated Deprecation
Deprecated = Bool
True
        isDeprecated Deprecation
_ = Bool
False

{-
 - Below we export user facing symbols for GHC dynamic flags for use with the
 - GHC API.
 -}

-- All dynamic flags present in GHC.
flagsAll :: [Flag (CmdLineP DynFlags)]
flagsAll :: [Flag (CmdLineP DynFlags)]
flagsAll = ((Deprecation, Flag (CmdLineP DynFlags))
 -> Flag (CmdLineP DynFlags))
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [Flag (CmdLineP DynFlags)]
forall a b. (a -> b) -> [a] -> [b]
map (Deprecation, Flag (CmdLineP DynFlags)) -> Flag (CmdLineP DynFlags)
forall a b. (a, b) -> b
snd [(Deprecation, Flag (CmdLineP DynFlags))]
flagsAllDeps

-- All dynamic flags present in GHC with deprecation information.
flagsAllDeps :: [(Deprecation, Flag (CmdLineP DynFlags))]
flagsAllDeps :: [(Deprecation, Flag (CmdLineP DynFlags))]
flagsAllDeps =  [(Deprecation, Flag (CmdLineP DynFlags))]
package_flags_deps [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ [(Deprecation, Flag (CmdLineP DynFlags))]
dynamic_flags_deps


-- All dynamic flags, minus package flags, present in GHC.
flagsDynamic :: [Flag (CmdLineP DynFlags)]
flagsDynamic :: [Flag (CmdLineP DynFlags)]
flagsDynamic = ((Deprecation, Flag (CmdLineP DynFlags))
 -> Flag (CmdLineP DynFlags))
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [Flag (CmdLineP DynFlags)]
forall a b. (a -> b) -> [a] -> [b]
map (Deprecation, Flag (CmdLineP DynFlags)) -> Flag (CmdLineP DynFlags)
forall a b. (a, b) -> b
snd [(Deprecation, Flag (CmdLineP DynFlags))]
dynamic_flags_deps

-- ALl package flags present in GHC.
flagsPackage :: [Flag (CmdLineP DynFlags)]
flagsPackage :: [Flag (CmdLineP DynFlags)]
flagsPackage = ((Deprecation, Flag (CmdLineP DynFlags))
 -> Flag (CmdLineP DynFlags))
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [Flag (CmdLineP DynFlags)]
forall a b. (a -> b) -> [a] -> [b]
map (Deprecation, Flag (CmdLineP DynFlags)) -> Flag (CmdLineP DynFlags)
forall a b. (a, b) -> b
snd [(Deprecation, Flag (CmdLineP DynFlags))]
package_flags_deps

----------------Helpers to make flags and keep deprecation information----------

type FlagMaker m = String -> OptKind m -> Flag m
type DynFlagMaker = FlagMaker (CmdLineP DynFlags)
data Deprecation = NotDeprecated | Deprecated deriving (Deprecation -> Deprecation -> Bool
(Deprecation -> Deprecation -> Bool)
-> (Deprecation -> Deprecation -> Bool) -> Eq Deprecation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Deprecation -> Deprecation -> Bool
$c/= :: Deprecation -> Deprecation -> Bool
== :: Deprecation -> Deprecation -> Bool
$c== :: Deprecation -> Deprecation -> Bool
Eq, Eq Deprecation
Eq Deprecation
-> (Deprecation -> Deprecation -> Ordering)
-> (Deprecation -> Deprecation -> Bool)
-> (Deprecation -> Deprecation -> Bool)
-> (Deprecation -> Deprecation -> Bool)
-> (Deprecation -> Deprecation -> Bool)
-> (Deprecation -> Deprecation -> Deprecation)
-> (Deprecation -> Deprecation -> Deprecation)
-> Ord Deprecation
Deprecation -> Deprecation -> Bool
Deprecation -> Deprecation -> Ordering
Deprecation -> Deprecation -> Deprecation
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Deprecation -> Deprecation -> Deprecation
$cmin :: Deprecation -> Deprecation -> Deprecation
max :: Deprecation -> Deprecation -> Deprecation
$cmax :: Deprecation -> Deprecation -> Deprecation
>= :: Deprecation -> Deprecation -> Bool
$c>= :: Deprecation -> Deprecation -> Bool
> :: Deprecation -> Deprecation -> Bool
$c> :: Deprecation -> Deprecation -> Bool
<= :: Deprecation -> Deprecation -> Bool
$c<= :: Deprecation -> Deprecation -> Bool
< :: Deprecation -> Deprecation -> Bool
$c< :: Deprecation -> Deprecation -> Bool
compare :: Deprecation -> Deprecation -> Ordering
$ccompare :: Deprecation -> Deprecation -> Ordering
Ord)

-- Make a non-deprecated flag
make_ord_flag :: DynFlagMaker -> String -> OptKind (CmdLineP DynFlags)
              -> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag :: DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
fm [Char]
name OptKind (CmdLineP DynFlags)
kind = (Deprecation
NotDeprecated, DynFlagMaker
fm [Char]
name OptKind (CmdLineP DynFlags)
kind)

-- Make a deprecated flag
make_dep_flag :: DynFlagMaker -> String -> OptKind (CmdLineP DynFlags) -> String
                 -> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag :: DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
fm [Char]
name OptKind (CmdLineP DynFlags)
kind [Char]
message = (Deprecation
Deprecated,
                                      DynFlagMaker
fm [Char]
name (OptKind (CmdLineP DynFlags) -> Flag (CmdLineP DynFlags))
-> OptKind (CmdLineP DynFlags) -> Flag (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ OptKind (CmdLineP DynFlags)
-> [Char] -> OptKind (CmdLineP DynFlags)
add_dep_message OptKind (CmdLineP DynFlags)
kind [Char]
message)

add_dep_message :: OptKind (CmdLineP DynFlags) -> String
                -> OptKind (CmdLineP DynFlags)
add_dep_message :: OptKind (CmdLineP DynFlags)
-> [Char] -> OptKind (CmdLineP DynFlags)
add_dep_message (NoArg DynP ()
f) [Char]
message = DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ DynP ()
f DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (HasArg [Char] -> DynP ()
f) [Char]
message = ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
s -> [Char] -> DynP ()
f [Char]
s DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (SepArg [Char] -> DynP ()
f) [Char]
message = ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
SepArg (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
s -> [Char] -> DynP ()
f [Char]
s DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (Prefix [Char] -> DynP ()
f) [Char]
message = ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
Prefix (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
s -> [Char] -> DynP ()
f [Char]
s DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (OptPrefix [Char] -> DynP ()
f) [Char]
message =
                                  ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
OptPrefix (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
s -> [Char] -> DynP ()
f [Char]
s DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (OptIntSuffix Maybe Int -> DynP ()
f) [Char]
message =
                               (Maybe Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Maybe Int -> EwM m ()) -> OptKind m
OptIntSuffix ((Maybe Int -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> (Maybe Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \Maybe Int
oi -> Maybe Int -> DynP ()
f Maybe Int
oi DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (IntSuffix Int -> DynP ()
f) [Char]
message =
                                  (Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Int -> EwM m ()) -> OptKind m
IntSuffix ((Int -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> (Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \Int
i -> Int -> DynP ()
f Int
i DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (WordSuffix Word -> DynP ()
f) [Char]
message =
                                  (Word -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Word -> EwM m ()) -> OptKind m
WordSuffix ((Word -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> (Word -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \Word
i -> Word -> DynP ()
f Word
i DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (FloatSuffix Float -> DynP ()
f) [Char]
message =
                                (Float -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Float -> EwM m ()) -> OptKind m
FloatSuffix ((Float -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> (Float -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \Float
fl -> Float -> DynP ()
f Float
fl DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (PassFlag [Char] -> DynP ()
f) [Char]
message =
                                   ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
PassFlag (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
s -> [Char] -> DynP ()
f [Char]
s DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message
add_dep_message (AnySuffix [Char] -> DynP ()
f) [Char]
message =
                                  ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
AnySuffix (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
s -> [Char] -> DynP ()
f [Char]
s DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
message

----------------------- The main flags themselves ------------------------------
-- See Note [Updating flag description in the User's Guide]
-- See Note [Supporting CLI completion]
dynamic_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
dynamic_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
dynamic_flags_deps = [
    DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"n" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return ())
        [Char]
"The -n flag is deprecated and no longer has any effect"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"cpp"      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (Extension -> DynP ()
setExtensionFlag Extension
LangExt.Cpp))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"F"        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_Pp))
  , (Deprecation
Deprecated, DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"#include"
      (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg (\[Char]
_s ->
         [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate ([Char]
"-#include and INCLUDE pragmas are " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++
                    [Char]
"deprecated: They no longer have any effect"))))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"v"        ((Maybe Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Maybe Int -> EwM m ()) -> OptKind m
OptIntSuffix Maybe Int -> DynP ()
setVerbosity)

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"j"     ((Maybe Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Maybe Int -> EwM m ()) -> OptKind m
OptIntSuffix
        (\Maybe Int
n -> case Maybe Int
n of
                 Just Int
n
                     | Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
0     -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { parMakeCount :: Maybe Int
parMakeCount = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n })
                     | Bool
otherwise -> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
addErr [Char]
"Syntax: -j[n] where n > 0"
                 Maybe Int
Nothing -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { parMakeCount :: Maybe Int
parMakeCount = Maybe Int
forall a. Maybe a
Nothing })))
                 -- When the number of parallel builds
                 -- is omitted, it is the same
                 -- as specifying that the number of
                 -- parallel builds is equal to the
                 -- result of getNumProcessors
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"instantiated-with"   (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
sepArg [Char] -> DynFlags -> DynFlags
setUnitInstantiations)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"this-component-id"   (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
sepArg [Char] -> DynFlags -> DynFlags
setUnitInstanceOf)

    -- RTS options -------------------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"H"           (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg (\[Char]
s -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d ->
          DynFlags
d { ghcHeapSize :: Maybe Int
ghcHeapSize = Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Maybe Int) -> Int -> Maybe Int
forall a b. (a -> b) -> a -> b
$ Integer -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([Char] -> Integer
decodeSize [Char]
s)})))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Rghc-timing" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d ->
                                               DynFlags
d { enableTimeStats :: Bool
enableTimeStats = Bool
True })))

    ------- ways ---------------------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"prof"           (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (Way -> DynP ()
addWayDynP Way
WayProf))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"eventlog"       (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (Way -> DynP ()
addWayDynP Way
WayTracing))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"debug"          (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (Way -> DynP ()
addWayDynP Way
WayDebug))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"threaded"       (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (Way -> DynP ()
addWayDynP Way
WayThreaded))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ticky"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_Ticky DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Way -> DynP ()
addWayDynP Way
WayDebug))

    -- -ticky enables ticky-ticky code generation, and also implies -debug which
    -- is required to get the RTS ticky support.

        ----- Linker --------------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"static"         (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
removeWayDyn)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dynamic"        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (Way -> DynP ()
addWayDynP Way
WayDyn))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"rdynamic" (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ (DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> (DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$
#if defined(linux_HOST_OS)
                              [Char] -> DynFlags -> DynFlags
addOptl [Char]
"-rdynamic"
#elif defined(mingw32_HOST_OS)
                              addOptl "-Wl,--export-all-symbols"
#else
    -- ignored for compat w/ gcc:
                              id
#endif
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"relative-dynlib-paths"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_RelativeDynlibPaths))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"copy-libs-when-linking"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SingleLibFolder))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"pie"            (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_PICExecutable))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-pie"         (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_PICExecutable))

        ------- Specific phases  --------------------------------------------
    -- need to appear before -pgmL to be parsed as LLVM flags.
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmlo"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_lo :: ([Char], [Option])
toolSettings_pgm_lo  = ([Char]
f,[]) }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmlc"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_lc :: ([Char], [Option])
toolSettings_pgm_lc  = ([Char]
f,[]) }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmlm"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_lm :: ([Char], [Option])
toolSettings_pgm_lm  = ([Char]
f,[]) }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmi"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_i :: [Char]
toolSettings_pgm_i   =  [Char]
f }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmL"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_L :: [Char]
toolSettings_pgm_L   = [Char]
f }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmP"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setPgmP)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmF"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_F :: [Char]
toolSettings_pgm_F   = [Char]
f }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmc"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s
         { toolSettings_pgm_c :: [Char]
toolSettings_pgm_c   = [Char]
f
         , -- Don't pass -no-pie with -pgmc
           -- (see #15319)
           toolSettings_ccSupportsNoPie :: Bool
toolSettings_ccSupportsNoPie = Bool
False
         }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmc-supports-no-pie"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ (DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> (DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_ccSupportsNoPie :: Bool
toolSettings_ccSupportsNoPie = Bool
True }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgms"
      (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg (\[Char]
_ -> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
addWarn [Char]
"Object splitting was removed in GHC 8.8"))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgma"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_a :: ([Char], [Option])
toolSettings_pgm_a   = ([Char]
f,[]) }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgml"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_l :: ([Char], [Option])
toolSettings_pgm_l   = ([Char]
f,[]) }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmdll"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_dll :: ([Char], [Option])
toolSettings_pgm_dll = ([Char]
f,[]) }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmwindres"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_windres :: [Char]
toolSettings_pgm_windres = [Char]
f }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmlibtool"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_libtool :: [Char]
toolSettings_pgm_libtool = [Char]
f }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmar"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_ar :: [Char]
toolSettings_pgm_ar = [Char]
f }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmotool"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_otool :: [Char]
toolSettings_pgm_otool = [Char]
f}
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgminstall_name_tool"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_install_name_tool :: [Char]
toolSettings_pgm_install_name_tool = [Char]
f}
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmranlib"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_pgm_ranlib :: [Char]
toolSettings_pgm_ranlib = [Char]
f }


    -- need to appear before -optl/-opta to be parsed as LLVM flags.
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optlm"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_opt_lm :: [[Char]]
toolSettings_opt_lm  = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_lm ToolSettings
s }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optlo"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_opt_lo :: [[Char]]
toolSettings_opt_lo  = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_lo ToolSettings
s }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optlc"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_opt_lc :: [[Char]]
toolSettings_opt_lc  = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_lc ToolSettings
s }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"opti"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_opt_i :: [[Char]]
toolSettings_opt_i   = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_i ToolSettings
s }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optL"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_opt_L :: [[Char]]
toolSettings_opt_L   = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_L ToolSettings
s }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optP"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addOptP)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optF"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_opt_F :: [[Char]]
toolSettings_opt_F   = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_F ToolSettings
s }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optc"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addOptc)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optcxx"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addOptcxx)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"opta"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f -> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_opt_a :: [[Char]]
toolSettings_opt_a   = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_a ToolSettings
s }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optl"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addOptl)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optwindres"
      (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
f ->
        (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ((ToolSettings -> ToolSettings) -> DynFlags -> DynFlags)
-> (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \ToolSettings
s -> ToolSettings
s { toolSettings_opt_windres :: [[Char]]
toolSettings_opt_windres = [Char]
f [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: ToolSettings -> [[Char]]
toolSettings_opt_windres ToolSettings
s }

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"split-objs"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
addWarn [Char]
"ignoring -split-objs")

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"split-sections"
      ((DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
noArgM (\DynFlags
dflags -> do
        if Platform -> Bool
platformHasSubsectionsViaSymbols (DynFlags -> Platform
targetPlatform DynFlags
dflags)
          then do [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
addWarn ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$
                    [Char]
"-split-sections is not useful on this platform " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++
                    [Char]
"since it always uses subsections via symbols. Ignoring."
                  DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return DynFlags
dflags
          else DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return (DynFlags -> GeneralFlag -> DynFlags
gopt_set DynFlags
dflags GeneralFlag
Opt_SplitSections)))

        -------- ghc -M -----------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dep-suffix"              (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addDepSuffix)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dep-makefile"            (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setDepMakefile)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"include-cpp-deps"
        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (Bool -> DynFlags -> DynFlags
setDepIncludeCppDeps Bool
True))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"include-pkg-deps"
        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (Bool -> DynFlags -> DynFlags
setDepIncludePkgDeps Bool
True))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"exclude-module"          (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addDepExcludeMod)

        -------- Linking ----------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-link"
        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { ghcLink :: GhcLink
ghcLink=GhcLink
NoLink }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"shared"
        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { ghcLink :: GhcLink
ghcLink=GhcLink
LinkDynLib }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"staticlib"
        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag' GeneralFlag
Opt_LinkRts (DynFlags
d { ghcLink :: GhcLink
ghcLink=GhcLink
LinkStaticLib })))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dynload"            (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
parseDynLibLoaderMode)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dylib-install-name" (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setDylibInstallName)

        ------- Libraries ---------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"L"   (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
Prefix [Char] -> DynP ()
addLibraryPath)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"l"   (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (Option -> DynFlags -> DynFlags
addLdInputs (Option -> DynFlags -> DynFlags)
-> ([Char] -> Option) -> [Char] -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> Option
Option ([Char] -> Option) -> ShowS -> [Char] -> Option
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Char]
"-l" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++)))

        ------- Frameworks --------------------------------------------------
        -- -framework-path should really be -F ...
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"framework-path" (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
addFrameworkPath)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"framework"      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addCmdlineFramework)

        ------- Output Redirection ------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"odir"              (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setObjectDir)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"o"                 (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
sepArg (Maybe [Char] -> DynFlags -> DynFlags
setOutputFile (Maybe [Char] -> DynFlags -> DynFlags)
-> ([Char] -> Maybe [Char]) -> [Char] -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dyno"
        (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
sepArg (Maybe [Char] -> DynFlags -> DynFlags
setDynOutputFile (Maybe [Char] -> DynFlags -> DynFlags)
-> ([Char] -> Maybe [Char]) -> [Char] -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ohi"
        (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (Maybe [Char] -> DynFlags -> DynFlags
setOutputHi (Maybe [Char] -> DynFlags -> DynFlags)
-> ([Char] -> Maybe [Char]) -> [Char] -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just ))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"osuf"              (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setObjectSuf)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dynosuf"           (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setDynObjectSuf)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"hcsuf"             (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setHcSuf)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"hisuf"             (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setHiSuf)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"hiesuf"            (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setHieSuf)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dynhisuf"          (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setDynHiSuf)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"hidir"             (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setHiDir)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"hiedir"            (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setHieDir)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"tmpdir"            (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setTmpDir)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"stubdir"           (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setStubDir)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dumpdir"           (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setDumpDir)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"outputdir"         (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setOutputDir)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-file-prefix"
        (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (Maybe [Char] -> DynFlags -> DynFlags
setDumpPrefixForce (Maybe [Char] -> DynFlags -> DynFlags)
-> ([Char] -> Maybe [Char]) -> [Char] -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dynamic-too"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_BuildDynamicToo))

        ------- Keeping temporary files -------------------------------------
     -- These can be singular (think ghc -c) or plural (think ghc --make)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-hc-file"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepHcFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-hc-files"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepHcFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-hscpp-file"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepHscppFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-hscpp-files"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepHscppFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-s-file"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepSFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-s-files"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepSFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-llvm-file"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ Backend -> DynP ()
setObjBackend Backend
LLVM DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepLlvmFiles)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-llvm-files"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ Backend -> DynP ()
setObjBackend Backend
LLVM DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepLlvmFiles)
     -- This only makes sense as plural
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-tmp-files"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepTmpFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-hi-file"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepHiFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-keep-hi-file"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_KeepHiFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-hi-files"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepHiFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-keep-hi-files"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_KeepHiFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-o-file"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepOFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-keep-o-file"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_KeepOFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"keep-o-files"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepOFiles))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-keep-o-files"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_KeepOFiles))

        ------- Miscellaneous ----------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-auto-link-packages"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_AutoLinkPackages))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-hs-main"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_NoHsMain))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fno-state-hack"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_G_NoStateHack))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fno-opt-coercion"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_G_NoOptCoercion))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"with-rtsopts"
        (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
setRtsOpts)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"rtsopts"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (RtsOptsEnabled -> DynP ()
setRtsOptsEnabled RtsOptsEnabled
RtsOptsAll))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"rtsopts=all"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (RtsOptsEnabled -> DynP ()
setRtsOptsEnabled RtsOptsEnabled
RtsOptsAll))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"rtsopts=some"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (RtsOptsEnabled -> DynP ()
setRtsOptsEnabled RtsOptsEnabled
RtsOptsSafeOnly))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"rtsopts=none"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (RtsOptsEnabled -> DynP ()
setRtsOptsEnabled RtsOptsEnabled
RtsOptsNone))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"rtsopts=ignore"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (RtsOptsEnabled -> DynP ()
setRtsOptsEnabled RtsOptsEnabled
RtsOptsIgnore))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"rtsopts=ignoreAll"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (RtsOptsEnabled -> DynP ()
setRtsOptsEnabled RtsOptsEnabled
RtsOptsIgnoreAll))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-rtsopts"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (RtsOptsEnabled -> DynP ()
setRtsOptsEnabled RtsOptsEnabled
RtsOptsNone))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-rtsopts-suggestions"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d {rtsOptsSuggestions :: Bool
rtsOptsSuggestions = Bool
False}))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dhex-word-literals"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_HexWordLiterals))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ghcversion-file"      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addGhcVersionFile)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"main-is"              (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
SepArg [Char] -> DynP ()
setMainIs)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"haddock"              (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_Haddock))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-haddock"           (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_Haddock))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"haddock-opts"         (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addHaddockOpts)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"hpcdir"               (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
SepArg [Char] -> DynP ()
setOptHpcDir)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhciFlag [Char]
"ghci-script"         (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addGhciScript)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhciFlag [Char]
"interactive-print"   (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setInteractivePrint)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ticky-allocd"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_Ticky_Allocd))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ticky-LNE"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_Ticky_LNE))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ticky-dyn-thunk"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_Ticky_Dyn_Thunk))
        ------- recompilation checker --------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"recomp"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_ForceRecomp)
             [Char]
"Use -fno-force-recomp instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-recomp"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_ForceRecomp) [Char]
"Use -fforce-recomp instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-errors"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxErrors :: Maybe Int
maxErrors = Int -> Maybe Int
forall a. a -> Maybe a
Just (Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
1 Int
n) }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-max-errors"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { maxErrors :: Maybe Int
maxErrors = Maybe Int
forall a. Maybe a
Nothing }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"freverse-errors"
        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d {reverseErrors :: Bool
reverseErrors = Bool
True} ))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-reverse-errors"
        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d {reverseErrors :: Bool
reverseErrors = Bool
False} ))

        ------ HsCpp opts ---------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"D"              (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
AnySuffix ((DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> ([Char] -> DynFlags -> DynFlags) -> [Char] -> DynP ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> DynFlags -> DynFlags
addOptP))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"U"              (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
AnySuffix ((DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> ([Char] -> DynFlags -> DynFlags) -> [Char] -> DynP ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> DynFlags -> DynFlags
addOptP))

        ------- Include/Import Paths ----------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"I"              (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
Prefix    [Char] -> DynP ()
addIncludePath)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"i"              (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
OptPrefix [Char] -> DynP ()
addImportPath)

        ------ Output style options -----------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"dppr-user-length" ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d ->
                                                       DynFlags
d { pprUserLength :: Int
pprUserLength = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"dppr-cols"        ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d ->
                                                             DynFlags
d { pprCols :: Int
pprCols = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fdiagnostics-color=auto"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { useColor :: OverridingBool
useColor = OverridingBool
Auto })))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fdiagnostics-color=always"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { useColor :: OverridingBool
useColor = OverridingBool
Always })))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fdiagnostics-color=never"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { useColor :: OverridingBool
useColor = OverridingBool
Never })))

  -- Suppress all that is suppressable in core dumps.
  -- Except for uniques, as some simplifier phases introduce new variables that
  -- have otherwise identical names.
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dsuppress-all"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ do GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressCoercions
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressVarKinds
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressModulePrefixes
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressTypeApplications
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressIdInfo
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressTicks
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressStgExts
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressTypeSignatures
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressTimestamps)

        ------ Debugging ----------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dstg-stats"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_StgStats))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-from-stg"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_from_stg)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-raw"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_raw)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-verbose"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_verbose)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-verbose-by-proc"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_verbose_by_proc)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-cfg"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_cfg)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-cbe"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_cbe)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-switch"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_switch)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-proc"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_proc)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-sp"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_sp)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-sink"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_sink)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-caf"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_caf)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-procmap"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_procmap)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-split"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_split)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-info"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_info)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-cps"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_cps)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cmm-opt"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_opt_cmm)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cfg-weights"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cfg_weights)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-core-stats"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_core_stats)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-asm"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_asm)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-asm-native"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_asm_native)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-asm-liveness"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_asm_liveness)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-asm-regalloc"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_asm_regalloc)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-asm-conflicts"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_asm_conflicts)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-asm-regalloc-stages"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_asm_regalloc_stages)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-asm-stats"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_asm_stats)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-asm-expanded"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_asm_expanded)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-llvm"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ Backend -> DynP ()
setObjBackend Backend
LLVM DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> DumpFlag -> DynP ()
setDumpFlag' DumpFlag
Opt_D_dump_llvm)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-c-backend"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ DumpFlag -> DynP ()
setDumpFlag' DumpFlag
Opt_D_dump_c_backend)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-deriv"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_deriv)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-ds"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_ds)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-ds-preopt"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_ds_preopt)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-foreign"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_foreign)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-inlinings"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_inlinings)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-rule-firings"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_rule_firings)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-rule-rewrites"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_rule_rewrites)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-simpl-trace"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_simpl_trace)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-occur-anal"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_occur_anal)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-parsed"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_parsed)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-parsed-ast"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_parsed_ast)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-rn"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_rn)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-rn-ast"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_rn_ast)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-simpl"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_simpl)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-simpl-iterations"
      (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_simpl_iterations)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-spec"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_spec)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-prep"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_prep)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-stg-from-core"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_stg_from_core)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-stg-unarised"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_stg_unarised)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-stg-final"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_stg_final)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-stg"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_stg_from_core)
        [Char]
"Use `-ddump-stg-from-core` or `-ddump-stg-final` instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-call-arity"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_call_arity)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-exitify"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_exitify)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-stranal"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_stranal)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-str-signatures"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_str_signatures)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cpranal"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cpranal)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cpr-signatures"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cpr_signatures)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-tc"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_tc)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-tc-ast"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_tc_ast)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-hie"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_hie)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-types"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_types)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-rules"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_rules)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cse"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cse)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-worker-wrapper"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_worker_wrapper)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-rn-trace"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_rn_trace)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-if-trace"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_if_trace)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-cs-trace"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cs_trace)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-tc-trace"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (do DumpFlag -> DynP ()
setDumpFlag' DumpFlag
Opt_D_dump_tc_trace
                   DumpFlag -> DynP ()
setDumpFlag' DumpFlag
Opt_D_dump_cs_trace))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-ec-trace"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_ec_trace)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-vt-trace"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_vt_trace)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-splices"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_splices)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dth-dec-file"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_th_dec_file)

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-rn-stats"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_rn_stats)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-opt-cmm" --old alias for cmm-opt
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_opt_cmm)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-simpl-stats"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_simpl_stats)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-bcos"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_BCOs)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dsource-stats"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_source_stats)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dverbose-core2core"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ Maybe Int -> DynP ()
setVerbosity (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
2) DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> DynP ()
setVerboseCore2Core)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dverbose-stg2stg"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_verbose_stg2stg)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-hi"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_hi)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-minimal-imports"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_D_dump_minimal_imports))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-hpc"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_ticked) -- back compat
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-ticked"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_ticked)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-mod-cycles"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_mod_cycles)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-mod-map"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_mod_map)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-timings"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_timings)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-view-pattern-commoning"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_view_pattern_commoning)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-to-file"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DumpToFile))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-hi-diffs"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_hi_diffs)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-rtti"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_rtti)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dcore-lint"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DoCoreLinting))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dlinear-core-lint"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DoLinearCoreLinting))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dstg-lint"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DoStgLinting))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dcmm-lint"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DoCmmLinting))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dasm-lint"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DoAsmLinting))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dannot-lint"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DoAnnotationLinting))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dshow-passes"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ DynP ()
forceRecompile DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> (Maybe Int -> DynP ()
setVerbosity (Maybe Int -> DynP ()) -> Maybe Int -> DynP ()
forall a b. (a -> b) -> a -> b
$ Int -> Maybe Int
forall a. a -> Maybe a
Just Int
2))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dfaststring-stats"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_D_faststring_stats))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dno-llvm-mangler"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_NoLlvmMangler)) -- hidden flag
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dno-typeable-binds"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_NoTypeableBinds))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-debug"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_debug)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-json"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_json )
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dppr-debug"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_ppr_debug)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddebug-output"
        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg ((DynFlags -> DumpFlag -> DynFlags)
-> DumpFlag -> DynFlags -> DynFlags
forall a b c. (a -> b -> c) -> b -> a -> c
flip DynFlags -> DumpFlag -> DynFlags
dopt_unset DumpFlag
Opt_D_no_debug_output))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dno-debug-output"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_no_debug_output)

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-faststrings"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_faststrings)

        ------ Machine dependent (-m<blah>) stuff ---------------------------

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"msse"         ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                  DynFlags
d { sseVersion :: Maybe SseVersion
sseVersion = SseVersion -> Maybe SseVersion
forall a. a -> Maybe a
Just SseVersion
SSE1 }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"msse2"        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                  DynFlags
d { sseVersion :: Maybe SseVersion
sseVersion = SseVersion -> Maybe SseVersion
forall a. a -> Maybe a
Just SseVersion
SSE2 }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"msse3"        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                  DynFlags
d { sseVersion :: Maybe SseVersion
sseVersion = SseVersion -> Maybe SseVersion
forall a. a -> Maybe a
Just SseVersion
SSE3 }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"msse4"        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                  DynFlags
d { sseVersion :: Maybe SseVersion
sseVersion = SseVersion -> Maybe SseVersion
forall a. a -> Maybe a
Just SseVersion
SSE4 }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"msse4.2"      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                 DynFlags
d { sseVersion :: Maybe SseVersion
sseVersion = SseVersion -> Maybe SseVersion
forall a. a -> Maybe a
Just SseVersion
SSE42 }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"mbmi"         ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                 DynFlags
d { bmiVersion :: Maybe BmiVersion
bmiVersion = BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI1 }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"mbmi2"        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                 DynFlags
d { bmiVersion :: Maybe BmiVersion
bmiVersion = BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI2 }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"mavx"         ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { avx :: Bool
avx = Bool
True }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"mavx2"        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { avx2 :: Bool
avx2 = Bool
True }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"mavx512cd"    ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                         DynFlags
d { avx512cd :: Bool
avx512cd = Bool
True }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"mavx512er"    ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                         DynFlags
d { avx512er :: Bool
avx512er = Bool
True }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"mavx512f"     ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { avx512f :: Bool
avx512f = Bool
True }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"mavx512pf"    ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                         DynFlags
d { avx512pf :: Bool
avx512pf = Bool
True }))

     ------ Warning opts -------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"W"       (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
setWarningFlag [WarningFlag]
minusWOpts))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Werror"
               (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (do { GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_WarnIsError
                          ; (WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
setFatalWarningFlag [WarningFlag]
minusWeverythingOpts   }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wwarn"
               (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (do { GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_WarnIsError
                          ; (WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
unSetFatalWarningFlag [WarningFlag]
minusWeverythingOpts }))
                          -- Opt_WarnIsError is still needed to pass -Werror
                          -- to CPP; see runCpp in SysTools
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wnot"    (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d ->
                                              DynFlags
d {warningFlags :: EnumSet WarningFlag
warningFlags = EnumSet WarningFlag
forall a. EnumSet a
EnumSet.empty})))
                                             [Char]
"Use -w or -Wno-everything instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"w"       (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d ->
                                              DynFlags
d {warningFlags :: EnumSet WarningFlag
warningFlags = EnumSet WarningFlag
forall a. EnumSet a
EnumSet.empty})))

     -- New-style uniform warning sets
     --
     -- Note that -Weverything > -Wall > -Wextra > -Wdefault > -Wno-everything
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Weverything"    (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
                                           WarningFlag -> DynP ()
setWarningFlag [WarningFlag]
minusWeverythingOpts))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wno-everything"
                           (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d {warningFlags :: EnumSet WarningFlag
warningFlags = EnumSet WarningFlag
forall a. EnumSet a
EnumSet.empty})))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wall"           (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
                                                  WarningFlag -> DynP ()
setWarningFlag [WarningFlag]
minusWallOpts))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wno-all"        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
                                                WarningFlag -> DynP ()
unSetWarningFlag [WarningFlag]
minusWallOpts))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wextra"         (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
                                                     WarningFlag -> DynP ()
setWarningFlag [WarningFlag]
minusWOpts))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wno-extra"      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
                                                   WarningFlag -> DynP ()
unSetWarningFlag [WarningFlag]
minusWOpts))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wdefault"       (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
                                               WarningFlag -> DynP ()
setWarningFlag [WarningFlag]
standardWarnings))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wno-default"    (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
                                             WarningFlag -> DynP ()
unSetWarningFlag [WarningFlag]
standardWarnings))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wcompat"        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
                                               WarningFlag -> DynP ()
setWarningFlag [WarningFlag]
minusWcompatOpts))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wno-compat"     (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_
                                             WarningFlag -> DynP ()
unSetWarningFlag [WarningFlag]
minusWcompatOpts))

        ------ Plugin flags ------------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fplugin-opt" (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addPluginModuleNameOption)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fplugin-trustworthy"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_PluginTrustworthy))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fplugin"     (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addPluginModuleName)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fclear-plugins" ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg DynFlags -> DynFlags
clearPluginModuleNames)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ffrontend-opt" (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addFrontendPluginOption)

        ------ Optimisation flags ------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"Onot"   ((DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
noArgM ((DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags))
-> (DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ Int -> DynFlags -> DynP DynFlags
setOptLevel Int
0 )
                                                            [Char]
"Use -O0 instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"O"      ((Maybe Int -> DynFlags -> DynP DynFlags)
-> OptKind (CmdLineP DynFlags)
optIntSuffixM (\Maybe Int
mb_n ->
                                                Int -> DynFlags -> DynP DynFlags
setOptLevel (Maybe Int
mb_n Maybe Int -> Int -> Int
forall a. Maybe a -> a -> a
`orElse` Int
1)))
                -- If the number is missing, use 1

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fbinary-blob-threshold"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { binBlobThreshold :: Word
binBlobThreshold = Int -> Word
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n }))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-relevant-binds"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxRelevantBinds :: Maybe Int
maxRelevantBinds = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-max-relevant-binds"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { maxRelevantBinds :: Maybe Int
maxRelevantBinds = Maybe Int
forall a. Maybe a
Nothing }))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-valid-hole-fits"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxValidHoleFits :: Maybe Int
maxValidHoleFits = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-max-valid-hole-fits"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { maxValidHoleFits :: Maybe Int
maxValidHoleFits = Maybe Int
forall a. Maybe a
Nothing }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-refinement-hole-fits"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxRefHoleFits :: Maybe Int
maxRefHoleFits = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-max-refinement-hole-fits"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { maxRefHoleFits :: Maybe Int
maxRefHoleFits = Maybe Int
forall a. Maybe a
Nothing }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"frefinement-level-hole-fits"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { refLevelHoleFits :: Maybe Int
refLevelHoleFits = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-refinement-level-hole-fits"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { refLevelHoleFits :: Maybe Int
refLevelHoleFits = Maybe Int
forall a. Maybe a
Nothing }))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fllvm-pass-vectors-in-regs"
            ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg DynFlags -> DynFlags
forall a. a -> a
id)
            [Char]
"vectors registers are now passed in registers by default."
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-uncovered-patterns"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxUncoveredPatterns :: Int
maxUncoveredPatterns = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-pmcheck-models"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxPmCheckModels :: Int
maxPmCheckModels = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fsimplifier-phases"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { simplPhases :: Int
simplPhases = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-simplifier-iterations"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxSimplIterations :: Int
maxSimplIterations = Int
n }))
  , (Deprecation
Deprecated, DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-pmcheck-iterations"
      ((Int -> DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffixM (\Int
_ DynFlags
d ->
       do { [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"use -fmax-pmcheck-models instead"
          ; DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return DynFlags
d })))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fsimpl-tick-factor"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { simplTickFactor :: Int
simplTickFactor = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fspec-constr-threshold"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { specConstrThreshold :: Maybe Int
specConstrThreshold = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-spec-constr-threshold"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { specConstrThreshold :: Maybe Int
specConstrThreshold = Maybe Int
forall a. Maybe a
Nothing }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fspec-constr-count"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { specConstrCount :: Maybe Int
specConstrCount = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-spec-constr-count"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { specConstrCount :: Maybe Int
specConstrCount = Maybe Int
forall a. Maybe a
Nothing }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fspec-constr-recursive"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { specConstrRecursive :: Int
specConstrRecursive = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fliberate-case-threshold"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { liberateCaseThreshold :: Maybe Int
liberateCaseThreshold = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-liberate-case-threshold"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { liberateCaseThreshold :: Maybe Int
liberateCaseThreshold = Maybe Int
forall a. Maybe a
Nothing }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"drule-check"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
sepArg (\[Char]
s DynFlags
d -> DynFlags
d { ruleCheck :: Maybe [Char]
ruleCheck = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
s }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"dinline-check"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
sepArg (\[Char]
s DynFlags
d -> DynFlags
d { inlineCheck :: Maybe [Char]
inlineCheck = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
s }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"freduction-depth"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { reductionDepth :: IntWithInf
reductionDepth = Int -> IntWithInf
treatZeroAsInf Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fconstraint-solver-iterations"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { solverIterations :: IntWithInf
solverIterations = Int -> IntWithInf
treatZeroAsInf Int
n }))
  , (Deprecation
Deprecated, DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fcontext-stack"
      ((Int -> DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffixM (\Int
n DynFlags
d ->
       do { [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"use -freduction-depth=" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> [Char]
forall a. Show a => a -> [Char]
show Int
n [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
" instead"
          ; DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return (DynFlags -> DynP DynFlags) -> DynFlags -> DynP DynFlags
forall a b. (a -> b) -> a -> b
$ DynFlags
d { reductionDepth :: IntWithInf
reductionDepth = Int -> IntWithInf
treatZeroAsInf Int
n } })))
  , (Deprecation
Deprecated, DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"ftype-function-depth"
      ((Int -> DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffixM (\Int
n DynFlags
d ->
       do { [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"use -freduction-depth=" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> [Char]
forall a. Show a => a -> [Char]
show Int
n [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
" instead"
          ; DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return (DynFlags -> DynP DynFlags) -> DynFlags -> DynP DynFlags
forall a b. (a -> b) -> a -> b
$ DynFlags
d { reductionDepth :: IntWithInf
reductionDepth = Int -> IntWithInf
treatZeroAsInf Int
n } })))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fstrictness-before"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { strictnessBefore :: [Int]
strictnessBefore = Int
n Int -> [Int] -> [Int]
forall a. a -> [a] -> [a]
: DynFlags -> [Int]
strictnessBefore DynFlags
d }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"ffloat-lam-args"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { floatLamArgs :: Maybe Int
floatLamArgs = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"ffloat-all-lams"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { floatLamArgs :: Maybe Int
floatLamArgs = Maybe Int
forall a. Maybe a
Nothing }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fstg-lift-lams-rec-args"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { liftLamsRecArgs :: Maybe Int
liftLamsRecArgs = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fstg-lift-lams-rec-args-any"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { liftLamsRecArgs :: Maybe Int
liftLamsRecArgs = Maybe Int
forall a. Maybe a
Nothing }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fstg-lift-lams-non-rec-args"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { liftLamsNonRecArgs :: Maybe Int
liftLamsNonRecArgs = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fstg-lift-lams-non-rec-args-any"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { liftLamsNonRecArgs :: Maybe Int
liftLamsNonRecArgs = Maybe Int
forall a. Maybe a
Nothing }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fstg-lift-lams-known"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { liftLamsKnown :: Bool
liftLamsKnown = Bool
True }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-stg-lift-lams-known"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { liftLamsKnown :: Bool
liftLamsKnown = Bool
False }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fproc-alignment"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { cmmProcAlignment :: Maybe Int
cmmProcAlignment = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fblock-layout-weights"
        (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg (\[Char]
s ->
            (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { cfgWeights :: Weights
cfgWeights =
                [Char] -> Weights -> Weights
parseWeights [Char]
s (DynFlags -> Weights
cfgWeights DynFlags
d)})))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fhistory-size"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { historySize :: Int
historySize = Int
n }))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"funfolding-creation-threshold"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix   (\Int
n DynFlags
d -> DynFlags
d { unfoldingOpts :: UnfoldingOpts
unfoldingOpts = Int -> UnfoldingOpts -> UnfoldingOpts
updateCreationThreshold Int
n (DynFlags -> UnfoldingOpts
unfoldingOpts DynFlags
d)}))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"funfolding-use-threshold"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix   (\Int
n DynFlags
d -> DynFlags
d { unfoldingOpts :: UnfoldingOpts
unfoldingOpts = Int -> UnfoldingOpts -> UnfoldingOpts
updateUseThreshold Int
n (DynFlags -> UnfoldingOpts
unfoldingOpts DynFlags
d)}))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"funfolding-fun-discount"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix   (\Int
n DynFlags
d -> DynFlags
d { unfoldingOpts :: UnfoldingOpts
unfoldingOpts = Int -> UnfoldingOpts -> UnfoldingOpts
updateFunAppDiscount Int
n (DynFlags -> UnfoldingOpts
unfoldingOpts DynFlags
d)}))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"funfolding-dict-discount"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix   (\Int
n DynFlags
d -> DynFlags
d { unfoldingOpts :: UnfoldingOpts
unfoldingOpts = Int -> UnfoldingOpts -> UnfoldingOpts
updateDictDiscount Int
n (DynFlags -> UnfoldingOpts
unfoldingOpts DynFlags
d)}))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"funfolding-case-threshold"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix   (\Int
n DynFlags
d -> DynFlags
d { unfoldingOpts :: UnfoldingOpts
unfoldingOpts = Int -> UnfoldingOpts -> UnfoldingOpts
updateCaseThreshold Int
n (DynFlags -> UnfoldingOpts
unfoldingOpts DynFlags
d)}))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"funfolding-case-scaling"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix   (\Int
n DynFlags
d -> DynFlags
d { unfoldingOpts :: UnfoldingOpts
unfoldingOpts = Int -> UnfoldingOpts -> UnfoldingOpts
updateCaseScaling Int
n (DynFlags -> UnfoldingOpts
unfoldingOpts DynFlags
d)}))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"funfolding-keeness-factor"
      ((Float -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
floatSuffix (\Float
_ DynFlags
d -> DynFlags
d))
      [Char]
"-funfolding-keeness-factor is no longer respected as of GHC 9.0"

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-worker-args"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d {maxWorkerArgs :: Int
maxWorkerArgs = Int
n}))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhciFlag [Char]
"fghci-hist-size"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d {ghciHistSize :: Int
ghciHistSize = Int
n}))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fmax-inline-alloc-size"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxInlineAllocSize :: Int
maxInlineAllocSize = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fmax-inline-memcpy-insns"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxInlineMemcpyInsns :: Int
maxInlineMemcpyInsns = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fmax-inline-memset-insns"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { maxInlineMemsetInsns :: Int
maxInlineMemsetInsns = Int
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dinitial-unique"
      ((Word -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
wordSuffix (\Word
n DynFlags
d -> DynFlags
d { initialUnique :: Word
initialUnique = Word
n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dunique-increment"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { uniqueIncrement :: Int
uniqueIncrement = Int
n }))

        ------ Profiling ----------------------------------------------------

        -- OLD profiling flags
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"auto-all"
                    ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { profAuto :: ProfAuto
profAuto = ProfAuto
ProfAutoAll } ))
                    [Char]
"Use -fprof-auto instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-auto-all"
                    ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { profAuto :: ProfAuto
profAuto = ProfAuto
NoProfAuto } ))
                    [Char]
"Use -fno-prof-auto instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"auto"
                    ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { profAuto :: ProfAuto
profAuto = ProfAuto
ProfAutoExports } ))
                    [Char]
"Use -fprof-auto-exported instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-auto"
            ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { profAuto :: ProfAuto
profAuto = ProfAuto
NoProfAuto } ))
                    [Char]
"Use -fno-prof-auto instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"caf-all"
            (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_AutoSccsOnIndividualCafs))
                    [Char]
"Use -fprof-cafs instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"no-caf-all"
            (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_AutoSccsOnIndividualCafs))
                    [Char]
"Use -fno-prof-cafs instead"

        -- NEW profiling flags
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fprof-auto"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { profAuto :: ProfAuto
profAuto = ProfAuto
ProfAutoAll } ))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fprof-auto-top"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { profAuto :: ProfAuto
profAuto = ProfAuto
ProfAutoTop } ))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fprof-auto-exported"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { profAuto :: ProfAuto
profAuto = ProfAuto
ProfAutoExports } ))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fprof-auto-calls"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { profAuto :: ProfAuto
profAuto = ProfAuto
ProfAutoCalls } ))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fno-prof-auto"
      ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { profAuto :: ProfAuto
profAuto = ProfAuto
NoProfAuto } ))

        -- Caller-CC
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fprof-callers"
         (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
setCallerCcFilters)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fdistinct-constructor-tables"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DistinctConstructorTables))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"finfo-table-map"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_InfoTableMap))
        ------ Compiler flags -----------------------------------------------

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fasm"             (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (Backend -> DynP ()
setObjBackend Backend
NCG))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fvia-c"           (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg
         ([Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"The -fvia-c flag does nothing; " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++
                      [Char]
"it will be removed in a future GHC release"))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fvia-C"           (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg
         ([Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"The -fvia-C flag does nothing; " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++
                      [Char]
"it will be removed in a future GHC release"))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fllvm"            (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (Backend -> DynP ()
setObjBackend Backend
LLVM))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-code"         (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (((DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
d ->
                  DynFlags
d { ghcLink :: GhcLink
ghcLink=GhcLink
NoLink }) DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Backend -> DynP ()
setBackend Backend
NoBackend))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fbyte-code"
      ((DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
noArgM ((DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags))
-> (DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \DynFlags
dflags -> do
        Backend -> DynP ()
setBackend Backend
Interpreter
        DynFlags -> DynP DynFlags
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DynFlags -> DynP DynFlags) -> DynFlags -> DynP DynFlags
forall a b. (a -> b) -> a -> b
$ DynFlags -> GeneralFlag -> DynFlags
gopt_set DynFlags
dflags GeneralFlag
Opt_ByteCode)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fobject-code"     (OptKind (CmdLineP DynFlags)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall a b. (a -> b) -> a -> b
$ DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DynP () -> OptKind (CmdLineP DynFlags))
-> DynP () -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ do
      DynFlags
dflags <- CmdLineP DynFlags DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => m a -> EwM m a
liftEwM CmdLineP DynFlags DynFlags
forall s. CmdLineP s s
getCmdLineState
      Backend -> DynP ()
setBackend (Backend -> DynP ()) -> Backend -> DynP ()
forall a b. (a -> b) -> a -> b
$ Platform -> Backend
platformDefaultBackend (DynFlags -> Platform
targetPlatform DynFlags
dflags)

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fglasgow-exts"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
enableGlasgowExts) [Char]
"Use individual extensions instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-glasgow-exts"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
disableGlasgowExts) [Char]
"Use individual extensions instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wunused-binds" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
enableUnusedBinds)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wno-unused-binds" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
disableUnusedBinds)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defHiddenFlag [Char]
"fwarn-unused-binds" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
enableUnusedBinds)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defHiddenFlag [Char]
"fno-warn-unused-binds" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg
                                                            DynP ()
disableUnusedBinds)

        ------ Safe Haskell flags -------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fpackage-trust"   (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
setPackageTrust)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-safe-infer"   ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d ->
                                                    DynFlags
d { safeInfer :: Bool
safeInfer = Bool
False }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fno-safe-haskell" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (SafeHaskellMode -> DynP ()
setSafeHaskell SafeHaskellMode
Sf_Ignore))

        ------ position independent flags  ----------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fPIC"          (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_PIC))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fno-PIC"       (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_PIC))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fPIE"          (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_PIE))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fno-PIE"       (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_PIE))

         ------ Debugging flags ----------------------------------------------
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"g"             ((Maybe Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Maybe Int -> EwM m ()) -> OptKind m
OptIntSuffix Maybe Int -> DynP ()
setDebugLevel)
 ]
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec GeneralFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec GeneralFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
""          GeneralFlag -> DynP ()
setGeneralFlag    ) [(Deprecation, FlagSpec GeneralFlag)]
negatableFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec GeneralFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec GeneralFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOff [Char]
"no-"       GeneralFlag -> DynP ()
unSetGeneralFlag  ) [(Deprecation, FlagSpec GeneralFlag)]
negatableFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec GeneralFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec GeneralFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"d"         GeneralFlag -> DynP ()
setGeneralFlag    ) [(Deprecation, FlagSpec GeneralFlag)]
dFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec GeneralFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec GeneralFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOff [Char]
"dno-"      GeneralFlag -> DynP ()
unSetGeneralFlag  ) [(Deprecation, FlagSpec GeneralFlag)]
dFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec GeneralFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec GeneralFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"f"         GeneralFlag -> DynP ()
setGeneralFlag    ) [(Deprecation, FlagSpec GeneralFlag)]
fFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec GeneralFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec GeneralFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOff [Char]
"fno-"      GeneralFlag -> DynP ()
unSetGeneralFlag  ) [(Deprecation, FlagSpec GeneralFlag)]
fFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (WarningFlag -> DynP ())
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"W"         WarningFlag -> DynP ()
setWarningFlag    ) [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (WarningFlag -> DynP ())
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOff [Char]
"Wno-"      WarningFlag -> DynP ()
unSetWarningFlag  ) [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (WarningFlag -> DynP ())
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"Werror="   WarningFlag -> DynP ()
setWErrorFlag )     [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (WarningFlag -> DynP ())
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"Wwarn="     WarningFlag -> DynP ()
unSetFatalWarningFlag )
                                                        [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (WarningFlag -> DynP ())
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"Wno-error=" WarningFlag -> DynP ()
unSetFatalWarningFlag )
                                                        [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (WarningFlag -> DynP ())
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"fwarn-"    WarningFlag -> DynP ()
setWarningFlag   ((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> ((Deprecation, FlagSpec WarningFlag)
    -> (Deprecation, FlagSpec WarningFlag))
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, FlagSpec WarningFlag)
forall a. (Deprecation, FlagSpec a) -> (Deprecation, FlagSpec a)
hideFlag)
    [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (WarningFlag -> DynP ())
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOff [Char]
"fno-warn-" WarningFlag -> DynP ()
unSetWarningFlag ((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> ((Deprecation, FlagSpec WarningFlag)
    -> (Deprecation, FlagSpec WarningFlag))
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, FlagSpec WarningFlag)
forall a. (Deprecation, FlagSpec a) -> (Deprecation, FlagSpec a)
hideFlag)
    [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ [ (Deprecation
NotDeprecated, [Char] -> Flag (CmdLineP DynFlags)
unrecognisedWarning [Char]
"W"),
      (Deprecation
Deprecated,    [Char] -> Flag (CmdLineP DynFlags)
unrecognisedWarning [Char]
"fwarn-"),
      (Deprecation
Deprecated,    [Char] -> Flag (CmdLineP DynFlags)
unrecognisedWarning [Char]
"fno-warn-") ]
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ [ DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Werror=compat"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
setWErrorFlag [WarningFlag]
minusWcompatOpts))
    , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wno-error=compat"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
unSetFatalWarningFlag [WarningFlag]
minusWcompatOpts))
    , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"Wwarn=compat"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
unSetFatalWarningFlag [WarningFlag]
minusWcompatOpts)) ]
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec Extension)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec Extension)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (Extension -> DynP ())
-> (Deprecation, FlagSpec Extension)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"f"         Extension -> DynP ()
setExtensionFlag  ) [(Deprecation, FlagSpec Extension)]
fLangFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec Extension)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec Extension)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (Extension -> DynP ())
-> (Deprecation, FlagSpec Extension)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOff [Char]
"fno-"      Extension -> DynP ()
unSetExtensionFlag) [(Deprecation, FlagSpec Extension)]
fLangFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec Extension)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec Extension)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (Extension -> DynP ())
-> (Deprecation, FlagSpec Extension)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"X"         Extension -> DynP ()
setExtensionFlag  ) [(Deprecation, FlagSpec Extension)]
xFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec Extension)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec Extension)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (Extension -> DynP ())
-> (Deprecation, FlagSpec Extension)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOff [Char]
"XNo"       Extension -> DynP ()
unSetExtensionFlag) [(Deprecation, FlagSpec Extension)]
xFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec Language)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec Language)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (Language -> DynP ())
-> (Deprecation, FlagSpec Language)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"X"         Language -> DynP ()
setLanguage       ) [(Deprecation, FlagSpec Language)]
languageFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec SafeHaskellMode)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec SafeHaskellMode)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (Bool
-> [Char]
-> (SafeHaskellMode -> DynP ())
-> (Deprecation, FlagSpec SafeHaskellMode)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turnOn  [Char]
"X"         SafeHaskellMode -> DynP ()
setSafeHaskell    ) [(Deprecation, FlagSpec SafeHaskellMode)]
safeHaskellFlagsDeps

-- | This is where we handle unrecognised warning flags. We only issue a warning
-- if -Wunrecognised-warning-flags is set. See #11429 for context.
unrecognisedWarning :: String -> Flag (CmdLineP DynFlags)
unrecognisedWarning :: [Char] -> Flag (CmdLineP DynFlags)
unrecognisedWarning [Char]
prefix = DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defHiddenFlag [Char]
prefix (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
Prefix [Char] -> DynP ()
action)
  where
    action :: String -> EwM (CmdLineP DynFlags) ()
    action :: [Char] -> DynP ()
action [Char]
flag = do
      Bool
f <- WarningFlag -> DynFlags -> Bool
wopt WarningFlag
Opt_WarnUnrecognisedWarningFlags (DynFlags -> Bool) -> DynP DynFlags -> EwM (CmdLineP DynFlags) Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> CmdLineP DynFlags DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => m a -> EwM m a
liftEwM CmdLineP DynFlags DynFlags
forall s. CmdLineP s s
getCmdLineState
      Bool -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
f (DynP () -> DynP ()) -> DynP () -> DynP ()
forall a b. (a -> b) -> a -> b
$ WarnReason -> [Char] -> DynP ()
forall (m :: * -> *). Monad m => WarnReason -> [Char] -> EwM m ()
addFlagWarn WarnReason
Cmd.ReasonUnrecognisedFlag ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$
        [Char]
"unrecognised warning flag: -" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
prefix [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
flag

-- See Note [Supporting CLI completion]
package_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
package_flags_deps :: [(Deprecation, Flag (CmdLineP DynFlags))]
package_flags_deps = [
        ------- Packages ----------------------------------------------------
    DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"package-db"
      (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg (PkgDbRef -> DynP ()
addPkgDbRef (PkgDbRef -> DynP ()) -> ([Char] -> PkgDbRef) -> [Char] -> DynP ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> PkgDbRef
PkgDbPath))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"clear-package-db"      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
clearPkgDb)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"no-global-package-db"  (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
removeGlobalPkgDb)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"no-user-package-db"    (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
removeUserPkgDb)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"global-package-db"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (PkgDbRef -> DynP ()
addPkgDbRef PkgDbRef
GlobalPkgDb))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"user-package-db"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (PkgDbRef -> DynP ()
addPkgDbRef PkgDbRef
UserPkgDb))
    -- backwards compat with GHC<=7.4 :
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"package-conf"
      (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ PkgDbRef -> DynP ()
addPkgDbRef (PkgDbRef -> DynP ()) -> ([Char] -> PkgDbRef) -> [Char] -> DynP ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> PkgDbRef
PkgDbPath) [Char]
"Use -package-db instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"no-user-package-conf"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
removeUserPkgDb)              [Char]
"Use -no-user-package-db instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"package-name"       (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \[Char]
name ->
                                      (DynFlags -> DynFlags) -> DynP ()
upd ([Char] -> DynFlags -> DynFlags
setUnitId [Char]
name))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"this-unit-id"       (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setUnitId)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"package"               (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
exposePackage)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"plugin-package-id"     (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
exposePluginPackageId)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"plugin-package"        (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
exposePluginPackage)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"package-id"            (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
exposePackageId)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"hide-package"          (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
hidePackage)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"hide-all-packages"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_HideAllPackages))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"hide-all-plugin-packages"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_HideAllPluginPackages))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"package-env"           (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
setPackageEnv)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"ignore-package"        (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
ignorePackage)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"syslib" (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
exposePackage) [Char]
"Use -package instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"distrust-all-packages"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DistrustAllPackages))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"trust"                 (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
trustPackage)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"distrust"              (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
distrustPackage)
  ]
  where
    setPackageEnv :: [Char] -> DynP ()
setPackageEnv [Char]
env = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
s -> DynFlags
s { packageEnv :: Maybe [Char]
packageEnv = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
env }

-- | Make a list of flags for shell completion.
-- Filter all available flags into two groups, for interactive GHC vs all other.
flagsForCompletion :: Bool -> [String]
flagsForCompletion :: Bool -> [[Char]]
flagsForCompletion Bool
isInteractive
    = [ Char
'-'Char -> ShowS
forall a. a -> [a] -> [a]
:Flag (CmdLineP DynFlags) -> [Char]
forall (m :: * -> *). Flag m -> [Char]
flagName Flag (CmdLineP DynFlags)
flag
      | Flag (CmdLineP DynFlags)
flag <- [Flag (CmdLineP DynFlags)]
flagsAll
      , GhcFlagMode -> Bool
modeFilter (Flag (CmdLineP DynFlags) -> GhcFlagMode
forall (m :: * -> *). Flag m -> GhcFlagMode
flagGhcMode Flag (CmdLineP DynFlags)
flag)
      ]
    where
      modeFilter :: GhcFlagMode -> Bool
modeFilter GhcFlagMode
AllModes = Bool
True
      modeFilter GhcFlagMode
OnlyGhci = Bool
isInteractive
      modeFilter GhcFlagMode
OnlyGhc = Bool -> Bool
not Bool
isInteractive
      modeFilter GhcFlagMode
HiddenFlag = Bool
False

type TurnOnFlag = Bool   -- True  <=> we are turning the flag on
                         -- False <=> we are turning the flag off
turnOn  :: TurnOnFlag; turnOn :: Bool
turnOn  = Bool
True
turnOff :: TurnOnFlag; turnOff :: Bool
turnOff = Bool
False

data FlagSpec flag
   = FlagSpec
       { forall flag. FlagSpec flag -> [Char]
flagSpecName :: String   -- ^ Flag in string form
       , forall flag. FlagSpec flag -> flag
flagSpecFlag :: flag     -- ^ Flag in internal form
       , forall flag. FlagSpec flag -> Bool -> DynP ()
flagSpecAction :: (TurnOnFlag -> DynP ())
           -- ^ Extra action to run when the flag is found
           -- Typically, emit a warning or error
       , forall flag. FlagSpec flag -> GhcFlagMode
flagSpecGhcMode :: GhcFlagMode
           -- ^ In which ghc mode the flag has effect
       }

-- | Define a new flag.
flagSpec :: String -> flag -> (Deprecation, FlagSpec flag)
flagSpec :: forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
name flag
flag = [Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
name flag
flag Bool -> DynP ()
nop

-- | Define a new flag with an effect.
flagSpec' :: String -> flag -> (TurnOnFlag -> DynP ())
          -> (Deprecation, FlagSpec flag)
flagSpec' :: forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
name flag
flag Bool -> DynP ()
act = (Deprecation
NotDeprecated, [Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name flag
flag Bool -> DynP ()
act GhcFlagMode
AllModes)

-- | Define a new deprecated flag with an effect.
depFlagSpecOp :: String -> flag -> (TurnOnFlag -> DynP ()) -> String
            -> (Deprecation, FlagSpec flag)
depFlagSpecOp :: forall flag.
[Char]
-> flag
-> (Bool -> DynP ())
-> [Char]
-> (Deprecation, FlagSpec flag)
depFlagSpecOp [Char]
name flag
flag Bool -> DynP ()
act [Char]
dep =
    (Deprecation
Deprecated, (Deprecation, FlagSpec flag) -> FlagSpec flag
forall a b. (a, b) -> b
snd ([Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
name flag
flag (\Bool
f -> Bool -> DynP ()
act Bool
f DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
dep)))

-- | Define a new deprecated flag.
depFlagSpec :: String -> flag -> String
            -> (Deprecation, FlagSpec flag)
depFlagSpec :: forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
name flag
flag [Char]
dep = [Char]
-> flag
-> (Bool -> DynP ())
-> [Char]
-> (Deprecation, FlagSpec flag)
forall flag.
[Char]
-> flag
-> (Bool -> DynP ())
-> [Char]
-> (Deprecation, FlagSpec flag)
depFlagSpecOp [Char]
name flag
flag Bool -> DynP ()
nop [Char]
dep

-- | Define a new deprecated flag with an effect where the deprecation message
-- depends on the flag value
depFlagSpecOp' :: String
             -> flag
             -> (TurnOnFlag -> DynP ())
             -> (TurnOnFlag -> String)
             -> (Deprecation, FlagSpec flag)
depFlagSpecOp' :: forall flag.
[Char]
-> flag
-> (Bool -> DynP ())
-> (Bool -> [Char])
-> (Deprecation, FlagSpec flag)
depFlagSpecOp' [Char]
name flag
flag Bool -> DynP ()
act Bool -> [Char]
dep =
    (Deprecation
Deprecated, [Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name flag
flag (\Bool
f -> Bool -> DynP ()
act Bool
f DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ([Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ Bool -> [Char]
dep Bool
f))
                                                                       GhcFlagMode
AllModes)

-- | Define a new deprecated flag where the deprecation message
-- depends on the flag value
depFlagSpec' :: String
             -> flag
             -> (TurnOnFlag -> String)
             -> (Deprecation, FlagSpec flag)
depFlagSpec' :: forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
name flag
flag Bool -> [Char]
dep = [Char]
-> flag
-> (Bool -> DynP ())
-> (Bool -> [Char])
-> (Deprecation, FlagSpec flag)
forall flag.
[Char]
-> flag
-> (Bool -> DynP ())
-> (Bool -> [Char])
-> (Deprecation, FlagSpec flag)
depFlagSpecOp' [Char]
name flag
flag Bool -> DynP ()
nop Bool -> [Char]
dep


-- | Define a new deprecated flag where the deprecation message
-- is shown depending on the flag value
depFlagSpecCond :: String
                -> flag
                -> (TurnOnFlag -> Bool)
                -> String
                -> (Deprecation, FlagSpec flag)
depFlagSpecCond :: forall flag.
[Char]
-> flag -> (Bool -> Bool) -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpecCond [Char]
name flag
flag Bool -> Bool
cond [Char]
dep =
    (Deprecation
Deprecated, [Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name flag
flag (\Bool
f -> Bool -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Bool -> Bool
cond Bool
f) (DynP () -> DynP ()) -> DynP () -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
deprecate [Char]
dep)
                                                                       GhcFlagMode
AllModes)

-- | Define a new flag for GHCi.
flagGhciSpec :: String -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec :: forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
name flag
flag = [Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagGhciSpec' [Char]
name flag
flag Bool -> DynP ()
nop

-- | Define a new flag for GHCi with an effect.
flagGhciSpec' :: String -> flag -> (TurnOnFlag -> DynP ())
              -> (Deprecation, FlagSpec flag)
flagGhciSpec' :: forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagGhciSpec' [Char]
name flag
flag Bool -> DynP ()
act = (Deprecation
NotDeprecated, [Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name flag
flag Bool -> DynP ()
act GhcFlagMode
OnlyGhci)

-- | Define a new flag invisible to CLI completion.
flagHiddenSpec :: String -> flag -> (Deprecation, FlagSpec flag)
flagHiddenSpec :: forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagHiddenSpec [Char]
name flag
flag = [Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagHiddenSpec' [Char]
name flag
flag Bool -> DynP ()
nop

-- | Define a new flag invisible to CLI completion with an effect.
flagHiddenSpec' :: String -> flag -> (TurnOnFlag -> DynP ())
                -> (Deprecation, FlagSpec flag)
flagHiddenSpec' :: forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagHiddenSpec' [Char]
name flag
flag Bool -> DynP ()
act = (Deprecation
NotDeprecated, [Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name flag
flag Bool -> DynP ()
act
                                                                     GhcFlagMode
HiddenFlag)

-- | Hide a 'FlagSpec' from being displayed in @--show-options@.
--
-- This is for example useful for flags that are obsolete, but should not
-- (yet) be deprecated for compatibility reasons.
hideFlag :: (Deprecation, FlagSpec a) -> (Deprecation, FlagSpec a)
hideFlag :: forall a. (Deprecation, FlagSpec a) -> (Deprecation, FlagSpec a)
hideFlag (Deprecation
dep, FlagSpec a
fs) = (Deprecation
dep, FlagSpec a
fs { flagSpecGhcMode :: GhcFlagMode
flagSpecGhcMode = GhcFlagMode
HiddenFlag })

mkFlag :: TurnOnFlag            -- ^ True <=> it should be turned on
       -> String                -- ^ The flag prefix
       -> (flag -> DynP ())     -- ^ What to do when the flag is found
       -> (Deprecation, FlagSpec flag)  -- ^ Specification of
                                        -- this particular flag
       -> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag :: forall flag.
Bool
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag Bool
turn_on [Char]
flagPrefix flag -> DynP ()
f (Deprecation
dep, (FlagSpec [Char]
name flag
flag Bool -> DynP ()
extra_action GhcFlagMode
mode))
    = (Deprecation
dep,
       [Char]
-> OptKind (CmdLineP DynFlags)
-> GhcFlagMode
-> Flag (CmdLineP DynFlags)
forall (m :: * -> *). [Char] -> OptKind m -> GhcFlagMode -> Flag m
Flag ([Char]
flagPrefix [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
name) (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (flag -> DynP ()
f flag
flag DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Bool -> DynP ()
extra_action Bool
turn_on)) GhcFlagMode
mode)

deprecatedForExtension :: String -> TurnOnFlag -> String
deprecatedForExtension :: [Char] -> Bool -> [Char]
deprecatedForExtension [Char]
lang Bool
turn_on
    = [Char]
"use -X" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
flag [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++
      [Char]
" or pragma {-# LANGUAGE " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
flag [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
" #-} instead"
    where
      flag :: [Char]
flag | Bool
turn_on   = [Char]
lang
           | Bool
otherwise = [Char]
"No" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
lang

useInstead :: String -> String -> TurnOnFlag -> String
useInstead :: [Char] -> [Char] -> Bool -> [Char]
useInstead [Char]
prefix [Char]
flag Bool
turn_on
  = [Char]
"Use " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
prefix [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
no [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
flag [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
" instead"
  where
    no :: [Char]
no = if Bool
turn_on then [Char]
"" else [Char]
"no-"

nop :: TurnOnFlag -> DynP ()
nop :: Bool -> DynP ()
nop Bool
_ = () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

-- | Find the 'FlagSpec' for a 'WarningFlag'.
flagSpecOf :: WarningFlag -> Maybe (FlagSpec WarningFlag)
flagSpecOf :: WarningFlag -> Maybe (FlagSpec WarningFlag)
flagSpecOf WarningFlag
flag = [FlagSpec WarningFlag] -> Maybe (FlagSpec WarningFlag)
forall a. [a] -> Maybe a
listToMaybe ([FlagSpec WarningFlag] -> Maybe (FlagSpec WarningFlag))
-> [FlagSpec WarningFlag] -> Maybe (FlagSpec WarningFlag)
forall a b. (a -> b) -> a -> b
$ (FlagSpec WarningFlag -> Bool)
-> [FlagSpec WarningFlag] -> [FlagSpec WarningFlag]
forall a. (a -> Bool) -> [a] -> [a]
filter FlagSpec WarningFlag -> Bool
check [FlagSpec WarningFlag]
wWarningFlags
  where
    check :: FlagSpec WarningFlag -> Bool
check FlagSpec WarningFlag
fs = FlagSpec WarningFlag -> WarningFlag
forall flag. FlagSpec flag -> flag
flagSpecFlag FlagSpec WarningFlag
fs WarningFlag -> WarningFlag -> Bool
forall a. Eq a => a -> a -> Bool
== WarningFlag
flag

-- | These @-W\<blah\>@ flags can all be reversed with @-Wno-\<blah\>@
wWarningFlags :: [FlagSpec WarningFlag]
wWarningFlags :: [FlagSpec WarningFlag]
wWarningFlags = ((Deprecation, FlagSpec WarningFlag) -> FlagSpec WarningFlag)
-> [(Deprecation, FlagSpec WarningFlag)] -> [FlagSpec WarningFlag]
forall a b. (a -> b) -> [a] -> [b]
map (Deprecation, FlagSpec WarningFlag) -> FlagSpec WarningFlag
forall a b. (a, b) -> b
snd (((Deprecation, FlagSpec WarningFlag)
 -> (Deprecation, FlagSpec WarningFlag) -> Ordering)
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, FlagSpec WarningFlag)]
forall a. (a -> a -> Ordering) -> [a] -> [a]
sortBy (((Deprecation, FlagSpec WarningFlag) -> Deprecation)
-> (Deprecation, FlagSpec WarningFlag)
-> (Deprecation, FlagSpec WarningFlag)
-> Ordering
forall a b. Ord a => (b -> a) -> b -> b -> Ordering
comparing (Deprecation, FlagSpec WarningFlag) -> Deprecation
forall a b. (a, b) -> a
fst) [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps)

wWarningFlagsDeps :: [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps :: [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps = [
-- See Note [Updating flag description in the User's Guide]
-- See Note [Supporting CLI completion]
-- Please keep the list of flags below sorted alphabetically
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"alternative-layout-rule-transitional"
                                      WarningFlag
Opt_WarnAlternativeLayoutRuleTransitional,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ambiguous-fields"            WarningFlag
Opt_WarnAmbiguousFields,
  [Char]
-> WarningFlag -> [Char] -> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
"auto-orphans"             WarningFlag
Opt_WarnAutoOrphans
    [Char]
"it has no effect",
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cpp-undef"                   WarningFlag
Opt_WarnCPPUndef,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unbanged-strict-patterns"    WarningFlag
Opt_WarnUnbangedStrictPatterns,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"deferred-type-errors"        WarningFlag
Opt_WarnDeferredTypeErrors,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"deferred-out-of-scope-variables"
                                         WarningFlag
Opt_WarnDeferredOutOfScopeVariables,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"deprecations"                WarningFlag
Opt_WarnWarningsDeprecations,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"deprecated-flags"            WarningFlag
Opt_WarnDeprecatedFlags,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"deriving-defaults"           WarningFlag
Opt_WarnDerivingDefaults,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"deriving-typeable"           WarningFlag
Opt_WarnDerivingTypeable,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"dodgy-exports"               WarningFlag
Opt_WarnDodgyExports,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"dodgy-foreign-imports"       WarningFlag
Opt_WarnDodgyForeignImports,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"dodgy-imports"               WarningFlag
Opt_WarnDodgyImports,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"empty-enumerations"          WarningFlag
Opt_WarnEmptyEnumerations,
  [Char]
-> WarningFlag -> [Char] -> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
"duplicate-constraints"    WarningFlag
Opt_WarnDuplicateConstraints
    [Char]
"it is subsumed by -Wredundant-constraints",
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"redundant-constraints"       WarningFlag
Opt_WarnRedundantConstraints,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"duplicate-exports"           WarningFlag
Opt_WarnDuplicateExports,
  [Char]
-> WarningFlag -> [Char] -> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
"hi-shadowing"                WarningFlag
Opt_WarnHiShadows
    [Char]
"it is not used, and was never implemented",
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"inaccessible-code"           WarningFlag
Opt_WarnInaccessibleCode,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"implicit-prelude"            WarningFlag
Opt_WarnImplicitPrelude,
  [Char]
-> WarningFlag -> [Char] -> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
"implicit-kind-vars"       WarningFlag
Opt_WarnImplicitKindVars
    [Char]
"it is now an error",
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"incomplete-patterns"         WarningFlag
Opt_WarnIncompletePatterns,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"incomplete-record-updates"   WarningFlag
Opt_WarnIncompletePatternsRecUpd,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"incomplete-uni-patterns"     WarningFlag
Opt_WarnIncompleteUniPatterns,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"inline-rule-shadowing"       WarningFlag
Opt_WarnInlineRuleShadowing,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"identities"                  WarningFlag
Opt_WarnIdentities,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-fields"              WarningFlag
Opt_WarnMissingFields,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-import-lists"        WarningFlag
Opt_WarnMissingImportList,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-export-lists"        WarningFlag
Opt_WarnMissingExportList,
  [Char]
-> WarningFlag -> [Char] -> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
"missing-local-sigs"       WarningFlag
Opt_WarnMissingLocalSignatures
    [Char]
"it is replaced by -Wmissing-local-signatures",
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-local-signatures"    WarningFlag
Opt_WarnMissingLocalSignatures,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-methods"             WarningFlag
Opt_WarnMissingMethods,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-monadfail-instances" WarningFlag
Opt_WarnMissingMonadFailInstances,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"semigroup"                   WarningFlag
Opt_WarnSemigroup,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-signatures"          WarningFlag
Opt_WarnMissingSignatures,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-kind-signatures"     WarningFlag
Opt_WarnMissingKindSignatures,
  [Char]
-> WarningFlag -> [Char] -> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
"missing-exported-sigs"    WarningFlag
Opt_WarnMissingExportedSignatures
    [Char]
"it is replaced by -Wmissing-exported-signatures",
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-exported-signatures" WarningFlag
Opt_WarnMissingExportedSignatures,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"monomorphism-restriction"    WarningFlag
Opt_WarnMonomorphism,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"name-shadowing"              WarningFlag
Opt_WarnNameShadowing,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"noncanonical-monad-instances"
                                         WarningFlag
Opt_WarnNonCanonicalMonadInstances,
  [Char]
-> WarningFlag -> [Char] -> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
"noncanonical-monadfail-instances"
                                         WarningFlag
Opt_WarnNonCanonicalMonadInstances
    [Char]
"fail is no longer a method of Monad",
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"noncanonical-monoid-instances"
                                         WarningFlag
Opt_WarnNonCanonicalMonoidInstances,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"orphans"                     WarningFlag
Opt_WarnOrphans,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"overflowed-literals"         WarningFlag
Opt_WarnOverflowedLiterals,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"overlapping-patterns"        WarningFlag
Opt_WarnOverlappingPatterns,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missed-specialisations"      WarningFlag
Opt_WarnMissedSpecs,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missed-specializations"      WarningFlag
Opt_WarnMissedSpecs,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"all-missed-specialisations"  WarningFlag
Opt_WarnAllMissedSpecs,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"all-missed-specializations"  WarningFlag
Opt_WarnAllMissedSpecs,
  [Char]
-> WarningFlag
-> (Bool -> DynP ())
-> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
"safe"                       WarningFlag
Opt_WarnSafe Bool -> DynP ()
setWarnSafe,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"trustworthy-safe"            WarningFlag
Opt_WarnTrustworthySafe,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"inferred-safe-imports"       WarningFlag
Opt_WarnInferredSafeImports,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-safe-haskell-mode"   WarningFlag
Opt_WarnMissingSafeHaskellMode,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"tabs"                        WarningFlag
Opt_WarnTabs,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"type-defaults"               WarningFlag
Opt_WarnTypeDefaults,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"typed-holes"                 WarningFlag
Opt_WarnTypedHoles,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"partial-type-signatures"     WarningFlag
Opt_WarnPartialTypeSignatures,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unrecognised-pragmas"        WarningFlag
Opt_WarnUnrecognisedPragmas,
  [Char]
-> WarningFlag
-> (Bool -> DynP ())
-> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
"unsafe"                     WarningFlag
Opt_WarnUnsafe Bool -> DynP ()
setWarnUnsafe,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unsupported-calling-conventions"
                                         WarningFlag
Opt_WarnUnsupportedCallingConventions,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unsupported-llvm-version"    WarningFlag
Opt_WarnUnsupportedLlvmVersion,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missed-extra-shared-lib"     WarningFlag
Opt_WarnMissedExtraSharedLib,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unticked-promoted-constructors"
                                         WarningFlag
Opt_WarnUntickedPromotedConstructors,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-do-bind"              WarningFlag
Opt_WarnUnusedDoBind,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-foralls"              WarningFlag
Opt_WarnUnusedForalls,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-imports"              WarningFlag
Opt_WarnUnusedImports,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-local-binds"          WarningFlag
Opt_WarnUnusedLocalBinds,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-matches"              WarningFlag
Opt_WarnUnusedMatches,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-pattern-binds"        WarningFlag
Opt_WarnUnusedPatternBinds,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-top-binds"            WarningFlag
Opt_WarnUnusedTopBinds,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-type-patterns"        WarningFlag
Opt_WarnUnusedTypePatterns,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-record-wildcards"     WarningFlag
Opt_WarnUnusedRecordWildcards,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"redundant-bang-patterns"     WarningFlag
Opt_WarnRedundantBangPatterns,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"redundant-record-wildcards"  WarningFlag
Opt_WarnRedundantRecordWildcards,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"warnings-deprecations"       WarningFlag
Opt_WarnWarningsDeprecations,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"wrong-do-bind"               WarningFlag
Opt_WarnWrongDoBind,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-pattern-synonym-signatures"
                                    WarningFlag
Opt_WarnMissingPatternSynonymSignatures,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-deriving-strategies" WarningFlag
Opt_WarnMissingDerivingStrategies,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"simplifiable-class-constraints" WarningFlag
Opt_WarnSimplifiableClassConstraints,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"missing-home-modules"        WarningFlag
Opt_WarnMissingHomeModules,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unrecognised-warning-flags"  WarningFlag
Opt_WarnUnrecognisedWarningFlags,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"star-binder"                 WarningFlag
Opt_WarnStarBinder,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"star-is-type"                WarningFlag
Opt_WarnStarIsType,
  [Char]
-> WarningFlag -> [Char] -> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
"missing-space-after-bang" WarningFlag
Opt_WarnSpaceAfterBang
    [Char]
"bang patterns can no longer be written with a space",
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"partial-fields"              WarningFlag
Opt_WarnPartialFields,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"prepositive-qualified-module"
                                         WarningFlag
Opt_WarnPrepositiveQualifiedModule,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unused-packages"             WarningFlag
Opt_WarnUnusedPackages,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"compat-unqualified-imports"  WarningFlag
Opt_WarnCompatUnqualifiedImports,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"invalid-haddock"             WarningFlag
Opt_WarnInvalidHaddock,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"operator-whitespace-ext-conflict"  WarningFlag
Opt_WarnOperatorWhitespaceExtConflict,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"operator-whitespace"         WarningFlag
Opt_WarnOperatorWhitespace,
  [Char] -> WarningFlag -> (Deprecation, FlagSpec WarningFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"implicit-lift"               WarningFlag
Opt_WarnImplicitLift
 ]

-- | These @-\<blah\>@ flags can all be reversed with @-no-\<blah\>@
negatableFlagsDeps :: [(Deprecation, FlagSpec GeneralFlag)]
negatableFlagsDeps :: [(Deprecation, FlagSpec GeneralFlag)]
negatableFlagsDeps = [
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
"ignore-dot-ghci"         GeneralFlag
Opt_IgnoreDotGhci ]

-- | These @-d\<blah\>@ flags can all be reversed with @-dno-\<blah\>@
dFlagsDeps :: [(Deprecation, FlagSpec GeneralFlag)]
dFlagsDeps :: [(Deprecation, FlagSpec GeneralFlag)]
dFlagsDeps = [
-- See Note [Updating flag description in the User's Guide]
-- See Note [Supporting CLI completion]
-- Please keep the list of flags below sorted alphabetically
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ppr-case-as-let"            GeneralFlag
Opt_PprCaseAsLet,
  [Char]
-> GeneralFlag
-> (Bool -> [Char])
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"ppr-ticks"              GeneralFlag
Opt_PprShowTicks
     (\Bool
turn_on -> [Char] -> [Char] -> Bool -> [Char]
useInstead [Char]
"-d" [Char]
"suppress-ticks" (Bool -> Bool
not Bool
turn_on)),
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-ticks"             GeneralFlag
Opt_SuppressTicks,
  [Char]
-> GeneralFlag
-> (Bool -> [Char])
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"suppress-stg-free-vars" GeneralFlag
Opt_SuppressStgExts
     ([Char] -> [Char] -> Bool -> [Char]
useInstead [Char]
"-d" [Char]
"suppress-stg-exts"),
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-stg-exts"          GeneralFlag
Opt_SuppressStgExts,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-coercions"         GeneralFlag
Opt_SuppressCoercions,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-idinfo"            GeneralFlag
Opt_SuppressIdInfo,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-unfoldings"        GeneralFlag
Opt_SuppressUnfoldings,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-module-prefixes"   GeneralFlag
Opt_SuppressModulePrefixes,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-timestamps"        GeneralFlag
Opt_SuppressTimestamps,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-type-applications" GeneralFlag
Opt_SuppressTypeApplications,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-type-signatures"   GeneralFlag
Opt_SuppressTypeSignatures,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-uniques"           GeneralFlag
Opt_SuppressUniques,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-var-kinds"         GeneralFlag
Opt_SuppressVarKinds
  ]

-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
fFlags :: [FlagSpec GeneralFlag]
fFlags :: [FlagSpec GeneralFlag]
fFlags = ((Deprecation, FlagSpec GeneralFlag) -> FlagSpec GeneralFlag)
-> [(Deprecation, FlagSpec GeneralFlag)] -> [FlagSpec GeneralFlag]
forall a b. (a -> b) -> [a] -> [b]
map (Deprecation, FlagSpec GeneralFlag) -> FlagSpec GeneralFlag
forall a b. (a, b) -> b
snd [(Deprecation, FlagSpec GeneralFlag)]
fFlagsDeps

fFlagsDeps :: [(Deprecation, FlagSpec GeneralFlag)]
fFlagsDeps :: [(Deprecation, FlagSpec GeneralFlag)]
fFlagsDeps = [
-- See Note [Updating flag description in the User's Guide]
-- See Note [Supporting CLI completion]
-- Please keep the list of flags below sorted alphabetically
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"asm-shortcutting"                 GeneralFlag
Opt_AsmShortcutting,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
"break-on-error"               GeneralFlag
Opt_BreakOnError,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
"break-on-exception"           GeneralFlag
Opt_BreakOnException,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"building-cabal-package"           GeneralFlag
Opt_BuildingCabalPackage,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"call-arity"                       GeneralFlag
Opt_CallArity,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"exitification"                    GeneralFlag
Opt_Exitification,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"case-merge"                       GeneralFlag
Opt_CaseMerge,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"case-folding"                     GeneralFlag
Opt_CaseFolding,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cmm-elim-common-blocks"           GeneralFlag
Opt_CmmElimCommonBlocks,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cmm-sink"                         GeneralFlag
Opt_CmmSink,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cmm-static-pred"                  GeneralFlag
Opt_CmmStaticPred,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cse"                              GeneralFlag
Opt_CSE,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"stg-cse"                          GeneralFlag
Opt_StgCSE,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"stg-lift-lams"                    GeneralFlag
Opt_StgLiftLams,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cpr-anal"                         GeneralFlag
Opt_CprAnal,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"defer-diagnostics"                GeneralFlag
Opt_DeferDiagnostics,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"defer-type-errors"                GeneralFlag
Opt_DeferTypeErrors,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"defer-typed-holes"                GeneralFlag
Opt_DeferTypedHoles,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"defer-out-of-scope-variables"     GeneralFlag
Opt_DeferOutOfScopeVariables,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"diagnostics-show-caret"           GeneralFlag
Opt_DiagnosticsShowCaret,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"dicts-cheap"                      GeneralFlag
Opt_DictsCheap,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"dicts-strict"                     GeneralFlag
Opt_DictsStrict,
  [Char]
-> GeneralFlag -> [Char] -> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char] -> flag -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpec [Char]
"dmd-tx-dict-sel"
      GeneralFlag
Opt_DmdTxDictSel [Char]
"effect is now unconditionally enabled",
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"do-eta-reduction"                 GeneralFlag
Opt_DoEtaReduction,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"do-lambda-eta-expansion"          GeneralFlag
Opt_DoLambdaEtaExpansion,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"eager-blackholing"                GeneralFlag
Opt_EagerBlackHoling,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"embed-manifest"                   GeneralFlag
Opt_EmbedManifest,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"enable-rewrite-rules"             GeneralFlag
Opt_EnableRewriteRules,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"enable-th-splice-warnings"        GeneralFlag
Opt_EnableThSpliceWarnings,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"error-spans"                      GeneralFlag
Opt_ErrorSpans,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"excess-precision"                 GeneralFlag
Opt_ExcessPrecision,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"expose-all-unfoldings"            GeneralFlag
Opt_ExposeAllUnfoldings,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"expose-internal-symbols"          GeneralFlag
Opt_ExposeInternalSymbols,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"external-dynamic-refs"            GeneralFlag
Opt_ExternalDynamicRefs,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"external-interpreter"             GeneralFlag
Opt_ExternalInterpreter,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"family-application-cache"         GeneralFlag
Opt_FamAppCache,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"float-in"                         GeneralFlag
Opt_FloatIn,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"force-recomp"                     GeneralFlag
Opt_ForceRecomp,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ignore-optim-changes"             GeneralFlag
Opt_IgnoreOptimChanges,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ignore-hpc-changes"               GeneralFlag
Opt_IgnoreHpcChanges,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"full-laziness"                    GeneralFlag
Opt_FullLaziness,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"fun-to-thunk"                     GeneralFlag
Opt_FunToThunk,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"gen-manifest"                     GeneralFlag
Opt_GenManifest,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ghci-history"                     GeneralFlag
Opt_GhciHistory,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ghci-leak-check"                  GeneralFlag
Opt_GhciLeakCheck,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"validate-ide-info"                GeneralFlag
Opt_ValidateHie,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
"local-ghci-history"           GeneralFlag
Opt_LocalGhciHistory,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
"no-it"                        GeneralFlag
Opt_NoIt,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ghci-sandbox"                     GeneralFlag
Opt_GhciSandbox,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"helpful-errors"                   GeneralFlag
Opt_HelpfulErrors,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"hpc"                              GeneralFlag
Opt_Hpc,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ignore-asserts"                   GeneralFlag
Opt_IgnoreAsserts,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ignore-interface-pragmas"         GeneralFlag
Opt_IgnoreInterfacePragmas,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
"implicit-import-qualified"    GeneralFlag
Opt_ImplicitImportQualified,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"irrefutable-tuples"               GeneralFlag
Opt_IrrefutableTuples,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"keep-going"                       GeneralFlag
Opt_KeepGoing,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"late-dmd-anal"                    GeneralFlag
Opt_LateDmdAnal,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"late-specialise"                  GeneralFlag
Opt_LateSpecialise,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"liberate-case"                    GeneralFlag
Opt_LiberateCase,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagHiddenSpec [Char]
"llvm-tbaa"                  GeneralFlag
Opt_LlvmTBAA,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagHiddenSpec [Char]
"llvm-fill-undef-with-garbage" GeneralFlag
Opt_LlvmFillUndefWithGarbage,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"loopification"                    GeneralFlag
Opt_Loopification,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"block-layout-cfg"                 GeneralFlag
Opt_CfgBlocklayout,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"block-layout-weightless"          GeneralFlag
Opt_WeightlessBlocklayout,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"omit-interface-pragmas"           GeneralFlag
Opt_OmitInterfacePragmas,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"omit-yields"                      GeneralFlag
Opt_OmitYields,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"optimal-applicative-do"           GeneralFlag
Opt_OptimalApplicativeDo,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"pedantic-bottoms"                 GeneralFlag
Opt_PedanticBottoms,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"pre-inlining"                     GeneralFlag
Opt_SimplPreInlining,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
"print-bind-contents"          GeneralFlag
Opt_PrintBindContents,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
"print-bind-result"            GeneralFlag
Opt_PrintBindResult,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagGhciSpec [Char]
"print-evld-with-show"         GeneralFlag
Opt_PrintEvldWithShow,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-explicit-foralls"           GeneralFlag
Opt_PrintExplicitForalls,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-explicit-kinds"             GeneralFlag
Opt_PrintExplicitKinds,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-explicit-coercions"         GeneralFlag
Opt_PrintExplicitCoercions,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-explicit-runtime-reps"      GeneralFlag
Opt_PrintExplicitRuntimeReps,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-equality-relations"         GeneralFlag
Opt_PrintEqualityRelations,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-axiom-incomps"              GeneralFlag
Opt_PrintAxiomIncomps,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-unicode-syntax"             GeneralFlag
Opt_PrintUnicodeSyntax,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-expanded-synonyms"          GeneralFlag
Opt_PrintExpandedSynonyms,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-potential-instances"        GeneralFlag
Opt_PrintPotentialInstances,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"print-typechecker-elaboration"    GeneralFlag
Opt_PrintTypecheckerElaboration,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"prof-cafs"                        GeneralFlag
Opt_AutoSccsOnIndividualCafs,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"prof-count-entries"               GeneralFlag
Opt_ProfCountEntries,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"regs-graph"                       GeneralFlag
Opt_RegsGraph,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"regs-iterative"                   GeneralFlag
Opt_RegsIterative,
  [Char]
-> GeneralFlag
-> (Bool -> [Char])
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"rewrite-rules"                GeneralFlag
Opt_EnableRewriteRules
   ([Char] -> [Char] -> Bool -> [Char]
useInstead [Char]
"-f" [Char]
"enable-rewrite-rules"),
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"shared-implib"                    GeneralFlag
Opt_SharedImplib,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"spec-constr"                      GeneralFlag
Opt_SpecConstr,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"spec-constr-keen"                 GeneralFlag
Opt_SpecConstrKeen,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"specialise"                       GeneralFlag
Opt_Specialise,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"specialize"                       GeneralFlag
Opt_Specialise,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"specialise-aggressively"          GeneralFlag
Opt_SpecialiseAggressively,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"specialize-aggressively"          GeneralFlag
Opt_SpecialiseAggressively,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cross-module-specialise"          GeneralFlag
Opt_CrossModuleSpecialise,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cross-module-specialize"          GeneralFlag
Opt_CrossModuleSpecialise,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"inline-generics"                  GeneralFlag
Opt_InlineGenerics,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"inline-generics-aggressively"     GeneralFlag
Opt_InlineGenericsAggressively,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"static-argument-transformation"   GeneralFlag
Opt_StaticArgumentTransformation,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"strictness"                       GeneralFlag
Opt_Strictness,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"use-rpaths"                       GeneralFlag
Opt_RPath,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"write-interface"                  GeneralFlag
Opt_WriteInterface,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"write-ide-info"                   GeneralFlag
Opt_WriteHie,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unbox-small-strict-fields"        GeneralFlag
Opt_UnboxSmallStrictFields,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unbox-strict-fields"              GeneralFlag
Opt_UnboxStrictFields,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"version-macros"                   GeneralFlag
Opt_VersionMacros,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"worker-wrapper"                   GeneralFlag
Opt_WorkerWrapper,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"solve-constant-dicts"             GeneralFlag
Opt_SolveConstantDicts,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"catch-bottoms"                    GeneralFlag
Opt_CatchBottoms,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"alignment-sanitisation"           GeneralFlag
Opt_AlignmentSanitisation,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"num-constant-folding"             GeneralFlag
Opt_NumConstantFolding,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-warning-groups"              GeneralFlag
Opt_ShowWarnGroups,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"hide-source-paths"                GeneralFlag
Opt_HideSourcePaths,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-loaded-modules"              GeneralFlag
Opt_ShowLoadedModules,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"whole-archive-hs-libs"            GeneralFlag
Opt_WholeArchiveHsLibs,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"keep-cafs"                        GeneralFlag
Opt_KeepCAFs,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"link-rts"                         GeneralFlag
Opt_LinkRts
  ]
  [(Deprecation, FlagSpec GeneralFlag)]
-> [(Deprecation, FlagSpec GeneralFlag)]
-> [(Deprecation, FlagSpec GeneralFlag)]
forall a. [a] -> [a] -> [a]
++ [(Deprecation, FlagSpec GeneralFlag)]
fHoleFlags

-- | These @-f\<blah\>@ flags have to do with the typed-hole error message or
-- the valid hole fits in that message. See Note [Valid hole fits include ...]
-- in the "GHC.Tc.Errors.Hole" module. These flags can all be reversed with
-- @-fno-\<blah\>@
fHoleFlags :: [(Deprecation, FlagSpec GeneralFlag)]
fHoleFlags :: [(Deprecation, FlagSpec GeneralFlag)]
fHoleFlags = [
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-hole-constraints"            GeneralFlag
Opt_ShowHoleConstraints,
  [Char]
-> GeneralFlag
-> (Bool -> [Char])
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"show-valid-substitutions"     GeneralFlag
Opt_ShowValidHoleFits
   ([Char] -> [Char] -> Bool -> [Char]
useInstead [Char]
"-f" [Char]
"show-valid-hole-fits"),
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-valid-hole-fits"             GeneralFlag
Opt_ShowValidHoleFits,
  -- Sorting settings
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"sort-valid-hole-fits"             GeneralFlag
Opt_SortValidHoleFits,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"sort-by-size-hole-fits"           GeneralFlag
Opt_SortBySizeHoleFits,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"sort-by-subsumption-hole-fits"    GeneralFlag
Opt_SortBySubsumHoleFits,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"abstract-refinement-hole-fits"    GeneralFlag
Opt_AbstractRefHoleFits,
  -- Output format settings
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-hole-matches-of-hole-fits"   GeneralFlag
Opt_ShowMatchesOfHoleFits,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-provenance-of-hole-fits"     GeneralFlag
Opt_ShowProvOfHoleFits,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-type-of-hole-fits"           GeneralFlag
Opt_ShowTypeOfHoleFits,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-type-app-of-hole-fits"       GeneralFlag
Opt_ShowTypeAppOfHoleFits,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-type-app-vars-of-hole-fits"  GeneralFlag
Opt_ShowTypeAppVarsOfHoleFits,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-docs-of-hole-fits"           GeneralFlag
Opt_ShowDocsOfHoleFits,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"unclutter-valid-hole-fits"        GeneralFlag
Opt_UnclutterValidHoleFits
  ]

-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
fLangFlags :: [FlagSpec LangExt.Extension]
fLangFlags :: [FlagSpec Extension]
fLangFlags = ((Deprecation, FlagSpec Extension) -> FlagSpec Extension)
-> [(Deprecation, FlagSpec Extension)] -> [FlagSpec Extension]
forall a b. (a -> b) -> [a] -> [b]
map (Deprecation, FlagSpec Extension) -> FlagSpec Extension
forall a b. (a, b) -> b
snd [(Deprecation, FlagSpec Extension)]
fLangFlagsDeps

fLangFlagsDeps :: [(Deprecation, FlagSpec LangExt.Extension)]
fLangFlagsDeps :: [(Deprecation, FlagSpec Extension)]
fLangFlagsDeps = [
-- See Note [Updating flag description in the User's Guide]
-- See Note [Supporting CLI completion]
  [Char]
-> Extension
-> (Bool -> DynP ())
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag
-> (Bool -> DynP ())
-> (Bool -> [Char])
-> (Deprecation, FlagSpec flag)
depFlagSpecOp' [Char]
"th"                           Extension
LangExt.TemplateHaskell
    Bool -> DynP ()
checkTemplateHaskellOk
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"TemplateHaskell"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"fi"                             Extension
LangExt.ForeignFunctionInterface
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"ForeignFunctionInterface"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"ffi"                            Extension
LangExt.ForeignFunctionInterface
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"ForeignFunctionInterface"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"arrows"                         Extension
LangExt.Arrows
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"Arrows"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"implicit-prelude"               Extension
LangExt.ImplicitPrelude
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"ImplicitPrelude"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"bang-patterns"                  Extension
LangExt.BangPatterns
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"BangPatterns"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"monomorphism-restriction"       Extension
LangExt.MonomorphismRestriction
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"MonomorphismRestriction"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"extended-default-rules"         Extension
LangExt.ExtendedDefaultRules
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"ExtendedDefaultRules"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"implicit-params"                Extension
LangExt.ImplicitParams
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"ImplicitParams"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"scoped-type-variables"          Extension
LangExt.ScopedTypeVariables
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"ScopedTypeVariables"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"allow-overlapping-instances"    Extension
LangExt.OverlappingInstances
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"OverlappingInstances"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"allow-undecidable-instances"    Extension
LangExt.UndecidableInstances
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"UndecidableInstances"),
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"allow-incoherent-instances"     Extension
LangExt.IncoherentInstances
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"IncoherentInstances")
  ]

supportedLanguages :: [String]
supportedLanguages :: [[Char]]
supportedLanguages = ((Deprecation, FlagSpec Language) -> [Char])
-> [(Deprecation, FlagSpec Language)] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map (FlagSpec Language -> [Char]
forall flag. FlagSpec flag -> [Char]
flagSpecName (FlagSpec Language -> [Char])
-> ((Deprecation, FlagSpec Language) -> FlagSpec Language)
-> (Deprecation, FlagSpec Language)
-> [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Deprecation, FlagSpec Language) -> FlagSpec Language
forall a b. (a, b) -> b
snd) [(Deprecation, FlagSpec Language)]
languageFlagsDeps

supportedLanguageOverlays :: [String]
supportedLanguageOverlays :: [[Char]]
supportedLanguageOverlays = ((Deprecation, FlagSpec SafeHaskellMode) -> [Char])
-> [(Deprecation, FlagSpec SafeHaskellMode)] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map (FlagSpec SafeHaskellMode -> [Char]
forall flag. FlagSpec flag -> [Char]
flagSpecName (FlagSpec SafeHaskellMode -> [Char])
-> ((Deprecation, FlagSpec SafeHaskellMode)
    -> FlagSpec SafeHaskellMode)
-> (Deprecation, FlagSpec SafeHaskellMode)
-> [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Deprecation, FlagSpec SafeHaskellMode) -> FlagSpec SafeHaskellMode
forall a b. (a, b) -> b
snd) [(Deprecation, FlagSpec SafeHaskellMode)]
safeHaskellFlagsDeps

supportedExtensions :: ArchOS -> [String]
supportedExtensions :: ArchOS -> [[Char]]
supportedExtensions (ArchOS Arch
_ OS
os) = (FlagSpec Extension -> [[Char]])
-> [FlagSpec Extension] -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FlagSpec Extension -> [[Char]]
toFlagSpecNamePair [FlagSpec Extension]
xFlags
  where
    toFlagSpecNamePair :: FlagSpec Extension -> [[Char]]
toFlagSpecNamePair FlagSpec Extension
flg
      -- IMPORTANT! Make sure that `ghc --supported-extensions` omits
      -- "TemplateHaskell"/"QuasiQuotes" when it's known not to work out of the
      -- box. See also GHC #11102 and #16331 for more details about
      -- the rationale
      | Bool
isAIX, FlagSpec Extension -> Extension
forall flag. FlagSpec flag -> flag
flagSpecFlag FlagSpec Extension
flg Extension -> Extension -> Bool
forall a. Eq a => a -> a -> Bool
== Extension
LangExt.TemplateHaskell  = [[Char]
noName]
      | Bool
isAIX, FlagSpec Extension -> Extension
forall flag. FlagSpec flag -> flag
flagSpecFlag FlagSpec Extension
flg Extension -> Extension -> Bool
forall a. Eq a => a -> a -> Bool
== Extension
LangExt.QuasiQuotes      = [[Char]
noName]
      | Bool
otherwise = [[Char]
name, [Char]
noName]
      where
        isAIX :: Bool
isAIX = OS
os OS -> OS -> Bool
forall a. Eq a => a -> a -> Bool
== OS
OSAIX
        noName :: [Char]
noName = [Char]
"No" [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
name
        name :: [Char]
name = FlagSpec Extension -> [Char]
forall flag. FlagSpec flag -> [Char]
flagSpecName FlagSpec Extension
flg

supportedLanguagesAndExtensions :: ArchOS -> [String]
supportedLanguagesAndExtensions :: ArchOS -> [[Char]]
supportedLanguagesAndExtensions ArchOS
arch_os =
    [[Char]]
supportedLanguages [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
supportedLanguageOverlays [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ ArchOS -> [[Char]]
supportedExtensions ArchOS
arch_os

-- | These -X<blah> flags cannot be reversed with -XNo<blah>
languageFlagsDeps :: [(Deprecation, FlagSpec Language)]
languageFlagsDeps :: [(Deprecation, FlagSpec Language)]
languageFlagsDeps = [
  [Char] -> Language -> (Deprecation, FlagSpec Language)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"Haskell98"   Language
Haskell98,
  [Char] -> Language -> (Deprecation, FlagSpec Language)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"Haskell2010" Language
Haskell2010,
  [Char] -> Language -> (Deprecation, FlagSpec Language)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"GHC2021"     Language
GHC2021
  ]

-- | These -X<blah> flags cannot be reversed with -XNo<blah>
-- They are used to place hard requirements on what GHC Haskell language
-- features can be used.
safeHaskellFlagsDeps :: [(Deprecation, FlagSpec SafeHaskellMode)]
safeHaskellFlagsDeps :: [(Deprecation, FlagSpec SafeHaskellMode)]
safeHaskellFlagsDeps = [SafeHaskellMode -> (Deprecation, FlagSpec SafeHaskellMode)
forall {flag}. Show flag => flag -> (Deprecation, FlagSpec flag)
mkF SafeHaskellMode
Sf_Unsafe, SafeHaskellMode -> (Deprecation, FlagSpec SafeHaskellMode)
forall {flag}. Show flag => flag -> (Deprecation, FlagSpec flag)
mkF SafeHaskellMode
Sf_Trustworthy, SafeHaskellMode -> (Deprecation, FlagSpec SafeHaskellMode)
forall {flag}. Show flag => flag -> (Deprecation, FlagSpec flag)
mkF SafeHaskellMode
Sf_Safe]
    where mkF :: flag -> (Deprecation, FlagSpec flag)
mkF flag
flag = [Char] -> flag -> (Deprecation, FlagSpec flag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec (flag -> [Char]
forall a. Show a => a -> [Char]
show flag
flag) flag
flag

-- | These -X<blah> flags can all be reversed with -XNo<blah>
xFlags :: [FlagSpec LangExt.Extension]
xFlags :: [FlagSpec Extension]
xFlags = ((Deprecation, FlagSpec Extension) -> FlagSpec Extension)
-> [(Deprecation, FlagSpec Extension)] -> [FlagSpec Extension]
forall a b. (a -> b) -> [a] -> [b]
map (Deprecation, FlagSpec Extension) -> FlagSpec Extension
forall a b. (a, b) -> b
snd [(Deprecation, FlagSpec Extension)]
xFlagsDeps

xFlagsDeps :: [(Deprecation, FlagSpec LangExt.Extension)]
xFlagsDeps :: [(Deprecation, FlagSpec Extension)]
xFlagsDeps = [
-- See Note [Updating flag description in the User's Guide]
-- See Note [Supporting CLI completion]
-- See Note [Adding a language extension]
-- Please keep the list of flags below sorted alphabetically
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"AllowAmbiguousTypes"              Extension
LangExt.AllowAmbiguousTypes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"AlternativeLayoutRule"            Extension
LangExt.AlternativeLayoutRule,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"AlternativeLayoutRuleTransitional"
                                              Extension
LangExt.AlternativeLayoutRuleTransitional,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"Arrows"                           Extension
LangExt.Arrows,
  [Char]
-> Extension
-> (Bool -> Bool)
-> [Char]
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (Bool -> Bool) -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpecCond [Char]
"AutoDeriveTypeable"        Extension
LangExt.AutoDeriveTypeable
    Bool -> Bool
forall a. a -> a
id
         ([Char]
"Typeable instances are created automatically " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++
                     [Char]
"for all types since GHC 8.2."),
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"BangPatterns"                     Extension
LangExt.BangPatterns,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"BinaryLiterals"                   Extension
LangExt.BinaryLiterals,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"CApiFFI"                          Extension
LangExt.CApiFFI,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"CPP"                              Extension
LangExt.Cpp,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"CUSKs"                            Extension
LangExt.CUSKs,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ConstrainedClassMethods"          Extension
LangExt.ConstrainedClassMethods,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ConstraintKinds"                  Extension
LangExt.ConstraintKinds,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DataKinds"                        Extension
LangExt.DataKinds,
  [Char]
-> Extension
-> (Bool -> Bool)
-> [Char]
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (Bool -> Bool) -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpecCond [Char]
"DatatypeContexts"          Extension
LangExt.DatatypeContexts
    Bool -> Bool
forall a. a -> a
id
         ([Char]
"It was widely considered a misfeature, " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++
                     [Char]
"and has been removed from the Haskell language."),
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DefaultSignatures"                Extension
LangExt.DefaultSignatures,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DeriveAnyClass"                   Extension
LangExt.DeriveAnyClass,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DeriveDataTypeable"               Extension
LangExt.DeriveDataTypeable,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DeriveFoldable"                   Extension
LangExt.DeriveFoldable,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DeriveFunctor"                    Extension
LangExt.DeriveFunctor,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DeriveGeneric"                    Extension
LangExt.DeriveGeneric,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DeriveLift"                       Extension
LangExt.DeriveLift,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DeriveTraversable"                Extension
LangExt.DeriveTraversable,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DerivingStrategies"               Extension
LangExt.DerivingStrategies,
  [Char]
-> Extension
-> (Bool -> DynP ())
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
"DerivingVia"                     Extension
LangExt.DerivingVia
                                              Bool -> DynP ()
setDeriveVia,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DisambiguateRecordFields"         Extension
LangExt.DisambiguateRecordFields,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DoAndIfThenElse"                  Extension
LangExt.DoAndIfThenElse,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"BlockArguments"                   Extension
LangExt.BlockArguments,
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"DoRec"                        Extension
LangExt.RecursiveDo
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"RecursiveDo"),
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"DuplicateRecordFields"            Extension
LangExt.DuplicateRecordFields,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"FieldSelectors"                   Extension
LangExt.FieldSelectors,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"EmptyCase"                        Extension
LangExt.EmptyCase,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"EmptyDataDecls"                   Extension
LangExt.EmptyDataDecls,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"EmptyDataDeriving"                Extension
LangExt.EmptyDataDeriving,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ExistentialQuantification"        Extension
LangExt.ExistentialQuantification,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ExplicitForAll"                   Extension
LangExt.ExplicitForAll,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ExplicitNamespaces"               Extension
LangExt.ExplicitNamespaces,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ExtendedDefaultRules"             Extension
LangExt.ExtendedDefaultRules,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"FlexibleContexts"                 Extension
LangExt.FlexibleContexts,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"FlexibleInstances"                Extension
LangExt.FlexibleInstances,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ForeignFunctionInterface"         Extension
LangExt.ForeignFunctionInterface,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"FunctionalDependencies"           Extension
LangExt.FunctionalDependencies,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"GADTSyntax"                       Extension
LangExt.GADTSyntax,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"GADTs"                            Extension
LangExt.GADTs,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"GHCForeignImportPrim"             Extension
LangExt.GHCForeignImportPrim,
  [Char]
-> Extension
-> (Bool -> DynP ())
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
"GeneralizedNewtypeDeriving"      Extension
LangExt.GeneralizedNewtypeDeriving
                                              Bool -> DynP ()
setGenDeriving,
  [Char]
-> Extension
-> (Bool -> DynP ())
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
"GeneralisedNewtypeDeriving"      Extension
LangExt.GeneralizedNewtypeDeriving
                                              Bool -> DynP ()
setGenDeriving,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ImplicitParams"                   Extension
LangExt.ImplicitParams,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ImplicitPrelude"                  Extension
LangExt.ImplicitPrelude,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ImportQualifiedPost"              Extension
LangExt.ImportQualifiedPost,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ImpredicativeTypes"               Extension
LangExt.ImpredicativeTypes,
  [Char]
-> Extension
-> (Bool -> DynP ())
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
"IncoherentInstances"             Extension
LangExt.IncoherentInstances
                                              Bool -> DynP ()
setIncoherentInsts,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TypeFamilyDependencies"           Extension
LangExt.TypeFamilyDependencies,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"InstanceSigs"                     Extension
LangExt.InstanceSigs,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ApplicativeDo"                    Extension
LangExt.ApplicativeDo,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"InterruptibleFFI"                 Extension
LangExt.InterruptibleFFI,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"JavaScriptFFI"                    Extension
LangExt.JavaScriptFFI,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"KindSignatures"                   Extension
LangExt.KindSignatures,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"LambdaCase"                       Extension
LangExt.LambdaCase,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"LexicalNegation"                  Extension
LangExt.LexicalNegation,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"LiberalTypeSynonyms"              Extension
LangExt.LiberalTypeSynonyms,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"LinearTypes"                      Extension
LangExt.LinearTypes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"MagicHash"                        Extension
LangExt.MagicHash,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"MonadComprehensions"              Extension
LangExt.MonadComprehensions,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"MonoLocalBinds"                   Extension
LangExt.MonoLocalBinds,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"MonomorphismRestriction"          Extension
LangExt.MonomorphismRestriction,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"MultiParamTypeClasses"            Extension
LangExt.MultiParamTypeClasses,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"MultiWayIf"                       Extension
LangExt.MultiWayIf,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"NumericUnderscores"               Extension
LangExt.NumericUnderscores,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"NPlusKPatterns"                   Extension
LangExt.NPlusKPatterns,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"NamedFieldPuns"                   Extension
LangExt.RecordPuns,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"NamedWildCards"                   Extension
LangExt.NamedWildCards,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"NegativeLiterals"                 Extension
LangExt.NegativeLiterals,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"HexFloatLiterals"                 Extension
LangExt.HexFloatLiterals,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"NondecreasingIndentation"         Extension
LangExt.NondecreasingIndentation,
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"NullaryTypeClasses"           Extension
LangExt.NullaryTypeClasses
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"MultiParamTypeClasses"),
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"NumDecimals"                      Extension
LangExt.NumDecimals,
  [Char]
-> Extension
-> (Bool -> DynP ())
-> [Char]
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag
-> (Bool -> DynP ())
-> [Char]
-> (Deprecation, FlagSpec flag)
depFlagSpecOp [Char]
"OverlappingInstances"        Extension
LangExt.OverlappingInstances
    Bool -> DynP ()
setOverlappingInsts
    [Char]
"instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS",
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"OverloadedLabels"                 Extension
LangExt.OverloadedLabels,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"OverloadedLists"                  Extension
LangExt.OverloadedLists,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"OverloadedStrings"                Extension
LangExt.OverloadedStrings,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"PackageImports"                   Extension
LangExt.PackageImports,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ParallelArrays"                   Extension
LangExt.ParallelArrays,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ParallelListComp"                 Extension
LangExt.ParallelListComp,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"PartialTypeSignatures"            Extension
LangExt.PartialTypeSignatures,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"PatternGuards"                    Extension
LangExt.PatternGuards,
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"PatternSignatures"            Extension
LangExt.ScopedTypeVariables
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"ScopedTypeVariables"),
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"PatternSynonyms"                  Extension
LangExt.PatternSynonyms,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"PolyKinds"                        Extension
LangExt.PolyKinds,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"PolymorphicComponents"            Extension
LangExt.RankNTypes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"QuantifiedConstraints"            Extension
LangExt.QuantifiedConstraints,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"PostfixOperators"                 Extension
LangExt.PostfixOperators,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"QuasiQuotes"                      Extension
LangExt.QuasiQuotes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"QualifiedDo"                      Extension
LangExt.QualifiedDo,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"Rank2Types"                       Extension
LangExt.RankNTypes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"RankNTypes"                       Extension
LangExt.RankNTypes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"RebindableSyntax"                 Extension
LangExt.RebindableSyntax,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"OverloadedRecordDot"              Extension
LangExt.OverloadedRecordDot,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"OverloadedRecordUpdate"           Extension
LangExt.OverloadedRecordUpdate,
  [Char]
-> Extension
-> (Bool -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"RecordPuns"                   Extension
LangExt.RecordPuns
    ([Char] -> Bool -> [Char]
deprecatedForExtension [Char]
"NamedFieldPuns"),
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"RecordWildCards"                  Extension
LangExt.RecordWildCards,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"RecursiveDo"                      Extension
LangExt.RecursiveDo,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"RelaxedLayout"                    Extension
LangExt.RelaxedLayout,
  [Char]
-> Extension
-> (Bool -> Bool)
-> [Char]
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (Bool -> Bool) -> [Char] -> (Deprecation, FlagSpec flag)
depFlagSpecCond [Char]
"RelaxedPolyRec"            Extension
LangExt.RelaxedPolyRec
    Bool -> Bool
not
         [Char]
"You can't turn off RelaxedPolyRec any more",
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"RoleAnnotations"                  Extension
LangExt.RoleAnnotations,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ScopedTypeVariables"              Extension
LangExt.ScopedTypeVariables,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"StandaloneDeriving"               Extension
LangExt.StandaloneDeriving,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"StarIsType"                       Extension
LangExt.StarIsType,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"StaticPointers"                   Extension
LangExt.StaticPointers,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"Strict"                           Extension
LangExt.Strict,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"StrictData"                       Extension
LangExt.StrictData,
  [Char]
-> Extension
-> (Bool -> DynP ())
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char] -> flag -> (Bool -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
"TemplateHaskell"                 Extension
LangExt.TemplateHaskell
                                              Bool -> DynP ()
checkTemplateHaskellOk,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TemplateHaskellQuotes"            Extension
LangExt.TemplateHaskellQuotes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"StandaloneKindSignatures"         Extension
LangExt.StandaloneKindSignatures,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TraditionalRecordSyntax"          Extension
LangExt.TraditionalRecordSyntax,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TransformListComp"                Extension
LangExt.TransformListComp,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TupleSections"                    Extension
LangExt.TupleSections,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TypeApplications"                 Extension
LangExt.TypeApplications,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TypeInType"                       Extension
LangExt.TypeInType,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TypeFamilies"                     Extension
LangExt.TypeFamilies,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TypeOperators"                    Extension
LangExt.TypeOperators,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"TypeSynonymInstances"             Extension
LangExt.TypeSynonymInstances,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"UnboxedTuples"                    Extension
LangExt.UnboxedTuples,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"UnboxedSums"                      Extension
LangExt.UnboxedSums,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"UndecidableInstances"             Extension
LangExt.UndecidableInstances,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"UndecidableSuperClasses"          Extension
LangExt.UndecidableSuperClasses,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"UnicodeSyntax"                    Extension
LangExt.UnicodeSyntax,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"UnliftedDatatypes"                Extension
LangExt.UnliftedDatatypes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"UnliftedFFITypes"                 Extension
LangExt.UnliftedFFITypes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"UnliftedNewtypes"                 Extension
LangExt.UnliftedNewtypes,
  [Char] -> Extension -> (Deprecation, FlagSpec Extension)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"ViewPatterns"                     Extension
LangExt.ViewPatterns
  ]

defaultFlags :: Settings -> [GeneralFlag]
defaultFlags :: Settings -> [GeneralFlag]
defaultFlags Settings
settings
-- See Note [Updating flag description in the User's Guide]
  = [ GeneralFlag
Opt_AutoLinkPackages,
      GeneralFlag
Opt_DiagnosticsShowCaret,
      GeneralFlag
Opt_EmbedManifest,
      GeneralFlag
Opt_FamAppCache,
      GeneralFlag
Opt_GenManifest,
      GeneralFlag
Opt_GhciHistory,
      GeneralFlag
Opt_GhciSandbox,
      GeneralFlag
Opt_HelpfulErrors,
      GeneralFlag
Opt_KeepHiFiles,
      GeneralFlag
Opt_KeepOFiles,
      GeneralFlag
Opt_OmitYields,
      GeneralFlag
Opt_PrintBindContents,
      GeneralFlag
Opt_ProfCountEntries,
      GeneralFlag
Opt_SharedImplib,
      GeneralFlag
Opt_SimplPreInlining,
      GeneralFlag
Opt_VersionMacros,
      GeneralFlag
Opt_RPath
    ]

    [GeneralFlag] -> [GeneralFlag] -> [GeneralFlag]
forall a. [a] -> [a] -> [a]
++ [GeneralFlag
f | ([Int]
ns,GeneralFlag
f) <- [([Int], GeneralFlag)]
optLevelFlags, Int
0 Int -> [Int] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Int]
ns]
             -- The default -O0 options

    [GeneralFlag] -> [GeneralFlag] -> [GeneralFlag]
forall a. [a] -> [a] -> [a]
++ Platform -> [GeneralFlag]
default_PIC Platform
platform

    [GeneralFlag] -> [GeneralFlag] -> [GeneralFlag]
forall a. [a] -> [a] -> [a]
++ [GeneralFlag]
validHoleFitDefaults

    where platform :: Platform
platform = Settings -> Platform
sTargetPlatform Settings
settings

-- | These are the default settings for the display and sorting of valid hole
--  fits in typed-hole error messages. See Note [Valid hole fits include ...]
 -- in the "GHC.Tc.Errors.Hole" module.
validHoleFitDefaults :: [GeneralFlag]
validHoleFitDefaults :: [GeneralFlag]
validHoleFitDefaults
  =  [ GeneralFlag
Opt_ShowTypeAppOfHoleFits
     , GeneralFlag
Opt_ShowTypeOfHoleFits
     , GeneralFlag
Opt_ShowProvOfHoleFits
     , GeneralFlag
Opt_ShowMatchesOfHoleFits
     , GeneralFlag
Opt_ShowValidHoleFits
     , GeneralFlag
Opt_SortValidHoleFits
     , GeneralFlag
Opt_SortBySizeHoleFits
     , GeneralFlag
Opt_ShowHoleConstraints ]


validHoleFitsImpliedGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
validHoleFitsImpliedGFlags :: [(GeneralFlag, Bool, GeneralFlag)]
validHoleFitsImpliedGFlags
  = [ (GeneralFlag
Opt_UnclutterValidHoleFits, Bool
turnOff, GeneralFlag
Opt_ShowTypeAppOfHoleFits)
    , (GeneralFlag
Opt_UnclutterValidHoleFits, Bool
turnOff, GeneralFlag
Opt_ShowTypeAppVarsOfHoleFits)
    , (GeneralFlag
Opt_UnclutterValidHoleFits, Bool
turnOff, GeneralFlag
Opt_ShowDocsOfHoleFits)
    , (GeneralFlag
Opt_ShowTypeAppVarsOfHoleFits, Bool
turnOff, GeneralFlag
Opt_ShowTypeAppOfHoleFits)
    , (GeneralFlag
Opt_UnclutterValidHoleFits, Bool
turnOff, GeneralFlag
Opt_ShowProvOfHoleFits) ]

default_PIC :: Platform -> [GeneralFlag]
default_PIC :: Platform -> [GeneralFlag]
default_PIC Platform
platform =
  case (Platform -> OS
platformOS Platform
platform, Platform -> Arch
platformArch Platform
platform) of
    -- Darwin always requires PIC.  Especially on more recent macOS releases
    -- there will be a 4GB __ZEROPAGE that prevents us from using 32bit addresses
    -- while we could work around this on x86_64 (like WINE does), we won't be
    -- able on aarch64, where this is enforced.
    (OS
OSDarwin,  Arch
ArchX86_64)  -> [GeneralFlag
Opt_PIC]
    -- For AArch64, we need to always have PIC enabled.  The relocation model
    -- on AArch64 does not permit arbitrary relocations.  Under ASLR, we can't
    -- control much how far apart symbols are in memory for our in-memory static
    -- linker;  and thus need to ensure we get sufficiently capable relocations.
    -- This requires PIC on AArch64, and ExternalDynamicRefs on Linux as on top
    -- of that.  Subsequently we expect all code on aarch64/linux (and macOS) to
    -- be built with -fPIC.
    (OS
OSDarwin,  Arch
ArchAArch64) -> [GeneralFlag
Opt_PIC]
    (OS
OSLinux,   Arch
ArchAArch64) -> [GeneralFlag
Opt_PIC, GeneralFlag
Opt_ExternalDynamicRefs]
    (OS
OSLinux,   ArchARM {})  -> [GeneralFlag
Opt_PIC, GeneralFlag
Opt_ExternalDynamicRefs]
    (OS
OSOpenBSD, Arch
ArchX86_64)  -> [GeneralFlag
Opt_PIC] -- Due to PIE support in
                                         -- OpenBSD since 5.3 release
                                         -- (1 May 2013) we need to
                                         -- always generate PIC. See
                                         -- #10597 for more
                                         -- information.
    (OS, Arch)
_                      -> []

-- General flags that are switched on/off when other general flags are switched
-- on
impliedGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
impliedGFlags :: [(GeneralFlag, Bool, GeneralFlag)]
impliedGFlags = [(GeneralFlag
Opt_DeferTypeErrors, Bool
turnOn, GeneralFlag
Opt_DeferTypedHoles)
                ,(GeneralFlag
Opt_DeferTypeErrors, Bool
turnOn, GeneralFlag
Opt_DeferOutOfScopeVariables)
                ,(GeneralFlag
Opt_DoLinearCoreLinting, Bool
turnOn, GeneralFlag
Opt_DoCoreLinting)
                ,(GeneralFlag
Opt_Strictness, Bool
turnOn, GeneralFlag
Opt_WorkerWrapper)
                ] [(GeneralFlag, Bool, GeneralFlag)]
-> [(GeneralFlag, Bool, GeneralFlag)]
-> [(GeneralFlag, Bool, GeneralFlag)]
forall a. [a] -> [a] -> [a]
++ [(GeneralFlag, Bool, GeneralFlag)]
validHoleFitsImpliedGFlags

-- General flags that are switched on/off when other general flags are switched
-- off
impliedOffGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
impliedOffGFlags :: [(GeneralFlag, Bool, GeneralFlag)]
impliedOffGFlags = [(GeneralFlag
Opt_Strictness, Bool
turnOff, GeneralFlag
Opt_WorkerWrapper)]

impliedXFlags :: [(LangExt.Extension, TurnOnFlag, LangExt.Extension)]
impliedXFlags :: [(Extension, Bool, Extension)]
impliedXFlags
-- See Note [Updating flag description in the User's Guide]
  = [ (Extension
LangExt.RankNTypes,                Bool
turnOn, Extension
LangExt.ExplicitForAll)
    , (Extension
LangExt.QuantifiedConstraints,     Bool
turnOn, Extension
LangExt.ExplicitForAll)
    , (Extension
LangExt.ScopedTypeVariables,       Bool
turnOn, Extension
LangExt.ExplicitForAll)
    , (Extension
LangExt.LiberalTypeSynonyms,       Bool
turnOn, Extension
LangExt.ExplicitForAll)
    , (Extension
LangExt.ExistentialQuantification, Bool
turnOn, Extension
LangExt.ExplicitForAll)
    , (Extension
LangExt.FlexibleInstances,         Bool
turnOn, Extension
LangExt.TypeSynonymInstances)
    , (Extension
LangExt.FunctionalDependencies,    Bool
turnOn, Extension
LangExt.MultiParamTypeClasses)
    , (Extension
LangExt.MultiParamTypeClasses,     Bool
turnOn, Extension
LangExt.ConstrainedClassMethods)  -- c.f. #7854
    , (Extension
LangExt.TypeFamilyDependencies,    Bool
turnOn, Extension
LangExt.TypeFamilies)

    , (Extension
LangExt.RebindableSyntax, Bool
turnOff, Extension
LangExt.ImplicitPrelude)      -- NB: turn off!

    , (Extension
LangExt.DerivingVia, Bool
turnOn, Extension
LangExt.DerivingStrategies)

    , (Extension
LangExt.GADTs,            Bool
turnOn, Extension
LangExt.GADTSyntax)
    , (Extension
LangExt.GADTs,            Bool
turnOn, Extension
LangExt.MonoLocalBinds)
    , (Extension
LangExt.TypeFamilies,     Bool
turnOn, Extension
LangExt.MonoLocalBinds)

    , (Extension
LangExt.TypeFamilies,     Bool
turnOn, Extension
LangExt.KindSignatures)  -- Type families use kind signatures
    , (Extension
LangExt.PolyKinds,        Bool
turnOn, Extension
LangExt.KindSignatures)  -- Ditto polymorphic kinds

    -- TypeInType is now just a synonym for a couple of other extensions.
    , (Extension
LangExt.TypeInType,       Bool
turnOn, Extension
LangExt.DataKinds)
    , (Extension
LangExt.TypeInType,       Bool
turnOn, Extension
LangExt.PolyKinds)
    , (Extension
LangExt.TypeInType,       Bool
turnOn, Extension
LangExt.KindSignatures)

    -- Standalone kind signatures are a replacement for CUSKs.
    , (Extension
LangExt.StandaloneKindSignatures, Bool
turnOff, Extension
LangExt.CUSKs)

    -- AutoDeriveTypeable is not very useful without DeriveDataTypeable
    , (Extension
LangExt.AutoDeriveTypeable, Bool
turnOn, Extension
LangExt.DeriveDataTypeable)

    -- We turn this on so that we can export associated type
    -- type synonyms in subordinates (e.g. MyClass(type AssocType))
    , (Extension
LangExt.TypeFamilies,     Bool
turnOn, Extension
LangExt.ExplicitNamespaces)
    , (Extension
LangExt.TypeOperators, Bool
turnOn, Extension
LangExt.ExplicitNamespaces)

    , (Extension
LangExt.ImpredicativeTypes,  Bool
turnOn, Extension
LangExt.RankNTypes)

        -- Record wild-cards implies field disambiguation
        -- Otherwise if you write (C {..}) you may well get
        -- stuff like " 'a' not in scope ", which is a bit silly
        -- if the compiler has just filled in field 'a' of constructor 'C'
    , (Extension
LangExt.RecordWildCards,     Bool
turnOn, Extension
LangExt.DisambiguateRecordFields)

    , (Extension
LangExt.ParallelArrays, Bool
turnOn, Extension
LangExt.ParallelListComp)

    , (Extension
LangExt.JavaScriptFFI, Bool
turnOn, Extension
LangExt.InterruptibleFFI)

    , (Extension
LangExt.DeriveTraversable, Bool
turnOn, Extension
LangExt.DeriveFunctor)
    , (Extension
LangExt.DeriveTraversable, Bool
turnOn, Extension
LangExt.DeriveFoldable)

    -- Duplicate record fields require field disambiguation
    , (Extension
LangExt.DuplicateRecordFields, Bool
turnOn, Extension
LangExt.DisambiguateRecordFields)

    , (Extension
LangExt.TemplateHaskell, Bool
turnOn, Extension
LangExt.TemplateHaskellQuotes)
    , (Extension
LangExt.Strict, Bool
turnOn, Extension
LangExt.StrictData)

    -- The extensions needed to declare an H98 unlifted data type
    , (Extension
LangExt.UnliftedDatatypes, Bool
turnOn, Extension
LangExt.DataKinds)
    , (Extension
LangExt.UnliftedDatatypes, Bool
turnOn, Extension
LangExt.StandaloneKindSignatures)
  ]

-- Note [When is StarIsType enabled]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- The StarIsType extension determines whether to treat '*' as a regular type
-- operator or as a synonym for 'Data.Kind.Type'. Many existing pre-TypeInType
-- programs expect '*' to be synonymous with 'Type', so by default StarIsType is
-- enabled.
--
-- Programs that use TypeOperators might expect to repurpose '*' for
-- multiplication or another binary operation, but making TypeOperators imply
-- NoStarIsType caused too much breakage on Hackage.
--

-- Note [Documenting optimisation flags]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
-- If you change the list of flags enabled for particular optimisation levels
-- please remember to update the User's Guide. The relevant file is:
--
--   docs/users_guide/using-optimisation.rst
--
-- Make sure to note whether a flag is implied by -O0, -O or -O2.

optLevelFlags :: [([Int], GeneralFlag)]
-- Default settings of flags, before any command-line overrides
optLevelFlags :: [([Int], GeneralFlag)]
optLevelFlags -- see Note [Documenting optimisation flags]
  = [ ([Int
0,Int
1,Int
2], GeneralFlag
Opt_DoLambdaEtaExpansion)
    , ([Int
0,Int
1,Int
2], GeneralFlag
Opt_DoEtaReduction)       -- See Note [Eta-reduction in -O0]
    , ([Int
0,Int
1,Int
2], GeneralFlag
Opt_LlvmTBAA)

    , ([Int
0],     GeneralFlag
Opt_IgnoreInterfacePragmas)
    , ([Int
0],     GeneralFlag
Opt_OmitInterfacePragmas)

    , ([Int
1,Int
2],   GeneralFlag
Opt_CallArity)
    , ([Int
1,Int
2],   GeneralFlag
Opt_Exitification)
    , ([Int
1,Int
2],   GeneralFlag
Opt_CaseMerge)
    , ([Int
1,Int
2],   GeneralFlag
Opt_CaseFolding)
    , ([Int
1,Int
2],   GeneralFlag
Opt_CmmElimCommonBlocks)
    , ([Int
2],     GeneralFlag
Opt_AsmShortcutting)
    , ([Int
1,Int
2],   GeneralFlag
Opt_CmmSink)
    , ([Int
1,Int
2],   GeneralFlag
Opt_CmmStaticPred)
    , ([Int
1,Int
2],   GeneralFlag
Opt_CSE)
    , ([Int
1,Int
2],   GeneralFlag
Opt_StgCSE)
    , ([Int
2],     GeneralFlag
Opt_StgLiftLams)

    , ([Int
1,Int
2],   GeneralFlag
Opt_EnableRewriteRules)
          -- Off for -O0.   Otherwise we desugar list literals
          -- to 'build' but don't run the simplifier passes that
          -- would rewrite them back to cons cells!  This seems
          -- silly, and matters for the GHCi debugger.

    , ([Int
1,Int
2],   GeneralFlag
Opt_FloatIn)
    , ([Int
1,Int
2],   GeneralFlag
Opt_FullLaziness)
    , ([Int
1,Int
2],   GeneralFlag
Opt_IgnoreAsserts)
    , ([Int
1,Int
2],   GeneralFlag
Opt_Loopification)
    , ([Int
1,Int
2],   GeneralFlag
Opt_CfgBlocklayout)      -- Experimental

    , ([Int
1,Int
2],   GeneralFlag
Opt_Specialise)
    , ([Int
1,Int
2],   GeneralFlag
Opt_CrossModuleSpecialise)
    , ([Int
1,Int
2],   GeneralFlag
Opt_InlineGenerics)
    , ([Int
1,Int
2],   GeneralFlag
Opt_Strictness)
    , ([Int
1,Int
2],   GeneralFlag
Opt_UnboxSmallStrictFields)
    , ([Int
1,Int
2],   GeneralFlag
Opt_CprAnal)
    , ([Int
1,Int
2],   GeneralFlag
Opt_WorkerWrapper)
    , ([Int
1,Int
2],   GeneralFlag
Opt_SolveConstantDicts)
    , ([Int
1,Int
2],   GeneralFlag
Opt_NumConstantFolding)

    , ([Int
2],     GeneralFlag
Opt_LiberateCase)
    , ([Int
2],     GeneralFlag
Opt_SpecConstr)
--  , ([2],     Opt_RegsGraph)
--   RegsGraph suffers performance regression. See #7679
--  , ([2],     Opt_StaticArgumentTransformation)
--   Static Argument Transformation needs investigation. See #9374
    ]


-- -----------------------------------------------------------------------------
-- Standard sets of warning options

-- Note [Documenting warning flags]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
-- If you change the list of warning enabled by default
-- please remember to update the User's Guide. The relevant file is:
--
--  docs/users_guide/using-warnings.rst

-- | Warning groups.
--
-- As all warnings are in the Weverything set, it is ignored when
-- displaying to the user which group a warning is in.
warningGroups :: [(String, [WarningFlag])]
warningGroups :: [([Char], [WarningFlag])]
warningGroups =
    [ ([Char]
"compat",       [WarningFlag]
minusWcompatOpts)
    , ([Char]
"unused-binds", [WarningFlag]
unusedBindsFlags)
    , ([Char]
"default",      [WarningFlag]
standardWarnings)
    , ([Char]
"extra",        [WarningFlag]
minusWOpts)
    , ([Char]
"all",          [WarningFlag]
minusWallOpts)
    , ([Char]
"everything",   [WarningFlag]
minusWeverythingOpts)
    ]

-- | Warning group hierarchies, where there is an explicit inclusion
-- relation.
--
-- Each inner list is a hierarchy of warning groups, ordered from
-- smallest to largest, where each group is a superset of the one
-- before it.
--
-- Separating this from 'warningGroups' allows for multiple
-- hierarchies with no inherent relation to be defined.
--
-- The special-case Weverything group is not included.
warningHierarchies :: [[String]]
warningHierarchies :: [[[Char]]]
warningHierarchies = [[[Char]]]
hierarchies [[[Char]]] -> [[[Char]]] -> [[[Char]]]
forall a. [a] -> [a] -> [a]
++ ([Char] -> [[Char]]) -> [[Char]] -> [[[Char]]]
forall a b. (a -> b) -> [a] -> [b]
map ([Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
:[]) [[Char]]
rest
  where
    hierarchies :: [[[Char]]]
hierarchies = [[[Char]
"default", [Char]
"extra", [Char]
"all"]]
    rest :: [[Char]]
rest = ([Char] -> Bool) -> [[Char]] -> [[Char]]
forall a. (a -> Bool) -> [a] -> [a]
filter ([Char] -> [[Char]] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [Char]
"everything" [Char] -> [[Char]] -> [[Char]]
forall a. a -> [a] -> [a]
: [[[Char]]] -> [[Char]]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [[[Char]]]
hierarchies) ([[Char]] -> [[Char]]) -> [[Char]] -> [[Char]]
forall a b. (a -> b) -> a -> b
$
           (([Char], [WarningFlag]) -> [Char])
-> [([Char], [WarningFlag])] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map ([Char], [WarningFlag]) -> [Char]
forall a b. (a, b) -> a
fst [([Char], [WarningFlag])]
warningGroups

-- | Find the smallest group in every hierarchy which a warning
-- belongs to, excluding Weverything.
smallestGroups :: WarningFlag -> [String]
smallestGroups :: WarningFlag -> [[Char]]
smallestGroups WarningFlag
flag = ([[Char]] -> Maybe [Char]) -> [[[Char]]] -> [[Char]]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe [[Char]] -> Maybe [Char]
go [[[Char]]]
warningHierarchies where
    -- Because each hierarchy is arranged from smallest to largest,
    -- the first group we find in a hierarchy which contains the flag
    -- is the smallest.
    go :: [[Char]] -> Maybe [Char]
go ([Char]
group:[[Char]]
rest) = Maybe [Char] -> Maybe (Maybe [Char]) -> Maybe [Char]
forall a. a -> Maybe a -> a
fromMaybe ([[Char]] -> Maybe [Char]
go [[Char]]
rest) (Maybe (Maybe [Char]) -> Maybe [Char])
-> Maybe (Maybe [Char]) -> Maybe [Char]
forall a b. (a -> b) -> a -> b
$ do
        [WarningFlag]
flags <- [Char] -> [([Char], [WarningFlag])] -> Maybe [WarningFlag]
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup [Char]
group [([Char], [WarningFlag])]
warningGroups
        Bool -> Maybe ()
forall (f :: * -> *). Alternative f => Bool -> f ()
guard (WarningFlag
flag WarningFlag -> [WarningFlag] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [WarningFlag]
flags)
        Maybe [Char] -> Maybe (Maybe [Char])
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
group)
    go [] = Maybe [Char]
forall a. Maybe a
Nothing

-- | Warnings enabled unless specified otherwise
standardWarnings :: [WarningFlag]
standardWarnings :: [WarningFlag]
standardWarnings -- see Note [Documenting warning flags]
    = [ WarningFlag
Opt_WarnOverlappingPatterns,
        WarningFlag
Opt_WarnWarningsDeprecations,
        WarningFlag
Opt_WarnDeprecatedFlags,
        WarningFlag
Opt_WarnDeferredTypeErrors,
        WarningFlag
Opt_WarnTypedHoles,
        WarningFlag
Opt_WarnDeferredOutOfScopeVariables,
        WarningFlag
Opt_WarnPartialTypeSignatures,
        WarningFlag
Opt_WarnUnrecognisedPragmas,
        WarningFlag
Opt_WarnDuplicateExports,
        WarningFlag
Opt_WarnDerivingDefaults,
        WarningFlag
Opt_WarnOverflowedLiterals,
        WarningFlag
Opt_WarnEmptyEnumerations,
        WarningFlag
Opt_WarnAmbiguousFields,
        WarningFlag
Opt_WarnMissingFields,
        WarningFlag
Opt_WarnMissingMethods,
        WarningFlag
Opt_WarnWrongDoBind,
        WarningFlag
Opt_WarnUnsupportedCallingConventions,
        WarningFlag
Opt_WarnDodgyForeignImports,
        WarningFlag
Opt_WarnInlineRuleShadowing,
        WarningFlag
Opt_WarnAlternativeLayoutRuleTransitional,
        WarningFlag
Opt_WarnUnsupportedLlvmVersion,
        WarningFlag
Opt_WarnMissedExtraSharedLib,
        WarningFlag
Opt_WarnTabs,
        WarningFlag
Opt_WarnUnrecognisedWarningFlags,
        WarningFlag
Opt_WarnSimplifiableClassConstraints,
        WarningFlag
Opt_WarnStarBinder,
        WarningFlag
Opt_WarnInaccessibleCode,
        WarningFlag
Opt_WarnSpaceAfterBang,
        WarningFlag
Opt_WarnNonCanonicalMonadInstances,
        WarningFlag
Opt_WarnNonCanonicalMonoidInstances,
        WarningFlag
Opt_WarnOperatorWhitespaceExtConflict
      ]

-- | Things you get with -W
minusWOpts :: [WarningFlag]
minusWOpts :: [WarningFlag]
minusWOpts
    = [WarningFlag]
standardWarnings [WarningFlag] -> [WarningFlag] -> [WarningFlag]
forall a. [a] -> [a] -> [a]
++
      [ WarningFlag
Opt_WarnUnusedTopBinds,
        WarningFlag
Opt_WarnUnusedLocalBinds,
        WarningFlag
Opt_WarnUnusedPatternBinds,
        WarningFlag
Opt_WarnUnusedMatches,
        WarningFlag
Opt_WarnUnusedForalls,
        WarningFlag
Opt_WarnUnusedImports,
        WarningFlag
Opt_WarnIncompletePatterns,
        WarningFlag
Opt_WarnDodgyExports,
        WarningFlag
Opt_WarnDodgyImports,
        WarningFlag
Opt_WarnUnbangedStrictPatterns
      ]

-- | Things you get with -Wall
minusWallOpts :: [WarningFlag]
minusWallOpts :: [WarningFlag]
minusWallOpts
    = [WarningFlag]
minusWOpts [WarningFlag] -> [WarningFlag] -> [WarningFlag]
forall a. [a] -> [a] -> [a]
++
      [ WarningFlag
Opt_WarnTypeDefaults,
        WarningFlag
Opt_WarnNameShadowing,
        WarningFlag
Opt_WarnMissingSignatures,
        WarningFlag
Opt_WarnHiShadows,
        WarningFlag
Opt_WarnOrphans,
        WarningFlag
Opt_WarnUnusedDoBind,
        WarningFlag
Opt_WarnTrustworthySafe,
        WarningFlag
Opt_WarnUntickedPromotedConstructors,
        WarningFlag
Opt_WarnMissingPatternSynonymSignatures,
        WarningFlag
Opt_WarnUnusedRecordWildcards,
        WarningFlag
Opt_WarnRedundantRecordWildcards,
        WarningFlag
Opt_WarnStarIsType,
        WarningFlag
Opt_WarnIncompleteUniPatterns,
        WarningFlag
Opt_WarnIncompletePatternsRecUpd
      ]

-- | Things you get with -Weverything, i.e. *all* known warnings flags
minusWeverythingOpts :: [WarningFlag]
minusWeverythingOpts :: [WarningFlag]
minusWeverythingOpts = [ Int -> WarningFlag
forall a. Enum a => Int -> a
toEnum Int
0 .. ]

-- | Things you get with -Wcompat.
--
-- This is intended to group together warnings that will be enabled by default
-- at some point in the future, so that library authors eager to make their
-- code future compatible to fix issues before they even generate warnings.
minusWcompatOpts :: [WarningFlag]
minusWcompatOpts :: [WarningFlag]
minusWcompatOpts
    = [ WarningFlag
Opt_WarnSemigroup
      , WarningFlag
Opt_WarnNonCanonicalMonoidInstances
      , WarningFlag
Opt_WarnStarIsType
      , WarningFlag
Opt_WarnCompatUnqualifiedImports
      ]

enableUnusedBinds :: DynP ()
enableUnusedBinds :: DynP ()
enableUnusedBinds = (WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
setWarningFlag [WarningFlag]
unusedBindsFlags

disableUnusedBinds :: DynP ()
disableUnusedBinds :: DynP ()
disableUnusedBinds = (WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
unSetWarningFlag [WarningFlag]
unusedBindsFlags

-- Things you get with -Wunused-binds
unusedBindsFlags :: [WarningFlag]
unusedBindsFlags :: [WarningFlag]
unusedBindsFlags = [ WarningFlag
Opt_WarnUnusedTopBinds
                   , WarningFlag
Opt_WarnUnusedLocalBinds
                   , WarningFlag
Opt_WarnUnusedPatternBinds
                   ]

enableGlasgowExts :: DynP ()
enableGlasgowExts :: DynP ()
enableGlasgowExts = do GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_PrintExplicitForalls
                       (Extension -> DynP ()) -> [Extension] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Extension -> DynP ()
setExtensionFlag [Extension]
glasgowExtsFlags

disableGlasgowExts :: DynP ()
disableGlasgowExts :: DynP ()
disableGlasgowExts = do GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
Opt_PrintExplicitForalls
                        (Extension -> DynP ()) -> [Extension] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Extension -> DynP ()
unSetExtensionFlag [Extension]
glasgowExtsFlags

-- Please keep what_glasgow_exts_does.rst up to date with this list
glasgowExtsFlags :: [LangExt.Extension]
glasgowExtsFlags :: [Extension]
glasgowExtsFlags = [
             Extension
LangExt.ConstrainedClassMethods
           , Extension
LangExt.DeriveDataTypeable
           , Extension
LangExt.DeriveFoldable
           , Extension
LangExt.DeriveFunctor
           , Extension
LangExt.DeriveGeneric
           , Extension
LangExt.DeriveTraversable
           , Extension
LangExt.EmptyDataDecls
           , Extension
LangExt.ExistentialQuantification
           , Extension
LangExt.ExplicitNamespaces
           , Extension
LangExt.FlexibleContexts
           , Extension
LangExt.FlexibleInstances
           , Extension
LangExt.ForeignFunctionInterface
           , Extension
LangExt.FunctionalDependencies
           , Extension
LangExt.GeneralizedNewtypeDeriving
           , Extension
LangExt.ImplicitParams
           , Extension
LangExt.KindSignatures
           , Extension
LangExt.LiberalTypeSynonyms
           , Extension
LangExt.MagicHash
           , Extension
LangExt.MultiParamTypeClasses
           , Extension
LangExt.ParallelListComp
           , Extension
LangExt.PatternGuards
           , Extension
LangExt.PostfixOperators
           , Extension
LangExt.RankNTypes
           , Extension
LangExt.RecursiveDo
           , Extension
LangExt.ScopedTypeVariables
           , Extension
LangExt.StandaloneDeriving
           , Extension
LangExt.TypeOperators
           , Extension
LangExt.TypeSynonymInstances
           , Extension
LangExt.UnboxedTuples
           , Extension
LangExt.UnicodeSyntax
           , Extension
LangExt.UnliftedFFITypes ]

setWarnSafe :: Bool -> DynP ()
setWarnSafe :: Bool -> DynP ()
setWarnSafe Bool
True  = EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc EwM (CmdLineP DynFlags) SrcSpan -> (SrcSpan -> DynP ()) -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \SrcSpan
l -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { warnSafeOnLoc :: SrcSpan
warnSafeOnLoc = SrcSpan
l })
setWarnSafe Bool
False = () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

setWarnUnsafe :: Bool -> DynP ()
setWarnUnsafe :: Bool -> DynP ()
setWarnUnsafe Bool
True  = EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc EwM (CmdLineP DynFlags) SrcSpan -> (SrcSpan -> DynP ()) -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \SrcSpan
l -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { warnUnsafeOnLoc :: SrcSpan
warnUnsafeOnLoc = SrcSpan
l })
setWarnUnsafe Bool
False = () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

setPackageTrust :: DynP ()
setPackageTrust :: DynP ()
setPackageTrust = do
    GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_PackageTrust
    SrcSpan
l <- EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc
    (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
d -> DynFlags
d { pkgTrustOnLoc :: SrcSpan
pkgTrustOnLoc = SrcSpan
l }

setGenDeriving :: TurnOnFlag -> DynP ()
setGenDeriving :: Bool -> DynP ()
setGenDeriving Bool
True  = EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc EwM (CmdLineP DynFlags) SrcSpan -> (SrcSpan -> DynP ()) -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \SrcSpan
l -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { newDerivOnLoc :: SrcSpan
newDerivOnLoc = SrcSpan
l })
setGenDeriving Bool
False = () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

setDeriveVia :: TurnOnFlag -> DynP ()
setDeriveVia :: Bool -> DynP ()
setDeriveVia Bool
True  = EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc EwM (CmdLineP DynFlags) SrcSpan -> (SrcSpan -> DynP ()) -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \SrcSpan
l -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { deriveViaOnLoc :: SrcSpan
deriveViaOnLoc = SrcSpan
l })
setDeriveVia Bool
False = () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

setOverlappingInsts :: TurnOnFlag -> DynP ()
setOverlappingInsts :: Bool -> DynP ()
setOverlappingInsts Bool
False = () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
setOverlappingInsts Bool
True = do
  SrcSpan
l <- EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { overlapInstLoc :: SrcSpan
overlapInstLoc = SrcSpan
l })

setIncoherentInsts :: TurnOnFlag -> DynP ()
setIncoherentInsts :: Bool -> DynP ()
setIncoherentInsts Bool
False = () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
setIncoherentInsts Bool
True = do
  SrcSpan
l <- EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { incoherentOnLoc :: SrcSpan
incoherentOnLoc = SrcSpan
l })

checkTemplateHaskellOk :: TurnOnFlag -> DynP ()
checkTemplateHaskellOk :: Bool -> DynP ()
checkTemplateHaskellOk Bool
_turn_on
  = EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc EwM (CmdLineP DynFlags) SrcSpan -> (SrcSpan -> DynP ()) -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \SrcSpan
l -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { thOnLoc :: SrcSpan
thOnLoc = SrcSpan
l })

{- **********************************************************************
%*                                                                      *
                DynFlags constructors
%*                                                                      *
%********************************************************************* -}

type DynP = EwM (CmdLineP DynFlags)

upd :: (DynFlags -> DynFlags) -> DynP ()
upd :: (DynFlags -> DynFlags) -> DynP ()
upd DynFlags -> DynFlags
f = CmdLineP DynFlags () -> DynP ()
forall (m :: * -> *) a. Monad m => m a -> EwM m a
liftEwM (do DynFlags
dflags <- CmdLineP DynFlags DynFlags
forall s. CmdLineP s s
getCmdLineState
                    DynFlags -> CmdLineP DynFlags ()
forall s. s -> CmdLineP s ()
putCmdLineState (DynFlags -> CmdLineP DynFlags ())
-> DynFlags -> CmdLineP DynFlags ()
forall a b. (a -> b) -> a -> b
$! DynFlags -> DynFlags
f DynFlags
dflags)

updM :: (DynFlags -> DynP DynFlags) -> DynP ()
updM :: (DynFlags -> DynP DynFlags) -> DynP ()
updM DynFlags -> DynP DynFlags
f = do DynFlags
dflags <- CmdLineP DynFlags DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => m a -> EwM m a
liftEwM CmdLineP DynFlags DynFlags
forall s. CmdLineP s s
getCmdLineState
            DynFlags
dflags' <- DynFlags -> DynP DynFlags
f DynFlags
dflags
            CmdLineP DynFlags () -> DynP ()
forall (m :: * -> *) a. Monad m => m a -> EwM m a
liftEwM (CmdLineP DynFlags () -> DynP ())
-> CmdLineP DynFlags () -> DynP ()
forall a b. (a -> b) -> a -> b
$ DynFlags -> CmdLineP DynFlags ()
forall s. s -> CmdLineP s ()
putCmdLineState (DynFlags -> CmdLineP DynFlags ())
-> DynFlags -> CmdLineP DynFlags ()
forall a b. (a -> b) -> a -> b
$! DynFlags
dflags'

--------------- Constructor functions for OptKind -----------------
noArg :: (DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg :: (DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg DynFlags -> DynFlags
fn = DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd DynFlags -> DynFlags
fn)

noArgM :: (DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
noArgM :: (DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
noArgM DynFlags -> DynP DynFlags
fn = DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynP DynFlags) -> DynP ()
updM DynFlags -> DynP DynFlags
fn)

hasArg :: (String -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg :: ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
fn = ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg ((DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> ([Char] -> DynFlags -> DynFlags) -> [Char] -> DynP ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> DynFlags -> DynFlags
fn)

sepArg :: (String -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
sepArg :: ([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
sepArg [Char] -> DynFlags -> DynFlags
fn = ([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
SepArg ((DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> ([Char] -> DynFlags -> DynFlags) -> [Char] -> DynP ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> DynFlags -> DynFlags
fn)

intSuffix :: (Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix :: (Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix Int -> DynFlags -> DynFlags
fn = (Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Int -> EwM m ()) -> OptKind m
IntSuffix (\Int
n -> (DynFlags -> DynFlags) -> DynP ()
upd (Int -> DynFlags -> DynFlags
fn Int
n))

intSuffixM :: (Int -> DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffixM :: (Int -> DynFlags -> DynP DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffixM Int -> DynFlags -> DynP DynFlags
fn = (Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Int -> EwM m ()) -> OptKind m
IntSuffix (\Int
n -> (DynFlags -> DynP DynFlags) -> DynP ()
updM (Int -> DynFlags -> DynP DynFlags
fn Int
n))

wordSuffix :: (Word -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
wordSuffix :: (Word -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
wordSuffix Word -> DynFlags -> DynFlags
fn = (Word -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Word -> EwM m ()) -> OptKind m
WordSuffix (\Word
n -> (DynFlags -> DynFlags) -> DynP ()
upd (Word -> DynFlags -> DynFlags
fn Word
n))

floatSuffix :: (Float -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
floatSuffix :: (Float -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
floatSuffix Float -> DynFlags -> DynFlags
fn = (Float -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Float -> EwM m ()) -> OptKind m
FloatSuffix (\Float
n -> (DynFlags -> DynFlags) -> DynP ()
upd (Float -> DynFlags -> DynFlags
fn Float
n))

optIntSuffixM :: (Maybe Int -> DynFlags -> DynP DynFlags)
              -> OptKind (CmdLineP DynFlags)
optIntSuffixM :: (Maybe Int -> DynFlags -> DynP DynFlags)
-> OptKind (CmdLineP DynFlags)
optIntSuffixM Maybe Int -> DynFlags -> DynP DynFlags
fn = (Maybe Int -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Maybe Int -> EwM m ()) -> OptKind m
OptIntSuffix (\Maybe Int
mi -> (DynFlags -> DynP DynFlags) -> DynP ()
updM (Maybe Int -> DynFlags -> DynP DynFlags
fn Maybe Int
mi))

setDumpFlag :: DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag :: DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
dump_flag = DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (DumpFlag -> DynP ()
setDumpFlag' DumpFlag
dump_flag)

--------------------------
addWayDynP :: Way -> DynP ()
addWayDynP :: Way -> DynP ()
addWayDynP = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (Way -> DynFlags -> DynFlags) -> Way -> DynP ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Way -> DynFlags -> DynFlags
addWay'

addWay' :: Way -> DynFlags -> DynFlags
addWay' :: Way -> DynFlags -> DynFlags
addWay' Way
w DynFlags
dflags0 =
   let platform :: Platform
platform = DynFlags -> Platform
targetPlatform DynFlags
dflags0
       dflags1 :: DynFlags
dflags1 = DynFlags
dflags0 { targetWays_ :: Ways
targetWays_ = Way -> Ways -> Ways
addWay Way
w (DynFlags -> Ways
targetWays_ DynFlags
dflags0) }
       dflags2 :: DynFlags
dflags2 = (GeneralFlag -> DynFlags -> DynFlags)
-> DynFlags -> [GeneralFlag] -> DynFlags
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag' DynFlags
dflags1
                       (Platform -> Way -> [GeneralFlag]
wayGeneralFlags Platform
platform Way
w)
       dflags3 :: DynFlags
dflags3 = (GeneralFlag -> DynFlags -> DynFlags)
-> DynFlags -> [GeneralFlag] -> DynFlags
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr GeneralFlag -> DynFlags -> DynFlags
unSetGeneralFlag' DynFlags
dflags2
                       (Platform -> Way -> [GeneralFlag]
wayUnsetGeneralFlags Platform
platform Way
w)
   in DynFlags
dflags3

removeWayDyn :: DynP ()
removeWayDyn :: DynP ()
removeWayDyn = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags
dfs { targetWays_ :: Ways
targetWays_ = (Way -> Bool) -> Ways -> Ways
forall a. (a -> Bool) -> Set a -> Set a
Set.filter (Way
WayDyn Way -> Way -> Bool
forall a. Eq a => a -> a -> Bool
/=) (DynFlags -> Ways
targetWays_ DynFlags
dfs) })

--------------------------
setGeneralFlag, unSetGeneralFlag :: GeneralFlag -> DynP ()
setGeneralFlag :: GeneralFlag -> DynP ()
setGeneralFlag   GeneralFlag
f = (DynFlags -> DynFlags) -> DynP ()
upd (GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag' GeneralFlag
f)
unSetGeneralFlag :: GeneralFlag -> DynP ()
unSetGeneralFlag GeneralFlag
f = (DynFlags -> DynFlags) -> DynP ()
upd (GeneralFlag -> DynFlags -> DynFlags
unSetGeneralFlag' GeneralFlag
f)

setGeneralFlag' :: GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag' :: GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag' GeneralFlag
f DynFlags
dflags = ((DynFlags -> DynFlags) -> DynFlags -> DynFlags)
-> DynFlags -> [DynFlags -> DynFlags] -> DynFlags
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (DynFlags -> DynFlags) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
($) (DynFlags -> GeneralFlag -> DynFlags
gopt_set DynFlags
dflags GeneralFlag
f) [DynFlags -> DynFlags]
deps
  where
    deps :: [DynFlags -> DynFlags]
deps = [ if Bool
turn_on then GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag'   GeneralFlag
d
                        else GeneralFlag -> DynFlags -> DynFlags
unSetGeneralFlag' GeneralFlag
d
           | (GeneralFlag
f', Bool
turn_on, GeneralFlag
d) <- [(GeneralFlag, Bool, GeneralFlag)]
impliedGFlags, GeneralFlag
f' GeneralFlag -> GeneralFlag -> Bool
forall a. Eq a => a -> a -> Bool
== GeneralFlag
f ]
        -- When you set f, set the ones it implies
        -- NB: use setGeneralFlag recursively, in case the implied flags
        --     implies further flags

unSetGeneralFlag' :: GeneralFlag -> DynFlags -> DynFlags
unSetGeneralFlag' :: GeneralFlag -> DynFlags -> DynFlags
unSetGeneralFlag' GeneralFlag
f DynFlags
dflags = ((DynFlags -> DynFlags) -> DynFlags -> DynFlags)
-> DynFlags -> [DynFlags -> DynFlags] -> DynFlags
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (DynFlags -> DynFlags) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
($) (DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dflags GeneralFlag
f) [DynFlags -> DynFlags]
deps
  where
    deps :: [DynFlags -> DynFlags]
deps = [ if Bool
turn_on then GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag' GeneralFlag
d
                        else GeneralFlag -> DynFlags -> DynFlags
unSetGeneralFlag' GeneralFlag
d
           | (GeneralFlag
f', Bool
turn_on, GeneralFlag
d) <- [(GeneralFlag, Bool, GeneralFlag)]
impliedOffGFlags, GeneralFlag
f' GeneralFlag -> GeneralFlag -> Bool
forall a. Eq a => a -> a -> Bool
== GeneralFlag
f ]
   -- In general, when you un-set f, we don't un-set the things it implies.
   -- There are however some exceptions, e.g., -fno-strictness implies
   -- -fno-worker-wrapper.
   --
   -- NB: use unSetGeneralFlag' recursively, in case the implied off flags
   --     imply further flags.

--------------------------
setWarningFlag, unSetWarningFlag :: WarningFlag -> DynP ()
setWarningFlag :: WarningFlag -> DynP ()
setWarningFlag   WarningFlag
f = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> WarningFlag -> DynFlags
wopt_set DynFlags
dfs WarningFlag
f)
unSetWarningFlag :: WarningFlag -> DynP ()
unSetWarningFlag WarningFlag
f = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> WarningFlag -> DynFlags
wopt_unset DynFlags
dfs WarningFlag
f)

setFatalWarningFlag, unSetFatalWarningFlag :: WarningFlag -> DynP ()
setFatalWarningFlag :: WarningFlag -> DynP ()
setFatalWarningFlag   WarningFlag
f = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> WarningFlag -> DynFlags
wopt_set_fatal DynFlags
dfs WarningFlag
f)
unSetFatalWarningFlag :: WarningFlag -> DynP ()
unSetFatalWarningFlag WarningFlag
f = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> WarningFlag -> DynFlags
wopt_unset_fatal DynFlags
dfs WarningFlag
f)

setWErrorFlag :: WarningFlag -> DynP ()
setWErrorFlag :: WarningFlag -> DynP ()
setWErrorFlag WarningFlag
flag =
  do { WarningFlag -> DynP ()
setWarningFlag WarningFlag
flag
     ; WarningFlag -> DynP ()
setFatalWarningFlag WarningFlag
flag }

--------------------------
setExtensionFlag, unSetExtensionFlag :: LangExt.Extension -> DynP ()
setExtensionFlag :: Extension -> DynP ()
setExtensionFlag Extension
f = (DynFlags -> DynFlags) -> DynP ()
upd (Extension -> DynFlags -> DynFlags
setExtensionFlag' Extension
f)
unSetExtensionFlag :: Extension -> DynP ()
unSetExtensionFlag Extension
f = (DynFlags -> DynFlags) -> DynP ()
upd (Extension -> DynFlags -> DynFlags
unSetExtensionFlag' Extension
f)

setExtensionFlag', unSetExtensionFlag' :: LangExt.Extension -> DynFlags -> DynFlags
setExtensionFlag' :: Extension -> DynFlags -> DynFlags
setExtensionFlag' Extension
f DynFlags
dflags = ((DynFlags -> DynFlags) -> DynFlags -> DynFlags)
-> DynFlags -> [DynFlags -> DynFlags] -> DynFlags
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (DynFlags -> DynFlags) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
($) (DynFlags -> Extension -> DynFlags
xopt_set DynFlags
dflags Extension
f) [DynFlags -> DynFlags]
deps
  where
    deps :: [DynFlags -> DynFlags]
deps = [ if Bool
turn_on then Extension -> DynFlags -> DynFlags
setExtensionFlag'   Extension
d
                        else Extension -> DynFlags -> DynFlags
unSetExtensionFlag' Extension
d
           | (Extension
f', Bool
turn_on, Extension
d) <- [(Extension, Bool, Extension)]
impliedXFlags, Extension
f' Extension -> Extension -> Bool
forall a. Eq a => a -> a -> Bool
== Extension
f ]
        -- When you set f, set the ones it implies
        -- NB: use setExtensionFlag recursively, in case the implied flags
        --     implies further flags

unSetExtensionFlag' :: Extension -> DynFlags -> DynFlags
unSetExtensionFlag' Extension
f DynFlags
dflags = DynFlags -> Extension -> DynFlags
xopt_unset DynFlags
dflags Extension
f
   -- When you un-set f, however, we don't un-set the things it implies
   --      (except for -fno-glasgow-exts, which is treated specially)

--------------------------
alterFileSettings :: (FileSettings -> FileSettings) -> DynFlags -> DynFlags
alterFileSettings :: (FileSettings -> FileSettings) -> DynFlags -> DynFlags
alterFileSettings FileSettings -> FileSettings
f DynFlags
dynFlags = DynFlags
dynFlags { fileSettings :: FileSettings
fileSettings = FileSettings -> FileSettings
f (DynFlags -> FileSettings
fileSettings DynFlags
dynFlags) }

alterToolSettings :: (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings :: (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ToolSettings -> ToolSettings
f DynFlags
dynFlags = DynFlags
dynFlags { toolSettings :: ToolSettings
toolSettings = ToolSettings -> ToolSettings
f (DynFlags -> ToolSettings
toolSettings DynFlags
dynFlags) }

--------------------------
setDumpFlag' :: DumpFlag -> DynP ()
setDumpFlag' :: DumpFlag -> DynP ()
setDumpFlag' DumpFlag
dump_flag
  = do (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> DumpFlag -> DynFlags
dopt_set DynFlags
dfs DumpFlag
dump_flag)
       Bool -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when Bool
want_recomp DynP ()
forceRecompile
    where -- Certain dumpy-things are really interested in what's going
          -- on during recompilation checking, so in those cases we
          -- don't want to turn it off.
          want_recomp :: Bool
want_recomp = DumpFlag
dump_flag DumpFlag -> [DumpFlag] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [DumpFlag
Opt_D_dump_if_trace,
                                             DumpFlag
Opt_D_dump_hi_diffs,
                                             DumpFlag
Opt_D_no_debug_output]

forceRecompile :: DynP ()
-- Whenever we -ddump, force recompilation (by switching off the
-- recompilation checker), else you don't see the dump! However,
-- don't switch it off in --make mode, else *everything* gets
-- recompiled which probably isn't what you want
forceRecompile :: DynP ()
forceRecompile = do DynFlags
dfs <- CmdLineP DynFlags DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => m a -> EwM m a
liftEwM CmdLineP DynFlags DynFlags
forall s. CmdLineP s s
getCmdLineState
                    Bool -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (DynFlags -> Bool
force_recomp DynFlags
dfs) (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_ForceRecomp)
        where
          force_recomp :: DynFlags -> Bool
force_recomp DynFlags
dfs = GhcMode -> Bool
isOneShot (DynFlags -> GhcMode
ghcMode DynFlags
dfs)


setVerboseCore2Core :: DynP ()
setVerboseCore2Core :: DynP ()
setVerboseCore2Core = DumpFlag -> DynP ()
setDumpFlag' DumpFlag
Opt_D_verbose_core2core

setVerbosity :: Maybe Int -> DynP ()
setVerbosity :: Maybe Int -> DynP ()
setVerbosity Maybe Int
mb_n = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags
dfs{ verbosity :: Int
verbosity = Maybe Int
mb_n Maybe Int -> Int -> Int
forall a. Maybe a -> a -> a
`orElse` Int
3 })

setDebugLevel :: Maybe Int -> DynP ()
setDebugLevel :: Maybe Int -> DynP ()
setDebugLevel Maybe Int
mb_n =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> DynFlags
exposeSyms (DynFlags -> DynFlags) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ DynFlags
dfs{ debugLevel :: Int
debugLevel = Int
n })
  where
    n :: Int
n = Maybe Int
mb_n Maybe Int -> Int -> Int
forall a. Maybe a -> a -> a
`orElse` Int
2
    exposeSyms :: DynFlags -> DynFlags
exposeSyms
      | Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
2     = GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag' GeneralFlag
Opt_ExposeInternalSymbols
      | Bool
otherwise = DynFlags -> DynFlags
forall a. a -> a
id

data PkgDbRef
  = GlobalPkgDb
  | UserPkgDb
  | PkgDbPath FilePath
  deriving PkgDbRef -> PkgDbRef -> Bool
(PkgDbRef -> PkgDbRef -> Bool)
-> (PkgDbRef -> PkgDbRef -> Bool) -> Eq PkgDbRef
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PkgDbRef -> PkgDbRef -> Bool
$c/= :: PkgDbRef -> PkgDbRef -> Bool
== :: PkgDbRef -> PkgDbRef -> Bool
$c== :: PkgDbRef -> PkgDbRef -> Bool
Eq

addPkgDbRef :: PkgDbRef -> DynP ()
addPkgDbRef :: PkgDbRef -> DynP ()
addPkgDbRef PkgDbRef
p = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
s ->
  DynFlags
s { packageDBFlags :: [PackageDBFlag]
packageDBFlags = PkgDbRef -> PackageDBFlag
PackageDB PkgDbRef
p PackageDBFlag -> [PackageDBFlag] -> [PackageDBFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [PackageDBFlag]
packageDBFlags DynFlags
s }

removeUserPkgDb :: DynP ()
removeUserPkgDb :: DynP ()
removeUserPkgDb = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
s ->
  DynFlags
s { packageDBFlags :: [PackageDBFlag]
packageDBFlags = PackageDBFlag
NoUserPackageDB PackageDBFlag -> [PackageDBFlag] -> [PackageDBFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [PackageDBFlag]
packageDBFlags DynFlags
s }

removeGlobalPkgDb :: DynP ()
removeGlobalPkgDb :: DynP ()
removeGlobalPkgDb = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
s ->
 DynFlags
s { packageDBFlags :: [PackageDBFlag]
packageDBFlags = PackageDBFlag
NoGlobalPackageDB PackageDBFlag -> [PackageDBFlag] -> [PackageDBFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [PackageDBFlag]
packageDBFlags DynFlags
s }

clearPkgDb :: DynP ()
clearPkgDb :: DynP ()
clearPkgDb = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
s ->
  DynFlags
s { packageDBFlags :: [PackageDBFlag]
packageDBFlags = PackageDBFlag
ClearPackageDBs PackageDBFlag -> [PackageDBFlag] -> [PackageDBFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [PackageDBFlag]
packageDBFlags DynFlags
s }

parsePackageFlag :: String                 -- the flag
                 -> ReadP PackageArg       -- type of argument
                 -> String                 -- string to parse
                 -> PackageFlag
parsePackageFlag :: [Char] -> ReadP PackageArg -> [Char] -> PackageFlag
parsePackageFlag [Char]
flag ReadP PackageArg
arg_parse [Char]
str
 = case ((PackageFlag, [Char]) -> Bool)
-> [(PackageFlag, [Char])] -> [(PackageFlag, [Char])]
forall a. (a -> Bool) -> [a] -> [a]
filter (([Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
==[Char]
"")([Char] -> Bool)
-> ((PackageFlag, [Char]) -> [Char])
-> (PackageFlag, [Char])
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(PackageFlag, [Char]) -> [Char]
forall a b. (a, b) -> b
snd) (ReadP PackageFlag -> ReadS PackageFlag
forall a. ReadP a -> ReadS a
readP_to_S ReadP PackageFlag
parse [Char]
str) of
    [(PackageFlag
r, [Char]
"")] -> PackageFlag
r
    [(PackageFlag, [Char])]
_ -> GhcException -> PackageFlag
forall a. GhcException -> a
throwGhcException (GhcException -> PackageFlag) -> GhcException -> PackageFlag
forall a b. (a -> b) -> a -> b
$ [Char] -> GhcException
CmdLineError ([Char]
"Can't parse package flag: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
str)
  where doc :: [Char]
doc = [Char]
flag [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
" " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
str
        parse :: ReadP PackageFlag
parse = do
            PackageArg
pkg_arg <- ReadP PackageArg -> ReadP PackageArg
forall {b}. ReadP b -> ReadP b
tok ReadP PackageArg
arg_parse
            let mk_expose :: ModRenaming -> PackageFlag
mk_expose = [Char] -> PackageArg -> ModRenaming -> PackageFlag
ExposePackage [Char]
doc PackageArg
pkg_arg
            ( do [Char]
_ <- ReadP [Char] -> ReadP [Char]
forall {b}. ReadP b -> ReadP b
tok (ReadP [Char] -> ReadP [Char]) -> ReadP [Char] -> ReadP [Char]
forall a b. (a -> b) -> a -> b
$ [Char] -> ReadP [Char]
string [Char]
"with"
                 ([(ModuleName, ModuleName)] -> PackageFlag)
-> ReadP [(ModuleName, ModuleName)] -> ReadP PackageFlag
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ModRenaming -> PackageFlag
mk_expose (ModRenaming -> PackageFlag)
-> ([(ModuleName, ModuleName)] -> ModRenaming)
-> [(ModuleName, ModuleName)]
-> PackageFlag
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> [(ModuleName, ModuleName)] -> ModRenaming
ModRenaming Bool
True) ReadP [(ModuleName, ModuleName)]
parseRns
             ReadP PackageFlag -> ReadP PackageFlag -> ReadP PackageFlag
forall a. ReadP a -> ReadP a -> ReadP a
<++ ([(ModuleName, ModuleName)] -> PackageFlag)
-> ReadP [(ModuleName, ModuleName)] -> ReadP PackageFlag
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ModRenaming -> PackageFlag
mk_expose (ModRenaming -> PackageFlag)
-> ([(ModuleName, ModuleName)] -> ModRenaming)
-> [(ModuleName, ModuleName)]
-> PackageFlag
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> [(ModuleName, ModuleName)] -> ModRenaming
ModRenaming Bool
False) ReadP [(ModuleName, ModuleName)]
parseRns
             ReadP PackageFlag -> ReadP PackageFlag -> ReadP PackageFlag
forall a. ReadP a -> ReadP a -> ReadP a
<++ PackageFlag -> ReadP PackageFlag
forall (m :: * -> *) a. Monad m => a -> m a
return (ModRenaming -> PackageFlag
mk_expose (Bool -> [(ModuleName, ModuleName)] -> ModRenaming
ModRenaming Bool
True [])))
        parseRns :: ReadP [(ModuleName, ModuleName)]
parseRns = do Char
_ <- ReadP Char -> ReadP Char
forall {b}. ReadP b -> ReadP b
tok (ReadP Char -> ReadP Char) -> ReadP Char -> ReadP Char
forall a b. (a -> b) -> a -> b
$ Char -> ReadP Char
R.char Char
'('
                      [(ModuleName, ModuleName)]
rns <- ReadP [(ModuleName, ModuleName)]
-> ReadP [(ModuleName, ModuleName)]
forall {b}. ReadP b -> ReadP b
tok (ReadP [(ModuleName, ModuleName)]
 -> ReadP [(ModuleName, ModuleName)])
-> ReadP [(ModuleName, ModuleName)]
-> ReadP [(ModuleName, ModuleName)]
forall a b. (a -> b) -> a -> b
$ ReadP (ModuleName, ModuleName)
-> ReadP Char -> ReadP [(ModuleName, ModuleName)]
forall a sep. ReadP a -> ReadP sep -> ReadP [a]
sepBy ReadP (ModuleName, ModuleName)
parseItem (ReadP Char -> ReadP Char
forall {b}. ReadP b -> ReadP b
tok (ReadP Char -> ReadP Char) -> ReadP Char -> ReadP Char
forall a b. (a -> b) -> a -> b
$ Char -> ReadP Char
R.char Char
',')
                      Char
_ <- ReadP Char -> ReadP Char
forall {b}. ReadP b -> ReadP b
tok (ReadP Char -> ReadP Char) -> ReadP Char -> ReadP Char
forall a b. (a -> b) -> a -> b
$ Char -> ReadP Char
R.char Char
')'
                      [(ModuleName, ModuleName)] -> ReadP [(ModuleName, ModuleName)]
forall (m :: * -> *) a. Monad m => a -> m a
return [(ModuleName, ModuleName)]
rns
        parseItem :: ReadP (ModuleName, ModuleName)
parseItem = do
            ModuleName
orig <- ReadP ModuleName -> ReadP ModuleName
forall {b}. ReadP b -> ReadP b
tok (ReadP ModuleName -> ReadP ModuleName)
-> ReadP ModuleName -> ReadP ModuleName
forall a b. (a -> b) -> a -> b
$ ReadP ModuleName
parseModuleName
            (do [Char]
_ <- ReadP [Char] -> ReadP [Char]
forall {b}. ReadP b -> ReadP b
tok (ReadP [Char] -> ReadP [Char]) -> ReadP [Char] -> ReadP [Char]
forall a b. (a -> b) -> a -> b
$ [Char] -> ReadP [Char]
string [Char]
"as"
                ModuleName
new <- ReadP ModuleName -> ReadP ModuleName
forall {b}. ReadP b -> ReadP b
tok (ReadP ModuleName -> ReadP ModuleName)
-> ReadP ModuleName -> ReadP ModuleName
forall a b. (a -> b) -> a -> b
$ ReadP ModuleName
parseModuleName
                (ModuleName, ModuleName) -> ReadP (ModuleName, ModuleName)
forall (m :: * -> *) a. Monad m => a -> m a
return (ModuleName
orig, ModuleName
new)
              ReadP (ModuleName, ModuleName)
-> ReadP (ModuleName, ModuleName) -> ReadP (ModuleName, ModuleName)
forall a. ReadP a -> ReadP a -> ReadP a
+++
             (ModuleName, ModuleName) -> ReadP (ModuleName, ModuleName)
forall (m :: * -> *) a. Monad m => a -> m a
return (ModuleName
orig, ModuleName
orig))
        tok :: ReadP b -> ReadP b
tok ReadP b
m = ReadP b
m ReadP b -> (b -> ReadP b) -> ReadP b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \b
x -> ReadP ()
skipSpaces ReadP () -> ReadP b -> ReadP b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> b -> ReadP b
forall (m :: * -> *) a. Monad m => a -> m a
return b
x

exposePackage, exposePackageId, hidePackage,
        exposePluginPackage, exposePluginPackageId,
        ignorePackage,
        trustPackage, distrustPackage :: String -> DynP ()
exposePackage :: [Char] -> DynP ()
exposePackage [Char]
p = (DynFlags -> DynFlags) -> DynP ()
upd ([Char] -> DynFlags -> DynFlags
exposePackage' [Char]
p)
exposePackageId :: [Char] -> DynP ()
exposePackageId [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ packageFlags :: [PackageFlag]
packageFlags =
    [Char] -> ReadP PackageArg -> [Char] -> PackageFlag
parsePackageFlag [Char]
"-package-id" ReadP PackageArg
parseUnitArg [Char]
p PackageFlag -> [PackageFlag] -> [PackageFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [PackageFlag]
packageFlags DynFlags
s })
exposePluginPackage :: [Char] -> DynP ()
exposePluginPackage [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ pluginPackageFlags :: [PackageFlag]
pluginPackageFlags =
    [Char] -> ReadP PackageArg -> [Char] -> PackageFlag
parsePackageFlag [Char]
"-plugin-package" ReadP PackageArg
parsePackageArg [Char]
p PackageFlag -> [PackageFlag] -> [PackageFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [PackageFlag]
pluginPackageFlags DynFlags
s })
exposePluginPackageId :: [Char] -> DynP ()
exposePluginPackageId [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ pluginPackageFlags :: [PackageFlag]
pluginPackageFlags =
    [Char] -> ReadP PackageArg -> [Char] -> PackageFlag
parsePackageFlag [Char]
"-plugin-package-id" ReadP PackageArg
parseUnitArg [Char]
p PackageFlag -> [PackageFlag] -> [PackageFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [PackageFlag]
pluginPackageFlags DynFlags
s })
hidePackage :: [Char] -> DynP ()
hidePackage [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ packageFlags :: [PackageFlag]
packageFlags = [Char] -> PackageFlag
HidePackage [Char]
p PackageFlag -> [PackageFlag] -> [PackageFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [PackageFlag]
packageFlags DynFlags
s })
ignorePackage :: [Char] -> DynP ()
ignorePackage [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ ignorePackageFlags :: [IgnorePackageFlag]
ignorePackageFlags = [Char] -> IgnorePackageFlag
IgnorePackage [Char]
p IgnorePackageFlag -> [IgnorePackageFlag] -> [IgnorePackageFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [IgnorePackageFlag]
ignorePackageFlags DynFlags
s })

trustPackage :: [Char] -> DynP ()
trustPackage [Char]
p = [Char] -> DynP ()
exposePackage [Char]
p DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> -- both trust and distrust also expose a package
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ trustFlags :: [TrustFlag]
trustFlags = [Char] -> TrustFlag
TrustPackage [Char]
p TrustFlag -> [TrustFlag] -> [TrustFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [TrustFlag]
trustFlags DynFlags
s })
distrustPackage :: [Char] -> DynP ()
distrustPackage [Char]
p = [Char] -> DynP ()
exposePackage [Char]
p DynP () -> DynP () -> DynP ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ trustFlags :: [TrustFlag]
trustFlags = [Char] -> TrustFlag
DistrustPackage [Char]
p TrustFlag -> [TrustFlag] -> [TrustFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [TrustFlag]
trustFlags DynFlags
s })

exposePackage' :: String -> DynFlags -> DynFlags
exposePackage' :: [Char] -> DynFlags -> DynFlags
exposePackage' [Char]
p DynFlags
dflags
    = DynFlags
dflags { packageFlags :: [PackageFlag]
packageFlags =
            [Char] -> ReadP PackageArg -> [Char] -> PackageFlag
parsePackageFlag [Char]
"-package" ReadP PackageArg
parsePackageArg [Char]
p PackageFlag -> [PackageFlag] -> [PackageFlag]
forall a. a -> [a] -> [a]
: DynFlags -> [PackageFlag]
packageFlags DynFlags
dflags }

parsePackageArg :: ReadP PackageArg
parsePackageArg :: ReadP PackageArg
parsePackageArg =
    ([Char] -> PackageArg) -> ReadP [Char] -> ReadP PackageArg
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [Char] -> PackageArg
PackageArg ((Char -> Bool) -> ReadP [Char]
munch1 (\Char
c -> Char -> Bool
isAlphaNum Char
c Bool -> Bool -> Bool
|| Char
c Char -> [Char] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Char]
":-_."))

parseUnitArg :: ReadP PackageArg
parseUnitArg :: ReadP PackageArg
parseUnitArg =
    (Unit -> PackageArg) -> ReadP Unit -> ReadP PackageArg
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Unit -> PackageArg
UnitIdArg ReadP Unit
parseUnit

setUnitId :: String -> DynFlags -> DynFlags
setUnitId :: [Char] -> DynFlags -> DynFlags
setUnitId [Char]
p DynFlags
d = DynFlags
d { homeUnitId_ :: UnitId
homeUnitId_ = [Char] -> UnitId
stringToUnitId [Char]
p }

-- If we're linking a binary, then only backends that produce object
-- code are allowed (requests for other target types are ignored).
setBackend :: Backend -> DynP ()
setBackend :: Backend -> DynP ()
setBackend Backend
l = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \ DynFlags
dfs ->
  if DynFlags -> GhcLink
ghcLink DynFlags
dfs GhcLink -> GhcLink -> Bool
forall a. Eq a => a -> a -> Bool
/= GhcLink
LinkBinary Bool -> Bool -> Bool
|| Backend -> Bool
backendProducesObject Backend
l
  then DynFlags
dfs{ backend :: Backend
backend = Backend
l }
  else DynFlags
dfs

-- Changes the target only if we're compiling object code.  This is
-- used by -fasm and -fllvm, which switch from one to the other, but
-- not from bytecode to object-code.  The idea is that -fasm/-fllvm
-- can be safely used in an OPTIONS_GHC pragma.
setObjBackend :: Backend -> DynP ()
setObjBackend :: Backend -> DynP ()
setObjBackend Backend
l = (DynFlags -> DynP DynFlags) -> DynP ()
updM DynFlags -> DynP DynFlags
set
  where
   set :: DynFlags -> DynP DynFlags
set DynFlags
dflags
     | Backend -> Bool
backendProducesObject (DynFlags -> Backend
backend DynFlags
dflags)
       = DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return (DynFlags -> DynP DynFlags) -> DynFlags -> DynP DynFlags
forall a b. (a -> b) -> a -> b
$ DynFlags
dflags { backend :: Backend
backend = Backend
l }
     | Bool
otherwise = DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return DynFlags
dflags

setOptLevel :: Int -> DynFlags -> DynP DynFlags
setOptLevel :: Int -> DynFlags -> DynP DynFlags
setOptLevel Int
n DynFlags
dflags = DynFlags -> DynP DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> DynFlags -> DynFlags
updOptLevel Int
n DynFlags
dflags)

checkOptLevel :: Int -> DynFlags -> Either String DynFlags
checkOptLevel :: Int -> DynFlags -> Either [Char] DynFlags
checkOptLevel Int
n DynFlags
dflags
   | DynFlags -> Backend
backend DynFlags
dflags Backend -> Backend -> Bool
forall a. Eq a => a -> a -> Bool
== Backend
Interpreter Bool -> Bool -> Bool
&& Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
0
     = [Char] -> Either [Char] DynFlags
forall a b. a -> Either a b
Left [Char]
"-O conflicts with --interactive; -O ignored."
   | Bool
otherwise
     = DynFlags -> Either [Char] DynFlags
forall a b. b -> Either a b
Right DynFlags
dflags

setCallerCcFilters :: String -> DynP ()
setCallerCcFilters :: [Char] -> DynP ()
setCallerCcFilters [Char]
arg =
  case [Char] -> Either [Char] CallerCcFilter
parseCallerCcFilter [Char]
arg of
    Right CallerCcFilter
filt -> (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
d -> DynFlags
d { callerCcFilters :: [CallerCcFilter]
callerCcFilters = CallerCcFilter
filt CallerCcFilter -> [CallerCcFilter] -> [CallerCcFilter]
forall a. a -> [a] -> [a]
: DynFlags -> [CallerCcFilter]
callerCcFilters DynFlags
d }
    Left [Char]
err -> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
addErr [Char]
err

setMainIs :: String -> DynP ()
setMainIs :: [Char] -> DynP ()
setMainIs [Char]
arg
  | Bool -> Bool
not ([Char] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Char]
main_fn) Bool -> Bool -> Bool
&& Char -> Bool
isLower ([Char] -> Char
forall a. [a] -> a
head [Char]
main_fn)
     -- The arg looked like "Foo.Bar.baz"
  = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
d -> DynFlags
d { mainFunIs :: Maybe [Char]
mainFunIs = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
main_fn,
                    mainModuleNameIs :: ModuleName
mainModuleNameIs = [Char] -> ModuleName
mkModuleName [Char]
main_mod }

  | Char -> Bool
isUpper ([Char] -> Char
forall a. [a] -> a
head [Char]
arg)  -- The arg looked like "Foo" or "Foo.Bar"
  = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
d -> DynFlags
d { mainModuleNameIs :: ModuleName
mainModuleNameIs = [Char] -> ModuleName
mkModuleName [Char]
arg }

  | Bool
otherwise                   -- The arg looked like "baz"
  = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
d -> DynFlags
d { mainFunIs :: Maybe [Char]
mainFunIs = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
arg }
  where
    ([Char]
main_mod, [Char]
main_fn) = [Char] -> (Char -> Bool) -> ([Char], [Char])
splitLongestPrefix [Char]
arg (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'.')

addLdInputs :: Option -> DynFlags -> DynFlags
addLdInputs :: Option -> DynFlags -> DynFlags
addLdInputs Option
p DynFlags
dflags = DynFlags
dflags{ldInputs :: [Option]
ldInputs = DynFlags -> [Option]
ldInputs DynFlags
dflags [Option] -> [Option] -> [Option]
forall a. [a] -> [a] -> [a]
++ [Option
p]}

-- -----------------------------------------------------------------------------
-- Load dynflags from environment files.

setFlagsFromEnvFile :: FilePath -> String -> DynP ()
setFlagsFromEnvFile :: [Char] -> [Char] -> DynP ()
setFlagsFromEnvFile [Char]
envfile [Char]
content = do
  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_HideAllPackages
  [Char] -> [Char] -> DynP ()
parseEnvFile [Char]
envfile [Char]
content

parseEnvFile :: FilePath -> String -> DynP ()
parseEnvFile :: [Char] -> [Char] -> DynP ()
parseEnvFile [Char]
envfile = ([Char] -> DynP ()) -> [[Char]] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ [Char] -> DynP ()
parseEntry ([[Char]] -> DynP ()) -> ([Char] -> [[Char]]) -> [Char] -> DynP ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [[Char]]
lines
  where
    parseEntry :: [Char] -> DynP ()
parseEntry [Char]
str = case [Char] -> [[Char]]
words [Char]
str of
      ([Char]
"package-db": [[Char]]
_)     -> PkgDbRef -> DynP ()
addPkgDbRef ([Char] -> PkgDbRef
PkgDbPath ([Char]
envdir [Char] -> ShowS
</> [Char]
db))
        -- relative package dbs are interpreted relative to the env file
        where envdir :: [Char]
envdir = ShowS
takeDirectory [Char]
envfile
              db :: [Char]
db     = Int -> ShowS
forall a. Int -> [a] -> [a]
drop Int
11 [Char]
str
      [[Char]
"clear-package-db"]  -> DynP ()
clearPkgDb
      [[Char]
"global-package-db"] -> PkgDbRef -> DynP ()
addPkgDbRef PkgDbRef
GlobalPkgDb
      [[Char]
"user-package-db"]   -> PkgDbRef -> DynP ()
addPkgDbRef PkgDbRef
UserPkgDb
      [[Char]
"package-id", [Char]
pkgid] -> [Char] -> DynP ()
exposePackageId [Char]
pkgid
      ((Char
'-':Char
'-':[Char]
_):[[Char]]
_)       -> () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return () -- comments
      -- and the original syntax introduced in 7.10:
      [[Char]
pkgid]               -> [Char] -> DynP ()
exposePackageId [Char]
pkgid
      []                    -> () -> DynP ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
      [[Char]]
_                     -> GhcException -> DynP ()
forall a. GhcException -> a
throwGhcException (GhcException -> DynP ()) -> GhcException -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char] -> GhcException
CmdLineError ([Char] -> GhcException) -> [Char] -> GhcException
forall a b. (a -> b) -> a -> b
$
                                    [Char]
"Can't parse environment file entry: "
                                 [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
envfile [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
": " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
str


-----------------------------------------------------------------------------
-- Paths & Libraries

addImportPath, addLibraryPath, addIncludePath, addFrameworkPath :: FilePath -> DynP ()

-- -i on its own deletes the import paths
addImportPath :: [Char] -> DynP ()
addImportPath [Char]
"" = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{importPaths :: [[Char]]
importPaths = []})
addImportPath [Char]
p  = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{importPaths :: [[Char]]
importPaths = DynFlags -> [[Char]]
importPaths DynFlags
s [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [Char] -> [[Char]]
splitPathList [Char]
p})

addLibraryPath :: [Char] -> DynP ()
addLibraryPath [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{libraryPaths :: [[Char]]
libraryPaths = DynFlags -> [[Char]]
libraryPaths DynFlags
s [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [Char] -> [[Char]]
splitPathList [Char]
p})

addIncludePath :: [Char] -> DynP ()
addIncludePath [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{includePaths :: IncludeSpecs
includePaths =
                  IncludeSpecs -> [[Char]] -> IncludeSpecs
addGlobalInclude (DynFlags -> IncludeSpecs
includePaths DynFlags
s) ([Char] -> [[Char]]
splitPathList [Char]
p)})

addFrameworkPath :: [Char] -> DynP ()
addFrameworkPath [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{frameworkPaths :: [[Char]]
frameworkPaths = DynFlags -> [[Char]]
frameworkPaths DynFlags
s [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [Char] -> [[Char]]
splitPathList [Char]
p})

#if !defined(mingw32_HOST_OS)
split_marker :: Char
split_marker :: Char
split_marker = Char
':'   -- not configurable (ToDo)
#endif

splitPathList :: String -> [String]
splitPathList :: [Char] -> [[Char]]
splitPathList [Char]
s = ([Char] -> Bool) -> [[Char]] -> [[Char]]
forall a. (a -> Bool) -> [a] -> [a]
filter [Char] -> Bool
forall (f :: * -> *) a. Foldable f => f a -> Bool
notNull ([Char] -> [[Char]]
splitUp [Char]
s)
                -- empty paths are ignored: there might be a trailing
                -- ':' in the initial list, for example.  Empty paths can
                -- cause confusion when they are translated into -I options
                -- for passing to gcc.
  where
#if !defined(mingw32_HOST_OS)
    splitUp :: [Char] -> [[Char]]
splitUp [Char]
xs = Char -> [Char] -> [[Char]]
split Char
split_marker [Char]
xs
#else
     -- Windows: 'hybrid' support for DOS-style paths in directory lists.
     --
     -- That is, if "foo:bar:baz" is used, this interpreted as
     -- consisting of three entries, 'foo', 'bar', 'baz'.
     -- However, with "c:/foo:c:\\foo;x:/bar", this is interpreted
     -- as 3 elts, "c:/foo", "c:\\foo", "x:/bar"
     --
     -- Notice that no attempt is made to fully replace the 'standard'
     -- split marker ':' with the Windows / DOS one, ';'. The reason being
     -- that this will cause too much breakage for users & ':' will
     -- work fine even with DOS paths, if you're not insisting on being silly.
     -- So, use either.
    splitUp []             = []
    splitUp (x:':':div:xs) | div `elem` dir_markers
                           = ((x:':':div:p): splitUp rs)
                           where
                              (p,rs) = findNextPath xs
          -- we used to check for existence of the path here, but that
          -- required the IO monad to be threaded through the command-line
          -- parser which is quite inconvenient.  The
    splitUp xs = cons p (splitUp rs)
               where
                 (p,rs) = findNextPath xs

                 cons "" xs = xs
                 cons x  xs = x:xs

    -- will be called either when we've consumed nought or the
    -- "<Drive>:/" part of a DOS path, so splitting is just a Q of
    -- finding the next split marker.
    findNextPath xs =
        case break (`elem` split_markers) xs of
           (p, _:ds) -> (p, ds)
           (p, xs)   -> (p, xs)

    split_markers :: [Char]
    split_markers = [':', ';']

    dir_markers :: [Char]
    dir_markers = ['/', '\\']
#endif

-- -----------------------------------------------------------------------------
-- tmpDir, where we store temporary files.

setTmpDir :: FilePath -> DynFlags -> DynFlags
setTmpDir :: [Char] -> DynFlags -> DynFlags
setTmpDir [Char]
dir = (FileSettings -> FileSettings) -> DynFlags -> DynFlags
alterFileSettings ((FileSettings -> FileSettings) -> DynFlags -> DynFlags)
-> (FileSettings -> FileSettings) -> DynFlags -> DynFlags
forall a b. (a -> b) -> a -> b
$ \FileSettings
s -> FileSettings
s { fileSettings_tmpDir :: [Char]
fileSettings_tmpDir = ShowS
normalise [Char]
dir }
  -- we used to fix /cygdrive/c/.. on Windows, but this doesn't
  -- seem necessary now --SDM 7/2/2008

-----------------------------------------------------------------------------
-- RTS opts

setRtsOpts :: String -> DynP ()
setRtsOpts :: [Char] -> DynP ()
setRtsOpts [Char]
arg  = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \ DynFlags
d -> DynFlags
d {rtsOpts :: Maybe [Char]
rtsOpts = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just [Char]
arg}

setRtsOptsEnabled :: RtsOptsEnabled -> DynP ()
setRtsOptsEnabled :: RtsOptsEnabled -> DynP ()
setRtsOptsEnabled RtsOptsEnabled
arg  = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \ DynFlags
d -> DynFlags
d {rtsOptsEnabled :: RtsOptsEnabled
rtsOptsEnabled = RtsOptsEnabled
arg}

-----------------------------------------------------------------------------
-- Hpc stuff

setOptHpcDir :: String -> DynP ()
setOptHpcDir :: [Char] -> DynP ()
setOptHpcDir [Char]
arg  = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \ DynFlags
d -> DynFlags
d {hpcDir :: [Char]
hpcDir = [Char]
arg}

-----------------------------------------------------------------------------
-- Via-C compilation stuff

-- There are some options that we need to pass to gcc when compiling
-- Haskell code via C, but are only supported by recent versions of
-- gcc.  The configure script decides which of these options we need,
-- and puts them in the "settings" file in $topdir. The advantage of
-- having these in a separate file is that the file can be created at
-- install-time depending on the available gcc version, and even
-- re-generated later if gcc is upgraded.
--
-- The options below are not dependent on the version of gcc, only the
-- platform.

picCCOpts :: DynFlags -> [String]
picCCOpts :: DynFlags -> [[Char]]
picCCOpts DynFlags
dflags = [[Char]]
pieOpts [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ [[Char]]
picOpts
  where
    picOpts :: [[Char]]
picOpts =
      case Platform -> OS
platformOS (DynFlags -> Platform
targetPlatform DynFlags
dflags) of
      OS
OSDarwin
          -- Apple prefers to do things the other way round.
          -- PIC is on by default.
          -- -mdynamic-no-pic:
          --     Turn off PIC code generation.
          -- -fno-common:
          --     Don't generate "common" symbols - these are unwanted
          --     in dynamic libraries.

       | GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIC DynFlags
dflags -> [[Char]
"-fno-common", [Char]
"-U__PIC__", [Char]
"-D__PIC__"]
       | Bool
otherwise           -> [[Char]
"-mdynamic-no-pic"]
      OS
OSMinGW32 -- no -fPIC for Windows
       | GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIC DynFlags
dflags -> [[Char]
"-U__PIC__", [Char]
"-D__PIC__"]
       | Bool
otherwise           -> []
      OS
_
      -- we need -fPIC for C files when we are compiling with -dynamic,
      -- otherwise things like stub.c files don't get compiled
      -- correctly.  They need to reference data in the Haskell
      -- objects, but can't without -fPIC.  See
      -- https://gitlab.haskell.org/ghc/ghc/wikis/commentary/position-independent-code
       | GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIC DynFlags
dflags Bool -> Bool -> Bool
|| Way
WayDyn Way -> Ways -> Bool
forall a. Ord a => a -> Set a -> Bool
`Set.member` DynFlags -> Ways
ways DynFlags
dflags ->
          [[Char]
"-fPIC", [Char]
"-U__PIC__", [Char]
"-D__PIC__"]
      -- gcc may be configured to have PIC on by default, let's be
      -- explicit here, see #15847
       | Bool
otherwise -> [[Char]
"-fno-PIC"]

    pieOpts :: [[Char]]
pieOpts
      | GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PICExecutable DynFlags
dflags       = [[Char]
"-pie"]
        -- See Note [No PIE when linking]
      | ToolSettings -> Bool
toolSettings_ccSupportsNoPie (DynFlags -> ToolSettings
toolSettings DynFlags
dflags) = [[Char]
"-no-pie"]
      | Bool
otherwise                           = []


{-
Note [No PIE while linking]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
As of 2016 some Linux distributions (e.g. Debian) have started enabling -pie by
default in their gcc builds. This is incompatible with -r as it implies that we
are producing an executable. Consequently, we must manually pass -no-pie to gcc
when joining object files or linking dynamic libraries. Unless, of course, the
user has explicitly requested a PIE executable with -pie. See #12759.
-}

picPOpts :: DynFlags -> [String]
picPOpts :: DynFlags -> [[Char]]
picPOpts DynFlags
dflags
 | GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIC DynFlags
dflags = [[Char]
"-U__PIC__", [Char]
"-D__PIC__"]
 | Bool
otherwise           = []

-- -----------------------------------------------------------------------------
-- Compiler Info

compilerInfo :: DynFlags -> [(String, String)]
compilerInfo :: DynFlags -> [([Char], [Char])]
compilerInfo DynFlags
dflags
    = -- We always make "Project name" be first to keep parsing in
      -- other languages simple, i.e. when looking for other fields,
      -- you don't have to worry whether there is a leading '[' or not
      ([Char]
"Project name",                 [Char]
cProjectName)
      -- Next come the settings, so anything else can be overridden
      -- in the settings file (as "lookup" uses the first match for the
      -- key)
    ([Char], [Char]) -> [([Char], [Char])] -> [([Char], [Char])]
forall a. a -> [a] -> [a]
: (([Char], [Char]) -> ([Char], [Char]))
-> [([Char], [Char])] -> [([Char], [Char])]
forall a b. (a -> b) -> [a] -> [b]
map (ShowS -> ([Char], [Char]) -> ([Char], [Char])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ShowS -> ([Char], [Char]) -> ([Char], [Char]))
-> ShowS -> ([Char], [Char]) -> ([Char], [Char])
forall a b. (a -> b) -> a -> b
$ [Char] -> Maybe [Char] -> ShowS
expandDirectories (DynFlags -> [Char]
topDir DynFlags
dflags) (DynFlags -> Maybe [Char]
toolDir DynFlags
dflags))
          (DynFlags -> [([Char], [Char])]
rawSettings DynFlags
dflags)
   [([Char], [Char])] -> [([Char], [Char])] -> [([Char], [Char])]
forall a. [a] -> [a] -> [a]
++ [([Char]
"Project version",             DynFlags -> [Char]
projectVersion DynFlags
dflags),
       ([Char]
"Project Git commit id",       [Char]
cProjectGitCommitId),
       ([Char]
"Booter version",              [Char]
cBooterVersion),
       ([Char]
"Stage",                       [Char]
cStage),
       ([Char]
"Build platform",              [Char]
cBuildPlatformString),
       ([Char]
"Host platform",               [Char]
cHostPlatformString),
       ([Char]
"Target platform",             PlatformMisc -> [Char]
platformMisc_targetPlatformString (PlatformMisc -> [Char]) -> PlatformMisc -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> PlatformMisc
platformMisc DynFlags
dflags),
       ([Char]
"Have interpreter",            Bool -> [Char]
showBool (Bool -> [Char]) -> Bool -> [Char]
forall a b. (a -> b) -> a -> b
$ PlatformMisc -> Bool
platformMisc_ghcWithInterpreter (PlatformMisc -> Bool) -> PlatformMisc -> Bool
forall a b. (a -> b) -> a -> b
$ DynFlags -> PlatformMisc
platformMisc DynFlags
dflags),
       ([Char]
"Object splitting supported",  Bool -> [Char]
showBool Bool
False),
       ([Char]
"Have native code generator",  Bool -> [Char]
showBool (Bool -> [Char]) -> Bool -> [Char]
forall a b. (a -> b) -> a -> b
$ Platform -> Bool
platformNcgSupported (DynFlags -> Platform
targetPlatform DynFlags
dflags)),
       ([Char]
"Target default backend",      Backend -> [Char]
forall a. Show a => a -> [Char]
show (Backend -> [Char]) -> Backend -> [Char]
forall a b. (a -> b) -> a -> b
$ Platform -> Backend
platformDefaultBackend (DynFlags -> Platform
targetPlatform DynFlags
dflags)),
       -- Whether or not we support @-dynamic-too@
       ([Char]
"Support dynamic-too",         Bool -> [Char]
showBool (Bool -> [Char]) -> Bool -> [Char]
forall a b. (a -> b) -> a -> b
$ Bool -> Bool
not Bool
isWindows),
       -- Whether or not we support the @-j@ flag with @--make@.
       ([Char]
"Support parallel --make",     [Char]
"YES"),
       -- Whether or not we support "Foo from foo-0.1-XXX:Foo" syntax in
       -- installed package info.
       ([Char]
"Support reexported-modules",  [Char]
"YES"),
       -- Whether or not we support extended @-package foo (Foo)@ syntax.
       ([Char]
"Support thinning and renaming package flags", [Char]
"YES"),
       -- Whether or not we support Backpack.
       ([Char]
"Support Backpack", [Char]
"YES"),
       -- If true, we require that the 'id' field in installed package info
       -- match what is passed to the @-this-unit-id@ flag for modules
       -- built in it
       ([Char]
"Requires unified installed package IDs", [Char]
"YES"),
       -- Whether or not we support the @-this-package-key@ flag.  Prefer
       -- "Uses unit IDs" over it. We still say yes even if @-this-package-key@
       -- flag has been removed, otherwise it breaks Cabal...
       ([Char]
"Uses package keys",           [Char]
"YES"),
       -- Whether or not we support the @-this-unit-id@ flag
       ([Char]
"Uses unit IDs",               [Char]
"YES"),
       -- Whether or not GHC was compiled using -dynamic
       ([Char]
"GHC Dynamic",                 Bool -> [Char]
showBool Bool
hostIsDynamic),
       -- Whether or not GHC was compiled using -prof
       ([Char]
"GHC Profiled",                Bool -> [Char]
showBool Bool
hostIsProfiled),
       ([Char]
"Debug on",                    Bool -> [Char]
showBool Bool
debugIsOn),
       ([Char]
"LibDir",                      DynFlags -> [Char]
topDir DynFlags
dflags),
       -- The path of the global package database used by GHC
       ([Char]
"Global Package DB",           DynFlags -> [Char]
globalPackageDatabasePath DynFlags
dflags)
      ]
  where
    showBool :: Bool -> [Char]
showBool Bool
True  = [Char]
"YES"
    showBool Bool
False = [Char]
"NO"
    platform :: Platform
platform  = DynFlags -> Platform
targetPlatform DynFlags
dflags
    isWindows :: Bool
isWindows = Platform -> OS
platformOS Platform
platform OS -> OS -> Bool
forall a. Eq a => a -> a -> Bool
== OS
OSMinGW32
    expandDirectories :: FilePath -> Maybe FilePath -> String -> String
    expandDirectories :: [Char] -> Maybe [Char] -> ShowS
expandDirectories [Char]
topd Maybe [Char]
mtoold = Maybe [Char] -> ShowS
expandToolDir Maybe [Char]
mtoold ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> ShowS
expandTopDir [Char]
topd


wordAlignment :: Platform -> Alignment
wordAlignment :: Platform -> Alignment
wordAlignment Platform
platform = Int -> Alignment
alignmentOf (Platform -> Int
platformWordSizeInBytes Platform
platform)

-- | Get target profile
targetProfile :: DynFlags -> Profile
targetProfile :: DynFlags -> Profile
targetProfile DynFlags
dflags = Platform -> Ways -> Profile
Profile (DynFlags -> Platform
targetPlatform DynFlags
dflags) (DynFlags -> Ways
ways DynFlags
dflags)

{- -----------------------------------------------------------------------------
Note [DynFlags consistency]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

There are a number of number of DynFlags configurations which either
do not make sense or lead to unimplemented or buggy codepaths in the
compiler. makeDynFlagsConsistent is responsible for verifying the validity
of a set of DynFlags, fixing any issues, and reporting them back to the
caller.

GHCi and -O
---------------

When using optimization, the compiler can introduce several things
(such as unboxed tuples) into the intermediate code, which GHCi later
chokes on since the bytecode interpreter can't handle this (and while
this is arguably a bug these aren't handled, there are no plans to fix
it.)

While the driver pipeline always checks for this particular erroneous
combination when parsing flags, we also need to check when we update
the flags; this is because API clients may parse flags but update the
DynFlags afterwords, before finally running code inside a session (see
T10052 and #10052).
-}

-- | Resolve any internal inconsistencies in a set of 'DynFlags'.
-- Returns the consistent 'DynFlags' as well as a list of warnings
-- to report to the user.
makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Located String])
-- Whenever makeDynFlagsConsistent does anything, it starts over, to
-- ensure that a later change doesn't invalidate an earlier check.
-- Be careful not to introduce potential loops!
makeDynFlagsConsistent :: DynFlags -> (DynFlags, [Located [Char]])
makeDynFlagsConsistent DynFlags
dflags
 -- Disable -dynamic-too on Windows (#8228, #7134, #5987)
 | OS
os OS -> OS -> Bool
forall a. Eq a => a -> a -> Bool
== OS
OSMinGW32 Bool -> Bool -> Bool
&& GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_BuildDynamicToo DynFlags
dflags
    = let dflags' :: DynFlags
dflags' = DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dflags GeneralFlag
Opt_BuildDynamicToo
          warn :: [Char]
warn    = [Char]
"-dynamic-too is not supported on Windows"
      in DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop DynFlags
dflags' [Char]
warn

   -- Via-C backend only supports unregisterised ABI. Switch to a backend
   -- supporting it if possible.
 | DynFlags -> Backend
backend DynFlags
dflags Backend -> Backend -> Bool
forall a. Eq a => a -> a -> Bool
== Backend
ViaC Bool -> Bool -> Bool
&&
   Bool -> Bool
not (Platform -> Bool
platformUnregisterised (DynFlags -> Platform
targetPlatform DynFlags
dflags))
    = case Platform -> Backend
platformDefaultBackend (DynFlags -> Platform
targetPlatform DynFlags
dflags) of
         Backend
NCG ->  let dflags' :: DynFlags
dflags' = DynFlags
dflags { backend :: Backend
backend = Backend
NCG }
                     warn :: [Char]
warn = [Char]
"Target platform doesn't use unregisterised ABI, so using native code generator rather than compiling via C"
                 in DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop DynFlags
dflags' [Char]
warn
         Backend
LLVM -> let dflags' :: DynFlags
dflags' = DynFlags
dflags { backend :: Backend
backend = Backend
LLVM }
                     warn :: [Char]
warn = [Char]
"Target platform doesn't use unregisterised ABI, so using LLVM rather than compiling via C"
                 in DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop DynFlags
dflags' [Char]
warn
         Backend
_    -> [Char] -> (DynFlags, [Located [Char]])
forall a. [Char] -> a
pgmError [Char]
"Compiling via C only supports unregisterised ABI but target platform doesn't use it."

 | GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_Hpc DynFlags
dflags Bool -> Bool -> Bool
&& DynFlags -> Backend
backend DynFlags
dflags Backend -> Backend -> Bool
forall a. Eq a => a -> a -> Bool
== Backend
Interpreter
    = let dflags' :: DynFlags
dflags' = DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dflags GeneralFlag
Opt_Hpc
          warn :: [Char]
warn = [Char]
"Hpc can't be used with byte-code interpreter. Ignoring -fhpc."
      in DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop DynFlags
dflags' [Char]
warn

 | DynFlags -> Backend
backend DynFlags
dflags Backend -> [Backend] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [Backend
NCG, Backend
LLVM] Bool -> Bool -> Bool
&&
   Platform -> Bool
platformUnregisterised (DynFlags -> Platform
targetPlatform DynFlags
dflags)
    = DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop (DynFlags
dflags { backend :: Backend
backend = Backend
ViaC })
           [Char]
"Target platform uses unregisterised ABI, so compiling via C"

 | DynFlags -> Backend
backend DynFlags
dflags Backend -> Backend -> Bool
forall a. Eq a => a -> a -> Bool
== Backend
NCG Bool -> Bool -> Bool
&&
   Bool -> Bool
not (Platform -> Bool
platformNcgSupported (Platform -> Bool) -> Platform -> Bool
forall a b. (a -> b) -> a -> b
$ DynFlags -> Platform
targetPlatform DynFlags
dflags)
      = let dflags' :: DynFlags
dflags' = DynFlags
dflags { backend :: Backend
backend = Backend
LLVM }
            warn :: [Char]
warn = [Char]
"Native code generator doesn't support target platform, so using LLVM"
        in DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop DynFlags
dflags' [Char]
warn

 | Bool -> Bool
not (OS -> Bool
osElfTarget OS
os) Bool -> Bool -> Bool
&& GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIE DynFlags
dflags
    = DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop (DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dflags GeneralFlag
Opt_PIE)
           [Char]
"Position-independent only supported on ELF platforms"
 | OS
os OS -> OS -> Bool
forall a. Eq a => a -> a -> Bool
== OS
OSDarwin Bool -> Bool -> Bool
&&
   Arch
arch Arch -> Arch -> Bool
forall a. Eq a => a -> a -> Bool
== Arch
ArchX86_64 Bool -> Bool -> Bool
&&
   Bool -> Bool
not (GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PIC DynFlags
dflags)
    = DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop (DynFlags -> GeneralFlag -> DynFlags
gopt_set DynFlags
dflags GeneralFlag
Opt_PIC)
           [Char]
"Enabling -fPIC as it is always on for this platform"
 | Left [Char]
err <- Int -> DynFlags -> Either [Char] DynFlags
checkOptLevel (DynFlags -> Int
optLevel DynFlags
dflags) DynFlags
dflags
    = DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop (Int -> DynFlags -> DynFlags
updOptLevel Int
0 DynFlags
dflags) [Char]
err

 | GhcLink
LinkInMemory <- DynFlags -> GhcLink
ghcLink DynFlags
dflags
 , Bool -> Bool
not (GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_ExternalInterpreter DynFlags
dflags)
 , Bool
hostIsProfiled
 , Backend -> Bool
backendProducesObject (DynFlags -> Backend
backend DynFlags
dflags)
 , Way
WayProf Way -> Ways -> Bool
forall a. Ord a => a -> Set a -> Bool
`Set.notMember` DynFlags -> Ways
ways DynFlags
dflags
    = DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop DynFlags
dflags{targetWays_ :: Ways
targetWays_ = Way -> Ways -> Ways
addWay Way
WayProf (DynFlags -> Ways
targetWays_ DynFlags
dflags)}
         [Char]
"Enabling -prof, because -fobject-code is enabled and GHCi is profiled"

 | Bool
otherwise = (DynFlags
dflags, [])
    where loc :: SrcSpan
loc = FastString -> SrcSpan
mkGeneralSrcSpan ([Char] -> FastString
fsLit [Char]
"when making flags consistent")
          loop :: DynFlags -> [Char] -> (DynFlags, [Located [Char]])
loop DynFlags
updated_dflags [Char]
warning
              = case DynFlags -> (DynFlags, [Located [Char]])
makeDynFlagsConsistent DynFlags
updated_dflags of
                (DynFlags
dflags', [Located [Char]]
ws) -> (DynFlags
dflags', SrcSpan -> [Char] -> Located [Char]
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc [Char]
warning Located [Char] -> [Located [Char]] -> [Located [Char]]
forall a. a -> [a] -> [a]
: [Located [Char]]
ws)
          platform :: Platform
platform = DynFlags -> Platform
targetPlatform DynFlags
dflags
          arch :: Arch
arch = Platform -> Arch
platformArch Platform
platform
          os :: OS
os   = Platform -> OS
platformOS   Platform
platform


setUnsafeGlobalDynFlags :: DynFlags -> IO ()
setUnsafeGlobalDynFlags :: DynFlags -> IO ()
setUnsafeGlobalDynFlags DynFlags
dflags = do
   IORef Bool -> Bool -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef Bool
v_unsafeHasPprDebug (DynFlags -> Bool
hasPprDebug DynFlags
dflags)
   IORef Bool -> Bool -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef Bool
v_unsafeHasNoDebugOutput (DynFlags -> Bool
hasNoDebugOutput DynFlags
dflags)
   IORef Bool -> Bool -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef Bool
v_unsafeHasNoStateHack (DynFlags -> Bool
hasNoStateHack DynFlags
dflags)


-- -----------------------------------------------------------------------------
-- SSE and AVX

-- TODO: Instead of using a separate predicate (i.e. isSse2Enabled) to
-- check if SSE is enabled, we might have x86-64 imply the -msse2
-- flag.

isSseEnabled :: Platform -> Bool
isSseEnabled :: Platform -> Bool
isSseEnabled Platform
platform = case Platform -> Arch
platformArch Platform
platform of
    Arch
ArchX86_64 -> Bool
True
    Arch
ArchX86    -> Bool
True
    Arch
_          -> Bool
False

isSse2Enabled :: Platform -> Bool
isSse2Enabled :: Platform -> Bool
isSse2Enabled Platform
platform = case Platform -> Arch
platformArch Platform
platform of
  -- We assume  SSE1 and SSE2 operations are available on both
  -- x86 and x86_64. Historically we didn't default to SSE2 and
  -- SSE1 on x86, which results in defacto nondeterminism for how
  -- rounding behaves in the associated x87 floating point instructions
  -- because variations in the spill/fpu stack placement of arguments for
  -- operations would change the precision and final result of what
  -- would otherwise be the same expressions with respect to single or
  -- double precision IEEE floating point computations.
    Arch
ArchX86_64 -> Bool
True
    Arch
ArchX86    -> Bool
True
    Arch
_          -> Bool
False


isSse4_2Enabled :: DynFlags -> Bool
isSse4_2Enabled :: DynFlags -> Bool
isSse4_2Enabled DynFlags
dflags = DynFlags -> Maybe SseVersion
sseVersion DynFlags
dflags Maybe SseVersion -> Maybe SseVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= SseVersion -> Maybe SseVersion
forall a. a -> Maybe a
Just SseVersion
SSE42

isAvxEnabled :: DynFlags -> Bool
isAvxEnabled :: DynFlags -> Bool
isAvxEnabled DynFlags
dflags = DynFlags -> Bool
avx DynFlags
dflags Bool -> Bool -> Bool
|| DynFlags -> Bool
avx2 DynFlags
dflags Bool -> Bool -> Bool
|| DynFlags -> Bool
avx512f DynFlags
dflags

isAvx2Enabled :: DynFlags -> Bool
isAvx2Enabled :: DynFlags -> Bool
isAvx2Enabled DynFlags
dflags = DynFlags -> Bool
avx2 DynFlags
dflags Bool -> Bool -> Bool
|| DynFlags -> Bool
avx512f DynFlags
dflags

isAvx512cdEnabled :: DynFlags -> Bool
isAvx512cdEnabled :: DynFlags -> Bool
isAvx512cdEnabled DynFlags
dflags = DynFlags -> Bool
avx512cd DynFlags
dflags

isAvx512erEnabled :: DynFlags -> Bool
isAvx512erEnabled :: DynFlags -> Bool
isAvx512erEnabled DynFlags
dflags = DynFlags -> Bool
avx512er DynFlags
dflags

isAvx512fEnabled :: DynFlags -> Bool
isAvx512fEnabled :: DynFlags -> Bool
isAvx512fEnabled DynFlags
dflags = DynFlags -> Bool
avx512f DynFlags
dflags

isAvx512pfEnabled :: DynFlags -> Bool
isAvx512pfEnabled :: DynFlags -> Bool
isAvx512pfEnabled DynFlags
dflags = DynFlags -> Bool
avx512pf DynFlags
dflags

-- -----------------------------------------------------------------------------
-- BMI2

isBmiEnabled :: DynFlags -> Bool
isBmiEnabled :: DynFlags -> Bool
isBmiEnabled DynFlags
dflags = case Platform -> Arch
platformArch (DynFlags -> Platform
targetPlatform DynFlags
dflags) of
    Arch
ArchX86_64 -> DynFlags -> Maybe BmiVersion
bmiVersion DynFlags
dflags Maybe BmiVersion -> Maybe BmiVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI1
    Arch
ArchX86    -> DynFlags -> Maybe BmiVersion
bmiVersion DynFlags
dflags Maybe BmiVersion -> Maybe BmiVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI1
    Arch
_          -> Bool
False

isBmi2Enabled :: DynFlags -> Bool
isBmi2Enabled :: DynFlags -> Bool
isBmi2Enabled DynFlags
dflags = case Platform -> Arch
platformArch (DynFlags -> Platform
targetPlatform DynFlags
dflags) of
    Arch
ArchX86_64 -> DynFlags -> Maybe BmiVersion
bmiVersion DynFlags
dflags Maybe BmiVersion -> Maybe BmiVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI2
    Arch
ArchX86    -> DynFlags -> Maybe BmiVersion
bmiVersion DynFlags
dflags Maybe BmiVersion -> Maybe BmiVersion -> Bool
forall a. Ord a => a -> a -> Bool
>= BmiVersion -> Maybe BmiVersion
forall a. a -> Maybe a
Just BmiVersion
BMI2
    Arch
_          -> Bool
False

-- | Indicate if cost-centre profiling is enabled
sccProfilingEnabled :: DynFlags -> Bool
sccProfilingEnabled :: DynFlags -> Bool
sccProfilingEnabled DynFlags
dflags = Profile -> Bool
profileIsProfiling (DynFlags -> Profile
targetProfile DynFlags
dflags)

-- -----------------------------------------------------------------------------
-- Linker/compiler information

-- LinkerInfo contains any extra options needed by the system linker.
data LinkerInfo
  = GnuLD    [Option]
  | GnuGold  [Option]
  | LlvmLLD  [Option]
  | DarwinLD [Option]
  | SolarisLD [Option]
  | AixLD    [Option]
  | UnknownLD
  deriving LinkerInfo -> LinkerInfo -> Bool
(LinkerInfo -> LinkerInfo -> Bool)
-> (LinkerInfo -> LinkerInfo -> Bool) -> Eq LinkerInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LinkerInfo -> LinkerInfo -> Bool
$c/= :: LinkerInfo -> LinkerInfo -> Bool
== :: LinkerInfo -> LinkerInfo -> Bool
$c== :: LinkerInfo -> LinkerInfo -> Bool
Eq

-- CompilerInfo tells us which C compiler we're using
data CompilerInfo
   = GCC
   | Clang
   | AppleClang
   | AppleClang51
   | UnknownCC
   deriving CompilerInfo -> CompilerInfo -> Bool
(CompilerInfo -> CompilerInfo -> Bool)
-> (CompilerInfo -> CompilerInfo -> Bool) -> Eq CompilerInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompilerInfo -> CompilerInfo -> Bool
$c/= :: CompilerInfo -> CompilerInfo -> Bool
== :: CompilerInfo -> CompilerInfo -> Bool
$c== :: CompilerInfo -> CompilerInfo -> Bool
Eq


-- | Should we use `-XLinker -rpath` when linking or not?
-- See Note [-fno-use-rpaths]
useXLinkerRPath :: DynFlags -> OS -> Bool
useXLinkerRPath :: DynFlags -> OS -> Bool
useXLinkerRPath DynFlags
_ OS
OSDarwin = Bool
False -- See Note [Dynamic linking on macOS]
useXLinkerRPath DynFlags
dflags OS
_ = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_RPath DynFlags
dflags

{-
Note [-fno-use-rpaths]
~~~~~~~~~~~~~~~~~~~~~~

First read, Note [Dynamic linking on macOS] to understand why on darwin we never
use `-XLinker -rpath`.

The specification of `Opt_RPath` is as follows:

The default case `-fuse-rpaths`:
* On darwin, never use `-Xlinker -rpath -Xlinker`, always inject the rpath
  afterwards, see `runInjectRPaths`. There is no way to use `-Xlinker` on darwin
  as things stand but it wasn't documented in the user guide before this patch how
  `-fuse-rpaths` should behave and the fact it was always disabled on darwin.
* Otherwise, use `-Xlinker -rpath -Xlinker` to set the rpath of the executable,
  this is the normal way you should set the rpath.

The case of `-fno-use-rpaths`
* Never inject anything into the rpath.

When this was first implemented, `Opt_RPath` was disabled on darwin, but
the rpath was still always augmented by `runInjectRPaths`, and there was no way to
stop this. This was problematic because you couldn't build an executable in CI
with a clean rpath.

-}

-- -----------------------------------------------------------------------------
-- RTS hooks

-- Convert sizes like "3.5M" into integers
decodeSize :: String -> Integer
decodeSize :: [Char] -> Integer
decodeSize [Char]
str
  | [Char]
c [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
""      = Rational -> Integer
forall a b. (RealFrac a, Integral b) => a -> b
truncate Rational
n
  | [Char]
c [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
"K" Bool -> Bool -> Bool
|| [Char]
c [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
"k" = Rational -> Integer
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Rational
n Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* Rational
1000)
  | [Char]
c [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
"M" Bool -> Bool -> Bool
|| [Char]
c [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
"m" = Rational -> Integer
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Rational
n Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* Rational
1000 Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* Rational
1000)
  | [Char]
c [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
"G" Bool -> Bool -> Bool
|| [Char]
c [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
"g" = Rational -> Integer
forall a b. (RealFrac a, Integral b) => a -> b
truncate (Rational
n Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* Rational
1000 Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* Rational
1000 Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* Rational
1000)
  | Bool
otherwise            = GhcException -> Integer
forall a. GhcException -> a
throwGhcException ([Char] -> GhcException
CmdLineError ([Char]
"can't decode size: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
++ [Char]
str))
  where ([Char]
m, [Char]
c) = (Char -> Bool) -> [Char] -> ([Char], [Char])
forall a. (a -> Bool) -> [a] -> ([a], [a])
span Char -> Bool
pred [Char]
str
        n :: Rational
n      = [Char] -> Rational
readRational [Char]
m
        pred :: Char -> Bool
pred Char
c = Char -> Bool
isDigit Char
c Bool -> Bool -> Bool
|| Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'.'

foreign import ccall unsafe "setHeapSize"       setHeapSize       :: Int -> IO ()
foreign import ccall unsafe "enableTimingStats" enableTimingStats :: IO ()


-- | Initialize the pretty-printing options
initSDocContext :: DynFlags -> PprStyle -> SDocContext
initSDocContext :: DynFlags -> PprStyle -> SDocContext
initSDocContext DynFlags
dflags PprStyle
style = SDC
  { sdocStyle :: PprStyle
sdocStyle                       = PprStyle
style
  , sdocColScheme :: Scheme
sdocColScheme                   = DynFlags -> Scheme
colScheme DynFlags
dflags
  , sdocLastColour :: PprColour
sdocLastColour                  = PprColour
Col.colReset
  , sdocShouldUseColor :: Bool
sdocShouldUseColor              = Bool -> OverridingBool -> Bool
overrideWith (DynFlags -> Bool
canUseColor DynFlags
dflags) (DynFlags -> OverridingBool
useColor DynFlags
dflags)
  , sdocDefaultDepth :: Int
sdocDefaultDepth                = DynFlags -> Int
pprUserLength DynFlags
dflags
  , sdocLineLength :: Int
sdocLineLength                  = DynFlags -> Int
pprCols DynFlags
dflags
  , sdocCanUseUnicode :: Bool
sdocCanUseUnicode               = DynFlags -> Bool
useUnicode DynFlags
dflags
  , sdocHexWordLiterals :: Bool
sdocHexWordLiterals             = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_HexWordLiterals DynFlags
dflags
  , sdocPprDebug :: Bool
sdocPprDebug                    = DumpFlag -> DynFlags -> Bool
dopt DumpFlag
Opt_D_ppr_debug DynFlags
dflags
  , sdocPrintUnicodeSyntax :: Bool
sdocPrintUnicodeSyntax          = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintUnicodeSyntax DynFlags
dflags
  , sdocPrintCaseAsLet :: Bool
sdocPrintCaseAsLet              = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PprCaseAsLet DynFlags
dflags
  , sdocPrintTypecheckerElaboration :: Bool
sdocPrintTypecheckerElaboration = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintTypecheckerElaboration DynFlags
dflags
  , sdocPrintAxiomIncomps :: Bool
sdocPrintAxiomIncomps           = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintAxiomIncomps DynFlags
dflags
  , sdocPrintExplicitKinds :: Bool
sdocPrintExplicitKinds          = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintExplicitKinds DynFlags
dflags
  , sdocPrintExplicitCoercions :: Bool
sdocPrintExplicitCoercions      = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintExplicitCoercions DynFlags
dflags
  , sdocPrintExplicitRuntimeReps :: Bool
sdocPrintExplicitRuntimeReps    = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintExplicitRuntimeReps DynFlags
dflags
  , sdocPrintExplicitForalls :: Bool
sdocPrintExplicitForalls        = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintExplicitForalls DynFlags
dflags
  , sdocPrintPotentialInstances :: Bool
sdocPrintPotentialInstances     = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintPotentialInstances DynFlags
dflags
  , sdocPrintEqualityRelations :: Bool
sdocPrintEqualityRelations      = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_PrintEqualityRelations DynFlags
dflags
  , sdocSuppressTicks :: Bool
sdocSuppressTicks               = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressTicks DynFlags
dflags
  , sdocSuppressTypeSignatures :: Bool
sdocSuppressTypeSignatures      = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressTypeSignatures DynFlags
dflags
  , sdocSuppressTypeApplications :: Bool
sdocSuppressTypeApplications    = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressTypeApplications DynFlags
dflags
  , sdocSuppressIdInfo :: Bool
sdocSuppressIdInfo              = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressIdInfo DynFlags
dflags
  , sdocSuppressCoercions :: Bool
sdocSuppressCoercions           = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressCoercions DynFlags
dflags
  , sdocSuppressUnfoldings :: Bool
sdocSuppressUnfoldings          = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressUnfoldings DynFlags
dflags
  , sdocSuppressVarKinds :: Bool
sdocSuppressVarKinds            = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressVarKinds DynFlags
dflags
  , sdocSuppressUniques :: Bool
sdocSuppressUniques             = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressUniques DynFlags
dflags
  , sdocSuppressModulePrefixes :: Bool
sdocSuppressModulePrefixes      = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressModulePrefixes DynFlags
dflags
  , sdocSuppressStgExts :: Bool
sdocSuppressStgExts             = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_SuppressStgExts DynFlags
dflags
  , sdocErrorSpans :: Bool
sdocErrorSpans                  = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_ErrorSpans DynFlags
dflags
  , sdocStarIsType :: Bool
sdocStarIsType                  = Extension -> DynFlags -> Bool
xopt Extension
LangExt.StarIsType DynFlags
dflags
  , sdocImpredicativeTypes :: Bool
sdocImpredicativeTypes          = Extension -> DynFlags -> Bool
xopt Extension
LangExt.ImpredicativeTypes DynFlags
dflags
  , sdocLinearTypes :: Bool
sdocLinearTypes                 = Extension -> DynFlags -> Bool
xopt Extension
LangExt.LinearTypes DynFlags
dflags
  , sdocPrintTypeAbbreviations :: Bool
sdocPrintTypeAbbreviations      = Bool
True
  , sdocUnitIdForUser :: FastString -> SDoc
sdocUnitIdForUser               = FastString -> SDoc
ftext
  }

-- | Initialize the pretty-printing options using the default user style
initDefaultSDocContext :: DynFlags -> SDocContext
initDefaultSDocContext :: DynFlags -> SDocContext
initDefaultSDocContext DynFlags
dflags = DynFlags -> PprStyle -> SDocContext
initSDocContext DynFlags
dflags PprStyle
defaultUserStyle

outputFile :: DynFlags -> Maybe String
outputFile :: DynFlags -> Maybe [Char]
outputFile DynFlags
dflags
   | DynFlags -> Bool
dynamicNow DynFlags
dflags = DynFlags -> Maybe [Char]
dynOutputFile_ DynFlags
dflags
   | Bool
otherwise         = DynFlags -> Maybe [Char]
outputFile_    DynFlags
dflags

hiSuf :: DynFlags -> String
hiSuf :: DynFlags -> [Char]
hiSuf DynFlags
dflags
   | DynFlags -> Bool
dynamicNow DynFlags
dflags = DynFlags -> [Char]
dynHiSuf_ DynFlags
dflags
   | Bool
otherwise         = DynFlags -> [Char]
hiSuf_    DynFlags
dflags

objectSuf :: DynFlags -> String
objectSuf :: DynFlags -> [Char]
objectSuf DynFlags
dflags
   | DynFlags -> Bool
dynamicNow DynFlags
dflags = DynFlags -> [Char]
dynObjectSuf_ DynFlags
dflags
   | Bool
otherwise         = DynFlags -> [Char]
objectSuf_    DynFlags
dflags

ways :: DynFlags -> Ways
ways :: DynFlags -> Ways
ways DynFlags
dflags
   | DynFlags -> Bool
dynamicNow DynFlags
dflags = Way -> Ways -> Ways
addWay Way
WayDyn (DynFlags -> Ways
targetWays_ DynFlags
dflags)
   | Bool
otherwise         = DynFlags -> Ways
targetWays_ DynFlags
dflags

-- | Pretty-print the difference between 2 DynFlags.
--
-- For now only their general flags but it could be extended.
-- Useful mostly for debugging.
pprDynFlagsDiff :: DynFlags -> DynFlags -> SDoc
pprDynFlagsDiff :: DynFlags -> DynFlags -> SDoc
pprDynFlagsDiff DynFlags
d1 DynFlags
d2 =
   let gf_removed :: EnumSet GeneralFlag
gf_removed  = EnumSet GeneralFlag -> EnumSet GeneralFlag -> EnumSet GeneralFlag
forall a. EnumSet a -> EnumSet a -> EnumSet a
EnumSet.difference (DynFlags -> EnumSet GeneralFlag
generalFlags DynFlags
d1) (DynFlags -> EnumSet GeneralFlag
generalFlags DynFlags
d2)
       gf_added :: EnumSet GeneralFlag
gf_added    = EnumSet GeneralFlag -> EnumSet GeneralFlag -> EnumSet GeneralFlag
forall a. EnumSet a -> EnumSet a -> EnumSet a
EnumSet.difference (DynFlags -> EnumSet GeneralFlag
generalFlags DynFlags
d2) (DynFlags -> EnumSet GeneralFlag
generalFlags DynFlags
d1)
       ext_removed :: EnumSet Extension
ext_removed = EnumSet Extension -> EnumSet Extension -> EnumSet Extension
forall a. EnumSet a -> EnumSet a -> EnumSet a
EnumSet.difference (DynFlags -> EnumSet Extension
extensionFlags DynFlags
d1) (DynFlags -> EnumSet Extension
extensionFlags DynFlags
d2)
       ext_added :: EnumSet Extension
ext_added   = EnumSet Extension -> EnumSet Extension -> EnumSet Extension
forall a. EnumSet a -> EnumSet a -> EnumSet a
EnumSet.difference (DynFlags -> EnumSet Extension
extensionFlags DynFlags
d2) (DynFlags -> EnumSet Extension
extensionFlags DynFlags
d1)
   in [SDoc] -> SDoc
vcat
      [ [Char] -> SDoc
text [Char]
"Added general flags:"
      , [Char] -> SDoc
text ([Char] -> SDoc) -> [Char] -> SDoc
forall a b. (a -> b) -> a -> b
$ [GeneralFlag] -> [Char]
forall a. Show a => a -> [Char]
show ([GeneralFlag] -> [Char]) -> [GeneralFlag] -> [Char]
forall a b. (a -> b) -> a -> b
$ EnumSet GeneralFlag -> [GeneralFlag]
forall a. Enum a => EnumSet a -> [a]
EnumSet.toList (EnumSet GeneralFlag -> [GeneralFlag])
-> EnumSet GeneralFlag -> [GeneralFlag]
forall a b. (a -> b) -> a -> b
$ EnumSet GeneralFlag
gf_added
      , [Char] -> SDoc
text [Char]
"Removed general flags:"
      , [Char] -> SDoc
text ([Char] -> SDoc) -> [Char] -> SDoc
forall a b. (a -> b) -> a -> b
$ [GeneralFlag] -> [Char]
forall a. Show a => a -> [Char]
show ([GeneralFlag] -> [Char]) -> [GeneralFlag] -> [Char]
forall a b. (a -> b) -> a -> b
$ EnumSet GeneralFlag -> [GeneralFlag]
forall a. Enum a => EnumSet a -> [a]
EnumSet.toList (EnumSet GeneralFlag -> [GeneralFlag])
-> EnumSet GeneralFlag -> [GeneralFlag]
forall a b. (a -> b) -> a -> b
$ EnumSet GeneralFlag
gf_removed
      , [Char] -> SDoc
text [Char]
"Added extension flags:"
      , [Char] -> SDoc
text ([Char] -> SDoc) -> [Char] -> SDoc
forall a b. (a -> b) -> a -> b
$ [Extension] -> [Char]
forall a. Show a => a -> [Char]
show ([Extension] -> [Char]) -> [Extension] -> [Char]
forall a b. (a -> b) -> a -> b
$ EnumSet Extension -> [Extension]
forall a. Enum a => EnumSet a -> [a]
EnumSet.toList (EnumSet Extension -> [Extension])
-> EnumSet Extension -> [Extension]
forall a b. (a -> b) -> a -> b
$ EnumSet Extension
ext_added
      , [Char] -> SDoc
text [Char]
"Removed extension flags:"
      , [Char] -> SDoc
text ([Char] -> SDoc) -> [Char] -> SDoc
forall a b. (a -> b) -> a -> b
$ [Extension] -> [Char]
forall a. Show a => a -> [Char]
show ([Extension] -> [Char]) -> [Extension] -> [Char]
forall a b. (a -> b) -> a -> b
$ EnumSet Extension -> [Extension]
forall a. Enum a => EnumSet a -> [a]
EnumSet.toList (EnumSet Extension -> [Extension])
-> EnumSet Extension -> [Extension]
forall a b. (a -> b) -> a -> b
$ EnumSet Extension
ext_removed
      ]

updatePlatformConstants :: DynFlags -> Maybe PlatformConstants -> IO DynFlags
updatePlatformConstants :: DynFlags -> Maybe PlatformConstants -> IO DynFlags
updatePlatformConstants DynFlags
dflags Maybe PlatformConstants
mconstants = do
  let platform1 :: Platform
platform1 = (DynFlags -> Platform
targetPlatform DynFlags
dflags) { platform_constants :: Maybe PlatformConstants
platform_constants = Maybe PlatformConstants
mconstants }
  let dflags1 :: DynFlags
dflags1   = DynFlags
dflags { targetPlatform :: Platform
targetPlatform = Platform
platform1 }
  DynFlags -> IO DynFlags
forall (m :: * -> *) a. Monad m => a -> m a
return DynFlags
dflags1