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

-------------------------------------------------------------------------------
--
-- | 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(..), DiagnosticReason(..),
        Language(..),
        FatalMessager, FlushOut(..),
        ProfAuto(..),
        glasgowExtsFlags,
        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,
        wopt_set_all_custom, wopt_unset_all_custom,
        wopt_set_all_fatal_custom, wopt_unset_all_fatal_custom,
        wopt_set_custom, wopt_unset_custom,
        wopt_set_fatal_custom, wopt_unset_fatal_custom,
        wopt_any_custom,
        xopt, xopt_set, xopt_unset,
        xopt_set_unlessExplSpec,
        xopt_DuplicateRecordFields,
        xopt_FieldSelectors,
        lang_set,
        DynamicTooState(..), dynamicTooState, setDynamicNow,
        sccProfilingEnabled,
        needSourceNotes,
        OnOff(..),
        DynFlags(..),
        ParMakeCount(..),
        outputFile, 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,
        makeDynFlagsConsistent,
        positionIndependent,
        optimisationFlags,
        codeGenFlags,
        setFlagsFromEnvFile,
        pprDynFlagsDiff,
        flagSpecOf,

        targetProfile,

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

        -- ** System tool settings and locations
        Settings(..),
        sProgramName,
        sProjectVersion,
        sGhcUsagePath,
        sGhciUsagePath,
        sToolDir,
        sTopDir,
        sGlobalPackageDatabasePath,
        sLdSupportsCompactUnwind,
        sLdSupportsFilelist,
        sLdIsGnuLd,
        sGccSupportsNoPie,
        sPgm_L,
        sPgm_P,
        sPgm_F,
        sPgm_c,
        sPgm_cxx,
        sPgm_cpp,
        sPgm_a,
        sPgm_l,
        sPgm_lm,
        sPgm_windres,
        sPgm_ar,
        sPgm_ranlib,
        sPgm_lo,
        sPgm_lc,
        sPgm_las,
        sPgm_i,
        sOpt_L,
        sOpt_P,
        sOpt_P_fingerprint,
        sOpt_JSP,
        sOpt_JSP_fingerprint,
        sOpt_CmmP,
        sOpt_CmmP_fingerprint,
        sOpt_F,
        sOpt_c,
        sOpt_cxx,
        sOpt_a,
        sOpt_l,
        sOpt_lm,
        sOpt_windres,
        sOpt_lo,
        sOpt_lc,
        sOpt_i,
        sExtraGccViaCFlags,
        sTargetPlatformString,
        sGhcWithInterpreter,
        sLibFFI,
        GhcNameVersion(..),
        FileSettings(..),
        PlatformMisc(..),
        settings,
        programName, projectVersion,
        ghcUsagePath, ghciUsagePath, topDir,
        versionedAppDir, versionedFilePath,
        extraGccViaCFlags, globalPackageDatabasePath,
        pgm_L, pgm_P, pgm_JSP, pgm_CmmP, pgm_F, pgm_c, pgm_cxx, pgm_cpp, pgm_a, pgm_l,
        pgm_lm, pgm_windres, pgm_ar,
        pgm_ranlib, pgm_lo, pgm_lc, pgm_las, pgm_i,
        opt_L, opt_P, opt_JSP, opt_CmmP, opt_F, opt_c, opt_cxx, opt_a, opt_l, opt_lm, opt_i,
        opt_P_signature, opt_JSP_signature, opt_CmmP_signature,
        opt_windres, opt_lo, opt_lc, opt_las,
        updatePlatformConstants,

        -- ** Manipulating DynFlags
        addPluginModuleName,
        defaultDynFlags,                -- Settings -> DynFlags
        initDynFlags,                   -- DynFlags -> IO DynFlags
        defaultFatalMessager,
        defaultFlushOut,
        setOutputFile, setDynOutputFile, setOutputHi, setDynOutputHi,
        augmentByWorkingDirectory,

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

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

        -- ** State
        CmdLineP(..), runCmdLineP,
        getCmdLineState, putCmdLineState,
        processCmdLineP,

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

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

        supportedLanguagesAndExtensions,
        languageExtensions,

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

        -- ** DynFlags C linker options
        pieCCLDOpts,

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

        wordAlignment,

        setUnsafeGlobalDynFlags,

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

        -- * Linker/compiler information
        useXLinkerRPath,

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

        -- * SDoc
        initSDocContext, initDefaultSDocContext,
        initPromotionTickContext,
  ) where

import GHC.Prelude

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

import GHC.Unit.Types
import GHC.Unit.Parser
import GHC.Unit.Module
import GHC.Unit.Module.Warnings
import GHC.Driver.DynFlags
import GHC.Driver.Config.Diagnostic
import GHC.Driver.Flags
import GHC.Driver.Backend
import GHC.Driver.Errors.Types
import GHC.Driver.Plugins.External
import GHC.Settings.Config
import GHC.Core.Unfold
import GHC.Driver.CmdLine
import GHC.Utils.Panic
import GHC.Utils.Misc
import GHC.Utils.Constants (debugIsOn)
import GHC.Utils.GlobalVars
import GHC.Data.Maybe
import GHC.Data.Bool
import GHC.Data.StringBuffer (stringToStringBuffer)
import GHC.Types.Error
import GHC.Types.Name.Reader (RdrName(..))
import GHC.Types.Name.Occurrence (isVarOcc, occNameString)
import GHC.Utils.Monad
import GHC.Types.SrcLoc
import GHC.Types.SafeHaskell
import GHC.Types.Basic ( treatZeroAsInf )
import GHC.Data.FastString
import GHC.Utils.TmpFs
import GHC.Utils.Fingerprint
import GHC.Utils.Outputable
import GHC.Utils.Error (emptyDiagOpts)
import GHC.Settings
import GHC.CmmToAsm.CFG.Weight
import GHC.Core.Opt.CallerCC
import GHC.Parser (parseIdentifier)
import GHC.Parser.Lexer (mkParserOpts, initParserState, P(..), ParseResult(..))

import GHC.SysTools.BaseDir ( expandToolDir, expandTopDir )

import Data.IORef
import Control.Arrow ((&&&))
import Control.Monad
import Control.Monad.Trans.State as State
import Data.Functor.Identity

import Data.Ord
import Data.Char
import Data.List (intercalate, sortBy, partition)
import qualified Data.List.NonEmpty as NE
import qualified Data.Map as Map
import qualified Data.Set as Set
import Data.Word
import System.FilePath
import Text.ParserCombinators.ReadP hiding (char)
import Text.ParserCombinators.ReadP as R

import qualified GHC.Data.EnumSet as EnumSet

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.
-- Please make sure you add ":since:" information to new flags.

-- 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

{- Note [RHS Floating]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  We provide both 'Opt_LocalFloatOut' and 'Opt_LocalFloatOutTopLevel' to correspond to
  'doFloatFromRhs'; with this we can control floating out with GHC flags.

  This addresses https://gitlab.haskell.org/ghc/ghc/-/issues/13663 and
  allows for experimentation.
-}

-----------------------------------------------------------------------------
-- Accessors 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
  }

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_JSP               :: DynFlags -> (String,[Option])
pgm_JSP :: DynFlags -> ([Char], [Option])
pgm_JSP DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_JSP (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_CmmP              :: DynFlags -> (String,[Option])
pgm_CmmP :: DynFlags -> ([Char], [Option])
pgm_CmmP DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_CmmP (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_cxx               :: DynFlags -> String
pgm_cxx :: DynFlags -> [Char]
pgm_cxx DynFlags
dflags = ToolSettings -> [Char]
toolSettings_pgm_cxx (ToolSettings -> [Char]) -> ToolSettings -> [Char]
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
pgm_cpp               :: DynFlags -> (String,[Option])
pgm_cpp :: DynFlags -> ([Char], [Option])
pgm_cpp DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_cpp (ToolSettings -> ([Char], [Option]))
-> ToolSettings -> ([Char], [Option])
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 -> Maybe (String,[Option])
pgm_lm :: DynFlags -> Maybe ([Char], [Option])
pgm_lm DynFlags
dflags = ToolSettings -> Maybe ([Char], [Option])
toolSettings_pgm_lm (ToolSettings -> Maybe ([Char], [Option]))
-> ToolSettings -> Maybe ([Char], [Option])
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_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_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_las               :: DynFlags -> (String,[Option])
pgm_las :: DynFlags -> ([Char], [Option])
pgm_las DynFlags
dflags = ToolSettings -> ([Char], [Option])
toolSettings_pgm_las (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]]) -> Set Way -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptP (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Set Way
ways DynFlags
dflags)
            [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ ToolSettings -> [[Char]]
toolSettings_opt_P (DynFlags -> ToolSettings
toolSettings DynFlags
dflags)
opt_JSP               :: DynFlags -> [String]
opt_JSP :: DynFlags -> [[Char]]
opt_JSP DynFlags
dflags = (Way -> [[Char]]) -> Set Way -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptP (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Set Way
ways DynFlags
dflags)
            [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ ToolSettings -> [[Char]]
toolSettings_opt_JSP (DynFlags -> ToolSettings
toolSettings DynFlags
dflags)
opt_CmmP              :: DynFlags -> [String]
opt_CmmP :: DynFlags -> [[Char]]
opt_CmmP DynFlags
dflags = ToolSettings -> [[Char]]
toolSettings_opt_CmmP (ToolSettings -> [[Char]]) -> ToolSettings -> [[Char]]
forall a b. (a -> b) -> a -> b
$ 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]]) -> Set Way -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptP (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Set Way
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
  )
-- This function packages everything that's needed to fingerprint opt_P
-- flags. See Note [Repeated -optP hashing].
opt_JSP_signature     :: DynFlags -> ([String], Fingerprint)
opt_JSP_signature :: DynFlags -> ([[Char]], Fingerprint)
opt_JSP_signature DynFlags
dflags =
  ( (Way -> [[Char]]) -> Set Way -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptP (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Set Way
ways DynFlags
dflags)
  , ToolSettings -> Fingerprint
toolSettings_opt_JSP_fingerprint (ToolSettings -> Fingerprint) -> ToolSettings -> Fingerprint
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
  )
-- This function packages everything that's needed to fingerprint opt_CmmP
-- flags. See Note [Repeated -optP hashing].
opt_CmmP_signature     :: DynFlags -> Fingerprint
opt_CmmP_signature :: DynFlags -> Fingerprint
opt_CmmP_signature = ToolSettings -> Fingerprint
toolSettings_opt_CmmP_fingerprint (ToolSettings -> Fingerprint)
-> (DynFlags -> ToolSettings) -> DynFlags -> Fingerprint
forall b c a. (b -> c) -> (a -> b) -> a -> c
. DynFlags -> ToolSettings
toolSettings

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]]) -> Set Way -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptc (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Set Way
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 = (Way -> [[Char]]) -> Set Way -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptcxx (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Set Way
ways DynFlags
dflags)
           [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ ToolSettings -> [[Char]]
toolSettings_opt_cxx (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]]) -> Set Way -> [[Char]]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (Platform -> Way -> [[Char]]
wayOptl (DynFlags -> Platform
targetPlatform DynFlags
dflags)) (DynFlags -> Set Way
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_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_las               :: DynFlags -> [String]
opt_las :: DynFlags -> [[Char]]
opt_las DynFlags
dflags = ToolSettings -> [[Char]]
toolSettings_opt_las (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

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

{-
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"
-}

-- | 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)

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

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

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


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

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

-- | Test if Safe Imports are on in some form
safeImportsOn :: DynFlags -> Bool
safeImportsOn :: DynFlags -> TurnOnFlag
safeImportsOn DynFlags
dflags = DynFlags -> SafeHaskellMode
safeHaskell DynFlags
dflags SafeHaskellMode -> SafeHaskellMode -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== SafeHaskellMode
Sf_Unsafe TurnOnFlag -> TurnOnFlag -> TurnOnFlag
||
                       DynFlags -> SafeHaskellMode
safeHaskell DynFlags
dflags SafeHaskellMode -> SafeHaskellMode -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== SafeHaskellMode
Sf_Trustworthy TurnOnFlag -> TurnOnFlag -> TurnOnFlag
||
                       DynFlags -> SafeHaskellMode
safeHaskell DynFlags
dflags SafeHaskellMode -> SafeHaskellMode -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== 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
              safeM <- SafeHaskellMode -> SafeHaskellMode -> DynP SafeHaskellMode
combineSafeFlags SafeHaskellMode
sf SafeHaskellMode
s
              case s of
                SafeHaskellMode
Sf_Safe -> DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
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 = safeM, safeInfer = False }
                -- leave safe inference on in Trustworthy mode so we can warn
                -- if it could have been inferred safe.
                SafeHaskellMode
Sf_Trustworthy -> do
                  l <- EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc
                  return $ dfs { safeHaskell = safeM, trustworthyOnLoc = l }
                -- leave safe inference on in Unsafe mode as well.
                SafeHaskellMode
_ -> DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
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 = 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 -> TurnOnFlag
safeDirectImpsReq DynFlags
d = DynFlags -> TurnOnFlag
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 -> TurnOnFlag
safeImplicitImpsReq DynFlags
d = DynFlags -> TurnOnFlag
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 -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== SafeHaskellMode
Sf_None         = SafeHaskellMode -> DynP SafeHaskellMode
forall a. a -> EwM (CmdLineP DynFlags) a
forall (m :: * -> *) a. Monad m => a -> m a
return SafeHaskellMode
b
                     | SafeHaskellMode
b SafeHaskellMode -> SafeHaskellMode -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== SafeHaskellMode
Sf_None         = SafeHaskellMode -> DynP SafeHaskellMode
forall a. a -> EwM (CmdLineP DynFlags) a
forall (m :: * -> *) a. Monad m => a -> m a
return SafeHaskellMode
a
                     | SafeHaskellMode
a SafeHaskellMode -> SafeHaskellMode -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== SafeHaskellMode
Sf_Ignore TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| SafeHaskellMode
b SafeHaskellMode -> SafeHaskellMode -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== SafeHaskellMode
Sf_Ignore = SafeHaskellMode -> DynP SafeHaskellMode
forall a. a -> EwM (CmdLineP DynFlags) a
forall (m :: * -> *) a. Monad m => a -> m a
return SafeHaskellMode
Sf_Ignore
                     | SafeHaskellMode
a SafeHaskellMode -> SafeHaskellMode -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== SafeHaskellMode
b               = SafeHaskellMode -> DynP SafeHaskellMode
forall a. a -> EwM (CmdLineP DynFlags) a
forall (m :: * -> *) a. Monad m => a -> m a
return SafeHaskellMode
a
                     | TurnOnFlag
otherwise            = [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
addErr [Char]
errm DynP () -> DynP SafeHaskellMode -> DynP SafeHaskellMode
forall a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> SafeHaskellMode -> DynP SafeHaskellMode
forall a. a -> EwM (CmdLineP DynFlags) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure SafeHaskellMode
a
    where errm :: [Char]
errm = [Char]
"Incompatible Safe Haskell flags! ("
                    [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ SafeHaskellMode -> [Char]
forall a. Show a => a -> [Char]
show SafeHaskellMode
a [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
", " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ SafeHaskellMode -> [Char]
forall a. Show a => a -> [Char]
show SafeHaskellMode
b [Char] -> [Char] -> [Char]
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
  :: [(LangExt.Extension, DynFlags -> SrcSpan, DynFlags -> Bool, DynFlags -> DynFlags)]
unsafeFlags :: [(Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
  DynFlags -> DynFlags)]
unsafeFlags = [ (Extension
LangExt.GeneralizedNewtypeDeriving, DynFlags -> SrcSpan
newDerivOnLoc,
                    Extension -> DynFlags -> TurnOnFlag
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)
              , (Extension
LangExt.DerivingVia, DynFlags -> SrcSpan
deriveViaOnLoc,
                    Extension -> DynFlags -> TurnOnFlag
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)
              , (Extension
LangExt.TemplateHaskell, DynFlags -> SrcSpan
thOnLoc,
                    Extension -> DynFlags -> TurnOnFlag
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 :: [(Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
  DynFlags -> DynFlags)]
unsafeFlagsForInfer = [(Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
  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 -> TurnOnFlag
forall a. Ord a => a -> a -> TurnOnFlag
>= Int
4 = [[Char]
"-v"]
  | TurnOnFlag
otherwise             = []

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

setObjectDir :: [Char] -> DynFlags -> DynFlags
setObjectDir  [Char]
f DynFlags
d = DynFlags
d { objectDir  = Just f}
setHiDir :: [Char] -> DynFlags -> DynFlags
setHiDir      [Char]
f DynFlags
d = DynFlags
d { hiDir      = Just f}
setHieDir :: [Char] -> DynFlags -> DynFlags
setHieDir     [Char]
f DynFlags
d = DynFlags
d { hieDir     = Just f}
setStubDir :: [Char] -> DynFlags -> DynFlags
setStubDir    [Char]
f DynFlags
d = DynFlags
d { stubDir    = Just f
                      , includePaths = addGlobalInclude (includePaths d) [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    = Just 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 = Just f}

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

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

parseUnitInsts :: String -> Instantiations
parseUnitInsts :: [Char] -> Instantiations
parseUnitInsts [Char]
str = case ((Instantiations, [Char]) -> TurnOnFlag)
-> [(Instantiations, [Char])] -> [(Instantiations, [Char])]
forall a. (a -> TurnOnFlag) -> [a] -> [a]
filter (([Char] -> [Char] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
==[Char]
"")([Char] -> TurnOnFlag)
-> ((Instantiations, [Char]) -> [Char])
-> (Instantiations, [Char])
-> TurnOnFlag
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Instantiations, [Char]) -> [Char]
forall a b. (a, b) -> b
snd) (ReadP Instantiations -> ReadS Instantiations
forall a. ReadP a -> ReadS a
readP_to_S ReadP Instantiations
parse [Char]
str) of
    [(Instantiations
r, [Char]
"")] -> Instantiations
r
    [(Instantiations, [Char])]
_ -> GhcException -> Instantiations
forall a. GhcException -> a
throwGhcException (GhcException -> Instantiations) -> GhcException -> Instantiations
forall a b. (a -> b) -> a -> b
$ [Char] -> GhcException
CmdLineError ([Char]
"Can't parse -instantiated-with: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
str)
  where parse :: ReadP Instantiations
parse = ReadP (ModuleName, Module) -> ReadP Char -> ReadP Instantiations
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
            n <- ReadP ModuleName
parseModuleName
            _ <- R.char '='
            m <- parseHoleyModule
            return (n, m)

setUnitInstantiations :: String -> DynFlags -> DynFlags
setUnitInstantiations :: [Char] -> DynFlags -> DynFlags
setUnitInstantiations [Char]
s DynFlags
d =
    DynFlags
d { homeUnitInstantiations_ = parseUnitInsts s }

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

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

clearPluginModuleNames :: DynFlags -> DynFlags
clearPluginModuleNames :: DynFlags -> DynFlags
clearPluginModuleNames DynFlags
d =
    DynFlags
d { pluginModNames = []
      , pluginModNameOpts = []
      }

addPluginModuleNameOption :: String -> DynFlags -> DynFlags
addPluginModuleNameOption :: [Char] -> DynFlags -> DynFlags
addPluginModuleNameOption [Char]
optflag DynFlags
d = DynFlags
d { pluginModNameOpts = (mkModuleName m, option) : (pluginModNameOpts d) }
  where ([Char]
m, [Char]
rest) = (Char -> TurnOnFlag) -> [Char] -> ([Char], [Char])
forall a. (a -> TurnOnFlag) -> [a] -> ([a], [a])
break (Char -> Char -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== 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

addExternalPlugin :: String -> DynFlags -> DynFlags
addExternalPlugin :: [Char] -> DynFlags -> DynFlags
addExternalPlugin [Char]
optflag DynFlags
d = case [Char] -> Maybe ExternalPluginSpec
parseExternalPluginSpec [Char]
optflag of
  Just ExternalPluginSpec
r  -> DynFlags
d { externalPluginSpecs = r : externalPluginSpecs d }
  Maybe ExternalPluginSpec
Nothing -> [Char] -> DynFlags
forall a. [Char] -> a
cmdLineError ([Char] -> DynFlags) -> [Char] -> DynFlags
forall a b. (a -> b) -> a -> b
$ [Char]
"Couldn't parse external plugin specification: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
optflag

addFrontendPluginOption :: String -> DynFlags -> DynFlags
addFrontendPluginOption :: [Char] -> DynFlags -> DynFlags
addFrontendPluginOption [Char]
s DynFlags
d = DynFlags
d { frontendPluginOpts = s : frontendPluginOpts 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 = Deployable }
   ([Char]
"sysdep", [Char]
"")       -> DynFlags
d { dynLibLoader = SystemDependent }
   ([Char], [Char])
_                    -> GhcException -> DynFlags
forall a. GhcException -> a
throwGhcException ([Char] -> GhcException
CmdLineError ([Char]
"Unknown dynlib loader: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
f))

setDumpPrefixForce :: Maybe [Char] -> DynFlags -> DynFlags
setDumpPrefixForce Maybe [Char]
f DynFlags
d = DynFlags
d { dumpPrefixForce = 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   = (pgm, map Option args)})
  where ([Char]
pgm:[[Char]]
args) = [Char] -> [[Char]]
words [Char]
f
-- XXX HACK: Prelude> words "'does not' work" ===> ["'does","not'","work"]
-- Config.hs should really use Option.
setPgmJSP :: [Char] -> DynFlags -> DynFlags
setPgmJSP   [Char]
f = (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings (\ToolSettings
s -> ToolSettings
s { toolSettings_pgm_JSP   = (pgm, map Option args)})
  where ([Char]
pgm:[[Char]]
args) = [Char] -> [[Char]]
words [Char]
f
-- XXX HACK: Prelude> words "'does not' work" ===> ["'does","not'","work"]
-- Config.hs should really use Option.
setPgmCmmP :: [Char] -> DynFlags -> DynFlags
setPgmCmmP [Char]
f = (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings (\ToolSettings
s -> ToolSettings
s { toolSettings_pgm_CmmP = (pgm, map Option 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   = f : toolSettings_opt_l s})
addOptc :: [Char] -> DynFlags -> DynFlags
addOptc   [Char]
f = (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings (\ToolSettings
s -> ToolSettings
s { toolSettings_opt_c   = f : toolSettings_opt_c s})
addOptcxx :: [Char] -> DynFlags -> DynFlags
addOptcxx [Char]
f = (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings (\ToolSettings
s -> ToolSettings
s { toolSettings_opt_cxx = f : toolSettings_opt_cxx 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   = f : toolSettings_opt_P s
          , toolSettings_opt_P_fingerprint = fingerprintStrings (f : toolSettings_opt_P s)
          }
          -- See Note [Repeated -optP hashing]
addOptJSP :: [Char] -> DynFlags -> DynFlags
addOptJSP [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_JSP   = f : toolSettings_opt_JSP s
          , toolSettings_opt_JSP_fingerprint = fingerprintStrings (f : toolSettings_opt_JSP s)
          }
          -- See Note [Repeated -optP hashing]
addOptCmmP :: [Char] -> DynFlags -> DynFlags
addOptCmmP [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_CmmP = f : toolSettings_opt_CmmP s
          , toolSettings_opt_CmmP_fingerprint = fingerprintStrings (f : toolSettings_opt_CmmP s)
          }

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

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

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

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

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

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

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

addHaddockOpts :: [Char] -> DynFlags -> DynFlags
addHaddockOpts [Char]
f DynFlags
d = DynFlags
d { haddockOptions = Just f}

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

setInteractivePrint :: [Char] -> DynFlags -> DynFlags
setInteractivePrint [Char]
f DynFlags
d = DynFlags
d { interactivePrint = Just f}

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

updOptLevelChanged :: Int -> DynFlags -> (DynFlags, Bool)
-- ^ Sets the 'DynFlags' to be appropriate to the optimisation level and signals if any changes took place
updOptLevelChanged :: Int -> DynFlags -> (DynFlags, TurnOnFlag)
updOptLevelChanged Int
n DynFlags
dfs
  = (DynFlags
dfs3, TurnOnFlag
changed1 TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| TurnOnFlag
changed2 TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| TurnOnFlag
changed3)
  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
   (DynFlags
dfs1, TurnOnFlag
changed1) = (GeneralFlag -> (DynFlags, TurnOnFlag) -> (DynFlags, TurnOnFlag))
-> (DynFlags, TurnOnFlag)
-> [GeneralFlag]
-> (DynFlags, TurnOnFlag)
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr GeneralFlag -> (DynFlags, TurnOnFlag) -> (DynFlags, TurnOnFlag)
unset (DynFlags
dfs , TurnOnFlag
False) [GeneralFlag]
remove_gopts
   (DynFlags
dfs2, TurnOnFlag
changed2) = (GeneralFlag -> (DynFlags, TurnOnFlag) -> (DynFlags, TurnOnFlag))
-> (DynFlags, TurnOnFlag)
-> [GeneralFlag]
-> (DynFlags, TurnOnFlag)
forall a b. (a -> b -> b) -> b -> [a] -> b
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr GeneralFlag -> (DynFlags, TurnOnFlag) -> (DynFlags, TurnOnFlag)
set   (DynFlags
dfs1, TurnOnFlag
False) [GeneralFlag]
extra_gopts
   (DynFlags
dfs3, TurnOnFlag
changed3) = DynFlags -> (DynFlags, TurnOnFlag)
setLlvmOptLevel DynFlags
dfs2

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

   set :: GeneralFlag -> (DynFlags, TurnOnFlag) -> (DynFlags, TurnOnFlag)
set GeneralFlag
f (DynFlags
dfs, TurnOnFlag
changed)
     | GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
f DynFlags
dfs = (DynFlags
dfs, TurnOnFlag
changed)
     | TurnOnFlag
otherwise = (DynFlags -> GeneralFlag -> DynFlags
gopt_set DynFlags
dfs GeneralFlag
f, TurnOnFlag
True)

   unset :: GeneralFlag -> (DynFlags, TurnOnFlag) -> (DynFlags, TurnOnFlag)
unset GeneralFlag
f (DynFlags
dfs, TurnOnFlag
changed)
     | TurnOnFlag -> TurnOnFlag
not (GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
f DynFlags
dfs) = (DynFlags
dfs, TurnOnFlag
changed)
     | TurnOnFlag
otherwise = (DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dfs GeneralFlag
f, TurnOnFlag
True)

   setLlvmOptLevel :: DynFlags -> (DynFlags, TurnOnFlag)
setLlvmOptLevel DynFlags
dfs
     | DynFlags -> Int
llvmOptLevel DynFlags
dfs Int -> Int -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
/= Int
final_n = (DynFlags
dfs{ llvmOptLevel = final_n }, TurnOnFlag
True)
     | TurnOnFlag
otherwise = (DynFlags
dfs, TurnOnFlag
False)

updOptLevel :: Int -> DynFlags -> DynFlags
-- ^ Sets the 'DynFlags' to be appropriate to the optimisation level
updOptLevel :: Int -> DynFlags -> DynFlags
updOptLevel Int
n = (DynFlags, TurnOnFlag) -> DynFlags
forall a b. (a, b) -> a
fst ((DynFlags, TurnOnFlag) -> DynFlags)
-> (DynFlags -> (DynFlags, TurnOnFlag)) -> DynFlags -> DynFlags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> DynFlags -> (DynFlags, TurnOnFlag)
updOptLevelChanged Int
n

{- **********************************************************************
%*                                                                      *
                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], Messages DriverMessage)
                            -- ^ Updated 'DynFlags', left-over arguments, and
                            -- list of warnings.
parseDynamicFlagsCmdLine :: forall (m :: * -> *).
MonadIO m =>
DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], Messages DriverMessage)
parseDynamicFlagsCmdLine = [Flag (CmdLineP DynFlags)]
-> TurnOnFlag
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], Messages DriverMessage)
forall (m :: * -> *).
MonadIO m =>
[Flag (CmdLineP DynFlags)]
-> TurnOnFlag
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], Messages DriverMessage)
parseDynamicFlagsFull [Flag (CmdLineP DynFlags)]
flagsAll TurnOnFlag
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], Messages DriverMessage)
                          -- ^ Updated 'DynFlags', left-over arguments, and
                          -- list of warnings.
parseDynamicFilePragma :: forall (m :: * -> *).
MonadIO m =>
DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], Messages DriverMessage)
parseDynamicFilePragma = [Flag (CmdLineP DynFlags)]
-> TurnOnFlag
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], Messages DriverMessage)
forall (m :: * -> *).
MonadIO m =>
[Flag (CmdLineP DynFlags)]
-> TurnOnFlag
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], Messages DriverMessage)
parseDynamicFlagsFull [Flag (CmdLineP DynFlags)]
flagsDynamic TurnOnFlag
False

newtype CmdLineP s a = CmdLineP (forall m. (Monad m) => StateT s m a)
  deriving ((forall a b. (a -> b) -> CmdLineP s a -> CmdLineP s b)
-> (forall a b. a -> CmdLineP s b -> CmdLineP s a)
-> Functor (CmdLineP s)
forall a b. a -> CmdLineP s b -> CmdLineP s a
forall a b. (a -> b) -> CmdLineP s a -> CmdLineP s b
forall s a b. a -> CmdLineP s b -> CmdLineP s a
forall s a b. (a -> b) -> CmdLineP s a -> CmdLineP s b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall s a b. (a -> b) -> CmdLineP s a -> CmdLineP s b
fmap :: forall a b. (a -> b) -> CmdLineP s a -> CmdLineP s b
$c<$ :: forall s a b. a -> CmdLineP s b -> CmdLineP s a
<$ :: forall a b. a -> CmdLineP s b -> CmdLineP s a
Functor)

instance Monad (CmdLineP s) where
    CmdLineP forall (m :: * -> *). Monad m => StateT s m a
k >>= :: forall a b. CmdLineP s a -> (a -> CmdLineP s b) -> CmdLineP s b
>>= a -> CmdLineP s b
f = (forall (m :: * -> *). Monad m => StateT s m b) -> CmdLineP s b
forall s a.
(forall (m :: * -> *). Monad m => StateT s m a) -> CmdLineP s a
CmdLineP (StateT s m a
forall (m :: * -> *). Monad m => StateT s m a
k StateT s m a -> (a -> StateT s m b) -> StateT s m b
forall a b. StateT s m a -> (a -> StateT s m b) -> StateT s m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \a
x -> case a -> CmdLineP s b
f a
x of CmdLineP forall (m :: * -> *). Monad m => StateT s m b
g -> StateT s m b
forall (m :: * -> *). Monad m => StateT s m b
g)
    return :: forall a. a -> CmdLineP s a
return = a -> CmdLineP s a
forall a. a -> CmdLineP s a
forall (f :: * -> *) a. Applicative f => a -> f a
pure

instance Applicative (CmdLineP s) where
    pure :: forall a. a -> CmdLineP s a
pure a
x = (forall (m :: * -> *). Monad m => StateT s m a) -> CmdLineP s a
forall s a.
(forall (m :: * -> *). Monad m => StateT s m a) -> CmdLineP s a
CmdLineP (a -> StateT s m a
forall a. a -> StateT s m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
x)
    <*> :: forall a b. CmdLineP s (a -> b) -> CmdLineP s a -> CmdLineP s b
(<*>) = CmdLineP s (a -> b) -> CmdLineP s a -> CmdLineP s b
forall (m :: * -> *) a b. Monad m => m (a -> b) -> m a -> m b
ap

getCmdLineState :: CmdLineP s s
getCmdLineState :: forall s. CmdLineP s s
getCmdLineState = (forall (m :: * -> *). Monad m => StateT s m s) -> CmdLineP s s
forall s a.
(forall (m :: * -> *). Monad m => StateT s m a) -> CmdLineP s a
CmdLineP StateT s m s
forall (m :: * -> *). Monad m => StateT s m s
forall (m :: * -> *) s. Monad m => StateT s m s
State.get

putCmdLineState :: s -> CmdLineP s ()
putCmdLineState :: forall s. s -> CmdLineP s ()
putCmdLineState s
x = (forall (m :: * -> *). Monad m => StateT s m ()) -> CmdLineP s ()
forall s a.
(forall (m :: * -> *). Monad m => StateT s m a) -> CmdLineP s a
CmdLineP (s -> StateT s m ()
forall (m :: * -> *) s. Monad m => s -> StateT s m ()
State.put s
x)

runCmdLineP :: CmdLineP s a -> s -> (a, s)
runCmdLineP :: forall s a. CmdLineP s a -> s -> (a, s)
runCmdLineP (CmdLineP forall (m :: * -> *). Monad m => StateT s m a
k) s
s0 = Identity (a, s) -> (a, s)
forall a. Identity a -> a
runIdentity (Identity (a, s) -> (a, s)) -> Identity (a, s) -> (a, s)
forall a b. (a -> b) -> a -> b
$ StateT s Identity a -> s -> Identity (a, s)
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT StateT s Identity a
forall (m :: * -> *). Monad m => StateT s m a
k s
s0

-- | A helper to parse a set of flags from a list of command-line arguments, handling
-- response files.
processCmdLineP
    :: forall s m. MonadIO m
    => [Flag (CmdLineP s)]  -- ^ valid flags to match against
    -> s                    -- ^ current state
    -> [Located String]     -- ^ arguments to parse
    -> m (([Located String], [Err], [Warn]), s)
                            -- ^ (leftovers, errors, warnings)
processCmdLineP :: forall s (m :: * -> *).
MonadIO m =>
[Flag (CmdLineP s)]
-> s
-> [Located [Char]]
-> m (([Located [Char]], [Err], [Warn]), s)
processCmdLineP [Flag (CmdLineP s)]
activeFlags s
s0 [Located [Char]]
args =
    StateT s m ([Located [Char]], [Err], [Warn])
-> s -> m (([Located [Char]], [Err], [Warn]), s)
forall s (m :: * -> *) a. StateT s m a -> s -> m (a, s)
runStateT ([Flag (StateT s m)]
-> [Located [Char]]
-> ([Char] -> EwM (StateT s m) [Located [Char]])
-> StateT s m ([Located [Char]], [Err], [Warn])
forall (m :: * -> *).
Monad m =>
[Flag m]
-> [Located [Char]]
-> ([Char] -> EwM m [Located [Char]])
-> m ([Located [Char]], [Err], [Warn])
processArgs ((Flag (CmdLineP s) -> Flag (StateT s m))
-> [Flag (CmdLineP s)] -> [Flag (StateT s m)]
forall a b. (a -> b) -> [a] -> [b]
map ((forall a. CmdLineP s a -> StateT s m a)
-> Flag (CmdLineP s) -> Flag (StateT s m)
forall (m :: * -> *) (n :: * -> *).
(forall a. m a -> n a) -> Flag m -> Flag n
hoistFlag CmdLineP s a -> StateT s m a
forall a. CmdLineP s a -> StateT s m a
getCmdLineP) [Flag (CmdLineP s)]
activeFlags) [Located [Char]]
args [Char] -> EwM (StateT s m) [Located [Char]]
forall (m :: * -> *). MonadIO m => [Char] -> EwM m [Located [Char]]
parseResponseFile) s
s0
  where
    getCmdLineP :: CmdLineP s a -> StateT s m a
    getCmdLineP :: forall a. CmdLineP s a -> StateT s m a
getCmdLineP (CmdLineP forall (m :: * -> *). Monad m => StateT s m a
k) = StateT s m a
forall (m :: * -> *). Monad m => StateT s m a
k

-- | 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
    :: forall m. 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], Messages DriverMessage)
parseDynamicFlagsFull :: forall (m :: * -> *).
MonadIO m =>
[Flag (CmdLineP DynFlags)]
-> TurnOnFlag
-> DynFlags
-> [Located [Char]]
-> m (DynFlags, [Located [Char]], Messages DriverMessage)
parseDynamicFlagsFull [Flag (CmdLineP DynFlags)]
activeFlags TurnOnFlag
cmdline DynFlags
dflags0 [Located [Char]]
args = do
  ((leftover, errs, cli_warns), dflags1) <- [Flag (CmdLineP DynFlags)]
-> DynFlags
-> [Located [Char]]
-> m (([Located [Char]], [Err], [Warn]), DynFlags)
forall s (m :: * -> *).
MonadIO m =>
[Flag (CmdLineP s)]
-> s
-> [Located [Char]]
-> m (([Located [Char]], [Err], [Warn]), s)
processCmdLineP [Flag (CmdLineP DynFlags)]
activeFlags DynFlags
dflags0 [Located [Char]]
args

  -- See Note [Handling errors when parsing command-line flags]
  let rdr = SDocContext -> SDoc -> [Char]
renderWithContext (DynFlags -> PprStyle -> SDocContext
initSDocContext DynFlags
dflags0 PprStyle
defaultUserStyle)
  unless (null errs) $ liftIO $ throwGhcExceptionIO $ errorsToGhcException $
    map ((rdr . ppr . getLoc &&& unLoc) . errMsg) $ errs

  -- check for disabled flags in safe haskell
  let (dflags2, sh_warns) = safeFlagCheck cmdline dflags1
      theWays = DynFlags -> Set Way
ways DynFlags
dflags2

  unless (allowed_combination theWays) $ liftIO $
      throwGhcExceptionIO (CmdLineError ("combination not supported: " ++
                               intercalate "/" (map wayDesc (Set.toAscList theWays))))

  let (dflags3, consistency_warnings) = makeDynFlagsConsistent dflags2

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

  liftIO $ setUnsafeGlobalDynFlags dflags3

  -- create message envelopes using final DynFlags: #23402
  let diag_opts = DynFlags -> DiagOpts
initDiagOpts DynFlags
dflags3
      warns = DiagOpts -> [Warn] -> Messages DriverMessage
warnsToMessages DiagOpts
diag_opts ([Warn] -> Messages DriverMessage)
-> [Warn] -> Messages DriverMessage
forall a b. (a -> b) -> a -> b
$ [[Warn]] -> [Warn]
forall a. Monoid a => [a] -> a
mconcat [[Warn]
consistency_warnings, [Warn]
sh_warns, [Warn]
cli_warns]

  return (dflags3, leftover, 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, [Warn])
safeFlagCheck :: TurnOnFlag -> DynFlags -> (DynFlags, [Warn])
safeFlagCheck TurnOnFlag
_ DynFlags
dflags | DynFlags -> TurnOnFlag
safeLanguageOn DynFlags
dflags = (DynFlags
dflagsUnset, [Warn]
warns)
  where
    -- Handle illegal flags under safe language.
    (DynFlags
dflagsUnset, [Warn]
warns) = ((DynFlags, [Warn])
 -> (Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
     DynFlags -> DynFlags)
 -> (DynFlags, [Warn]))
-> (DynFlags, [Warn])
-> [(Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
     DynFlags -> DynFlags)]
-> (DynFlags, [Warn])
forall b a. (b -> a -> b) -> b -> [a] -> b
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl' (DynFlags, [Warn])
-> (Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
    DynFlags -> DynFlags)
-> (DynFlags, [Warn])
forall {a} {l}.
(a, [GenLocated l DriverMessage])
-> (Extension, a -> l, a -> TurnOnFlag, a -> a)
-> (a, [GenLocated l DriverMessage])
check_method (DynFlags
dflags, [Warn]
forall a. Monoid a => a
mempty) [(Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
  DynFlags -> DynFlags)]
unsafeFlags

    check_method :: (a, [GenLocated l DriverMessage])
-> (Extension, a -> l, a -> TurnOnFlag, a -> a)
-> (a, [GenLocated l DriverMessage])
check_method (a
df, [GenLocated l DriverMessage]
warns) (Extension
ext,a -> l
loc,a -> TurnOnFlag
test,a -> a
fix)
        | a -> TurnOnFlag
test a
df   = (a -> a
fix a
df, l -> Extension -> GenLocated l DriverMessage
forall {l}. l -> Extension -> GenLocated l DriverMessage
safeFailure (a -> l
loc a
df) Extension
ext GenLocated l DriverMessage
-> [GenLocated l DriverMessage] -> [GenLocated l DriverMessage]
forall a. a -> [a] -> [a]
:  [GenLocated l DriverMessage]
warns)
        | TurnOnFlag
otherwise = (a
df, [GenLocated l DriverMessage]
warns)

    safeFailure :: l -> Extension -> GenLocated l DriverMessage
safeFailure l
loc Extension
ext
       = l -> DriverMessage -> GenLocated l DriverMessage
forall l e. l -> e -> GenLocated l e
L l
loc (DriverMessage -> GenLocated l DriverMessage)
-> DriverMessage -> GenLocated l DriverMessage
forall a b. (a -> b) -> a -> b
$ Extension -> DriverMessage
DriverSafeHaskellIgnoredExtension Extension
ext

safeFlagCheck TurnOnFlag
cmdl DynFlags
dflags =
  case DynFlags -> TurnOnFlag
safeInferOn DynFlags
dflags of
    TurnOnFlag
True   -> (DynFlags
dflags' { safeInferred = safeFlags }, [Warn]
warn)
    TurnOnFlag
False  -> (DynFlags
dflags', [Warn]
warn)

  where
    -- dynflags and warn for when -fpackage-trust by itself with no safe
    -- haskell flag
    (DynFlags
dflags', [Warn]
warn)
      | TurnOnFlag -> TurnOnFlag
not (DynFlags -> TurnOnFlag
safeHaskellModeEnabled DynFlags
dflags) TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&& TurnOnFlag -> TurnOnFlag
not TurnOnFlag
cmdl TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&& DynFlags -> TurnOnFlag
packageTrustOn DynFlags
dflags
      = (DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dflags GeneralFlag
Opt_PackageTrust, [Warn]
pkgWarnMsg)
      | TurnOnFlag
otherwise = (DynFlags
dflags, [Warn]
forall a. Monoid a => a
mempty)

    pkgWarnMsg :: [Warn]
    pkgWarnMsg :: [Warn]
pkgWarnMsg = [ SrcSpan -> DriverMessage -> Warn
forall l e. l -> e -> GenLocated l e
L (DynFlags -> SrcSpan
pkgTrustOnLoc DynFlags
dflags') DriverMessage
DriverPackageTrustIgnored ]

    -- Have we inferred Unsafe? See Note [Safe Haskell Inference] in GHC.Driver.Main
    -- Force this to avoid retaining reference to old DynFlags value
    !safeFlags :: TurnOnFlag
safeFlags = ((Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
  DynFlags -> DynFlags)
 -> TurnOnFlag)
-> [(Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
     DynFlags -> DynFlags)]
-> TurnOnFlag
forall (t :: * -> *) a.
Foldable t =>
(a -> TurnOnFlag) -> t a -> TurnOnFlag
all (\(Extension
_,DynFlags -> SrcSpan
_,DynFlags -> TurnOnFlag
t,DynFlags -> DynFlags
_) -> TurnOnFlag -> TurnOnFlag
not (TurnOnFlag -> TurnOnFlag) -> TurnOnFlag -> TurnOnFlag
forall a b. (a -> b) -> a -> b
$ DynFlags -> TurnOnFlag
t DynFlags
dflags) [(Extension, DynFlags -> SrcSpan, DynFlags -> TurnOnFlag,
  DynFlags -> DynFlags)]
unsafeFlagsForInfer

-- | Produce a list of suggestions for a user provided flag that is invalid.
flagSuggestions
  :: [String] -- valid flags to match against
  -> String
  -> [String]
flagSuggestions :: [[Char]] -> [Char] -> [[Char]]
flagSuggestions [[Char]]
flags [Char]
userInput
  -- fixes #11789
  -- If the flag contains '=',
  -- this uses both the whole and the left side of '=' for comparing.
  | Char -> [Char] -> TurnOnFlag
forall a. Eq a => a -> [a] -> TurnOnFlag
forall (t :: * -> *) a.
(Foldable t, Eq a) =>
a -> t a -> TurnOnFlag
elem Char
'=' [Char]
userInput =
        let ([[Char]]
flagsWithEq, [[Char]]
flagsWithoutEq) = ([Char] -> TurnOnFlag) -> [[Char]] -> ([[Char]], [[Char]])
forall a. (a -> TurnOnFlag) -> [a] -> ([a], [a])
partition (Char -> [Char] -> TurnOnFlag
forall a. Eq a => a -> [a] -> TurnOnFlag
forall (t :: * -> *) a.
(Foldable t, Eq a) =>
a -> t a -> TurnOnFlag
elem Char
'=') [[Char]]
flags
            fName :: [Char]
fName = (Char -> TurnOnFlag) -> [Char] -> [Char]
forall a. (a -> TurnOnFlag) -> [a] -> [a]
takeWhile (Char -> Char -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
/= Char
'=') [Char]
userInput
        in ([Char] -> [[Char]] -> [[Char]]
fuzzyMatch [Char]
userInput [[Char]]
flagsWithEq) [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++ ([Char] -> [[Char]] -> [[Char]]
fuzzyMatch [Char]
fName [[Char]]
flagsWithoutEq)
  | TurnOnFlag
otherwise = [Char] -> [[Char]] -> [[Char]]
fuzzyMatch [Char]
userInput [[Char]]
flags

{- **********************************************************************
%*                                                                      *
                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 = TurnOnFlag -> [[Char]]
allFlagsDeps TurnOnFlag
False

-- | All flags with possibility to filter deprecated ones
allFlagsDeps :: Bool -> [String]
allFlagsDeps :: TurnOnFlag -> [[Char]]
allFlagsDeps TurnOnFlag
keepDeprecated = [ Char
'-'Char -> [Char] -> [Char]
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
                              , TurnOnFlag
keepDeprecated TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| TurnOnFlag -> TurnOnFlag
not (Deprecation -> TurnOnFlag
isDeprecated Deprecation
deprecated)]
  where isDeprecated :: Deprecation -> TurnOnFlag
isDeprecated Deprecation
Deprecated = TurnOnFlag
True
        isDeprecated Deprecation
_ = TurnOnFlag
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)

-- 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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
deprecate [Char]
message
add_dep_message (Word64Suffix Word64 -> DynP ()
f) [Char]
message =
                                  (Word64 -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Word64 -> EwM m ()) -> OptKind m
Word64Suffix ((Word64 -> DynP ()) -> OptKind (CmdLineP DynFlags))
-> (Word64 -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ \Word64
i -> Word64 -> DynP ()
f Word64
i DynP () -> DynP () -> DynP ()
forall a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> [Char] -> DynP ()
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 a. a -> EwM (CmdLineP DynFlags) a
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 ()
deprecate ([Char]
"-#include and INCLUDE pragmas are " [Char] -> [Char] -> [Char]
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 -> TurnOnFlag
forall a. Ord a => a -> a -> TurnOnFlag
> Int
0     -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { parMakeCount = Just (ParMakeThisMany n) })
                     | TurnOnFlag
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 = Just ParMakeNumProcessors })))
                 -- 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
defGhcFlag [Char]
"jsem" (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 DynFlags
d -> DynFlags
d { parMakeCount = Just (ParMakeSemaphore f) }

  , 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 = Just $ fromIntegral (decodeSize 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 = 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))
  , (Deprecation
Deprecated, DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag     [Char]
"eventlog"
     (OptKind (CmdLineP DynFlags) -> Flag (CmdLineP DynFlags))
-> OptKind (CmdLineP DynFlags) -> Flag (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ (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
d -> do
         [Char] -> DynP ()
deprecate [Char]
"the eventlog is now enabled in all runtime system ways"
         DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
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
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]
"single-threaded" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (Way -> DynP ()
removeWayDynP 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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
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 (Way -> DynP ()
removeWayDynP Way
WayDyn))
  , 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  = (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  = (f,[]) }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmlas"
      (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_las  = (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  =
          if null f then Nothing else Just (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   =  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   = 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]
"pgmJSP"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setPgmJSP)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmCmmP"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setPgmCmmP)
  , 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   = 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   = f }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgmcxx"
      (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_cxx = f }
  , (Deprecation
Deprecated, DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag  [Char]
"pgmc-supports-no-pie"
      (OptKind (CmdLineP DynFlags) -> Flag (CmdLineP DynFlags))
-> OptKind (CmdLineP DynFlags) -> Flag (CmdLineP DynFlags)
forall a b. (a -> b) -> a -> b
$ (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
d -> do
        [Char] -> DynP ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"use -pgml-supports-no-pie instead"
        DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (DynFlags -> DynP DynFlags) -> DynFlags -> DynP DynFlags
forall a b. (a -> b) -> a -> b
$ (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings (\ToolSettings
s -> ToolSettings
s { toolSettings_ccSupportsNoPie = True }) DynFlags
d)
  , 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   = (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   = (f,[])
         , -- Don't pass -no-pie with custom -pgml (see #15319). Note
           -- that this could break when -no-pie is actually needed.
           -- But the CC_SUPPORTS_NO_PIE check only happens at
           -- buildtime, and -pgml is a runtime option. A better
           -- solution would be running this check for each custom
           -- -pgml.
           toolSettings_ccSupportsNoPie = False
         }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"pgml-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 = True }
  , 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 = 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 = 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 = 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 = 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 = 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  = f : toolSettings_opt_lm 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  = f : toolSettings_opt_lo 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  = f : toolSettings_opt_lc s }
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optlas"
      (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_las  = f : toolSettings_opt_las 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   = f : toolSettings_opt_i 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   = f : toolSettings_opt_L 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]
"optJSP"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addOptJSP)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"optCmmP"
      (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addOptCmmP)
  , 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   = f : toolSettings_opt_F 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   = f : toolSettings_opt_a 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 = f : toolSettings_opt_windres s }

    -- N.B. We may someday deprecate this in favor of -fsplit-sections,
    -- which has the benefit of also having a negating -fno-split-sections.
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"split-sections"
      (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_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 (TurnOnFlag -> DynFlags -> DynFlags
setDepIncludeCppDeps TurnOnFlag
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 (TurnOnFlag -> DynFlags -> DynFlags
setDepIncludePkgDeps TurnOnFlag
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=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=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=LinkStaticLib })))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"-merge-objs"
        ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { ghcLink=LinkMergedObj }))
  , 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) -> ([Char] -> [Char]) -> [Char] -> Option
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Char]
"-l" [Char] -> [Char] -> [Char]
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]
"dynohi"
        (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg (Maybe [Char] -> DynFlags -> DynFlags
setDynOutputHi (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 ([Char] -> Maybe [Char])
-> ([Char] -> [Char]) -> [Char] -> Maybe [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([Char] -> [Char] -> [Char]) -> [Char] -> [Char] -> [Char]
forall a b c. (a -> b -> c) -> b -> a -> c
flip [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
(++) [Char]
"."))

  , 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
llvmBackend DynP () -> DynP () -> DynP ()
forall a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
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
llvmBackend DynP () -> DynP () -> DynP ()
forall a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
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]
"fobject-determinism"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_ObjectDeterminism))
  , 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 = 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-ap-thunk"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_Ticky_AP))
  , 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))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ticky-tag-checks"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_Ticky_Tag))
        ------- 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 = Just (max 1 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = Never })))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fprint-error-index-links=auto"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { useErrorLinks = Auto })))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fprint-error-index-links=always"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { useErrorLinks = Always })))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fprint-error-index-links=never"
      (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg ((DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { useErrorLinks = Never })))

  -- Suppress all that is suppressible 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_SuppressCoercionTypes
                  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_SuppressStgReps
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressTypeSignatures
                  GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_SuppressCoreSizes
                  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-cmm-thread-sanitizer"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_cmm_thread_sanitizer)
  , 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-js"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_js)
  , 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-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
$ 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-verbose-inlinings"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_verbose_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]
"dkeep-comments"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_KeepRawTokenStream))
  , 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-spec-constr"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_spec_constr)
  , 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-late-cc"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_late_cc)
  , 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)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-stg-cg"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_stg_cg)
  , 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-stg-tags"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_stg_tags)
  , 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)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-stranal"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_dmdanal)
        [Char]
"Use `-ddump-dmdanal` instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-str-signatures"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_dmd_signatures)
        [Char]
"Use `-ddump-dmd-signatures` instead"
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-dmdanal"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_dmdanal)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-dmd-signatures"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_dmd_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-float-out"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_float_out)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-full-laziness"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_float_out)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-float-in"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_float_in)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-liberate-case"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_liberate_case)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-static-argument-transformation"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_static_argument_transformation)
  , 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-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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> DumpFlag -> DynP ()
setDumpFlag' DumpFlag
Opt_D_verbose_core2core)
  , 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]
"dlint"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg DynP ()
enableDLint)
  , 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]
"dtag-inference-checks"
        (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DoTagInferenceChecks))
  , 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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
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]
"dipe-stats"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_ipe_stats)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"dfaststring-stats"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
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)
-> [Char]
-> (Deprecation, Flag (CmdLineP DynFlags))
make_dep_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"ddump-json"
        (DumpFlag -> OptKind (CmdLineP DynFlags)
setDumpFlag DumpFlag
Opt_D_dump_json)
        [Char]
"Use `-fdiagnostics-as-json` instead"
  , 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 = Just 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 = Just 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 = Just 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 = Just 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 = Just 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 = Just 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 = Just 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 = 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 = 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 = 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 = 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 = 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 = True }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"mfma"         ((DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
noArg (\DynFlags
d -> DynFlags
d { fma = True }))

        ------ 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)

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"fplugin-library" (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
addExternalPlugin)

        ------ 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 = case fromIntegral n of
                                                    Word
0 -> Maybe Word
forall a. Maybe a
Nothing
                                                    Word
x -> Word -> Maybe Word
forall a. a -> Maybe a
Just Word
x}))
  , 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 = Just 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 = 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 = Just 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 = 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 = Just 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 = 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 = Just 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 = Nothing }))

  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fwrite-if-compression"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { ifCompression = n }))

  , 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 = 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 = 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 = 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 = 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 ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"use -fmax-pmcheck-models instead"
          ; DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
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 = n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fdmd-unbox-width"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { dmdUnboxWidth = 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 = Just 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 = 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 = Just 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 = 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 = 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 = Just 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 = 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 = Just 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 { unfoldingOpts = updateReportPrefix (Just s) (unfoldingOpts d)}))
  , 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 = treatZeroAsInf 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 = treatZeroAsInf n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fgivens-expansion-fuel"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { givensFuel = n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fwanteds-expansion-fuel"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { wantedsFuel = n }))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fqcs-expansion-fuel"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d { qcsFuel = 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 ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"use -freduction-depth=" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Int -> [Char]
forall a. Show a => a -> [Char]
show Int
n [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
" instead"
          ; DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
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 = treatZeroAsInf 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 ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"use -freduction-depth=" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Int -> [Char]
forall a. Show a => a -> [Char]
show Int
n [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
" instead"
          ; DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
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 = treatZeroAsInf 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 = n : strictnessBefore 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 = Just 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 = 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 = Just 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 = 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 = Just 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 = 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 = 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 = 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 = Just 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 =
                parseWeights s (cfgWeights 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 = 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 = updateCreationThreshold n (unfoldingOpts 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 = updateUseThreshold n (unfoldingOpts 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 = updateFunAppDiscount n (unfoldingOpts 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 = updateDictDiscount n (unfoldingOpts 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 = updateCaseThreshold n (unfoldingOpts 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 = updateCaseScaling n (unfoldingOpts 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 = n}))
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"fmax-forced-spec-args"
      ((Int -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
intSuffix (\Int
n DynFlags
d -> DynFlags
d {maxForcedSpecArgs = 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 = 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 = 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 = 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 = 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"
      ((Word64 -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
word64Suffix (\Word64
n DynFlags
d -> DynFlags
d { initialUnique = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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)
        ------ 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
ncgBackend))
  , 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 ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"The -fvia-c flag does nothing; " [Char] -> [Char] -> [Char]
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 ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"The -fvia-C flag does nothing; " [Char] -> [Char] -> [Char]
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
llvmBackend))

  , 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=NoLink }) DynP () -> DynP () -> DynP ()
forall a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
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
interpreterBackend
        DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
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)
-> GeneralFlag -> DynFlags -> DynFlags
forall a b c. (a -> b -> c) -> b -> a -> c
flip DynFlags -> GeneralFlag -> DynFlags
gopt_unset GeneralFlag
Opt_ByteCodeAndObjectCode (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
$ (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 -> DynP ()) -> Backend -> DynP ()
forall a b. (a -> b) -> a -> b
$ Platform -> Backend
platformDefaultBackend (DynFlags -> Platform
targetPlatform DynFlags
dflags)
      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
      pure $ gopt_unset dflags' Opt_ByteCodeAndObjectCode

  , 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"

        ------ 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 = 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 (TurnOnFlag
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (GeneralFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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]
++

        ------ Warning flags -------------------------------------------------
  [ 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 (WarningGroup -> DynP ()
setWarningGroup WarningGroup
W_extra))
  , 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
                          ; WarningGroup -> DynP ()
setFatalWarningGroup WarningGroup
W_everything }))
  , 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
                          ; WarningGroup -> DynP ()
unSetFatalWarningGroup WarningGroup
W_everything }))
                          -- 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 (WarningGroup -> DynP ()
unSetWarningGroup WarningGroup
W_everything))
                                             [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 (WarningGroup -> DynP ()
unSetWarningGroup WarningGroup
W_everything))
  ]

     -- New-style uniform warning sets
     --
     -- Note that -Weverything > -Wall > -Wextra > -Wdefault > -Wno-everything
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ (WarningGroup -> DynP ())
-> (WarningGroup -> DynP ())
-> (WarningGroup -> DynP ())
-> (WarningGroup -> DynP ())
-> [(Deprecation, FlagSpec WarningGroup)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall warn_flag.
(warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
warningControls WarningGroup -> DynP ()
setWarningGroup WarningGroup -> DynP ()
unSetWarningGroup WarningGroup -> DynP ()
setWErrorWarningGroup WarningGroup -> DynP ()
unSetFatalWarningGroup [(Deprecation, FlagSpec WarningGroup)]
warningGroupsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ (WarningFlag -> DynP ())
-> (WarningFlag -> DynP ())
-> (WarningFlag -> DynP ())
-> (WarningFlag -> DynP ())
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall warn_flag.
(warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
warningControls WarningFlag -> DynP ()
setWarningFlag WarningFlag -> DynP ()
unSetWarningFlag WarningFlag -> DynP ()
setWErrorFlag WarningFlag -> DynP ()
unSetFatalWarningFlag [(Deprecation, FlagSpec WarningFlag)]
wWarningFlagsDeps
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ (WarningCategory -> DynP ())
-> (WarningCategory -> DynP ())
-> (WarningCategory -> DynP ())
-> (WarningCategory -> DynP ())
-> [(Deprecation, FlagSpec WarningCategory)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall warn_flag.
(warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
warningControls WarningCategory -> DynP ()
setCustomWarningFlag WarningCategory -> DynP ()
unSetCustomWarningFlag WarningCategory -> DynP ()
setCustomWErrorFlag WarningCategory -> DynP ()
unSetCustomFatalWarningFlag
      [(Deprecation
NotDeprecated, [Char]
-> WarningCategory
-> (TurnOnFlag -> DynP ())
-> GhcFlagMode
-> FlagSpec WarningCategory
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
"warnings-deprecations" WarningCategory
defaultWarningCategory TurnOnFlag -> DynP ()
nop GhcFlagMode
AllModes)]
      -- See Note [Warning categories] in GHC.Unit.Module.Warnings.

 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ [ (Deprecation
NotDeprecated, [Char] -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning [Char]
"Wno-"       WarningCategory -> DynP ()
unSetCustomWarningFlag)
    , (Deprecation
NotDeprecated, [Char] -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning [Char]
"Werror="    WarningCategory -> DynP ()
setCustomWErrorFlag)
    , (Deprecation
NotDeprecated, [Char] -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning [Char]
"Wwarn="     WarningCategory -> DynP ()
unSetCustomFatalWarningFlag)
    , (Deprecation
NotDeprecated, [Char] -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning [Char]
"Wno-error=" WarningCategory -> DynP ()
unSetCustomFatalWarningFlag)
    , (Deprecation
NotDeprecated, [Char] -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning [Char]
"W"          WarningCategory -> DynP ()
setCustomWarningFlag)
    , (Deprecation
Deprecated,    [Char] -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning [Char]
"fwarn-"     WarningCategory -> DynP ()
setCustomWarningFlag)
    , (Deprecation
Deprecated,    [Char] -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning [Char]
"fno-warn-"  WarningCategory -> DynP ()
unSetCustomWarningFlag)
    ]

     ------ JavaScript flags -----------------------------------------------
 [(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]
"ddisable-js-minifier" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DisableJsMinifier))
    , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defFlag [Char]
"ddisable-js-c-sources" (DynP () -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). EwM m () -> OptKind m
NoArg (GeneralFlag -> DynP ()
setGeneralFlag GeneralFlag
Opt_DisableJsCsources))
    ]

     ------ Language flags -------------------------------------------------
 [(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 (TurnOnFlag
-> [Char]
-> (Extension -> DynP ())
-> (Deprecation, FlagSpec Extension)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (Extension -> DynP ())
-> (Deprecation, FlagSpec Extension)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (Extension -> DynP ())
-> (Deprecation, FlagSpec Extension)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (Extension -> DynP ())
-> (Deprecation, FlagSpec Extension)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (Language -> DynP ())
-> (Deprecation, FlagSpec Language)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
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 (TurnOnFlag
-> [Char]
-> (SafeHaskellMode -> DynP ())
-> (Deprecation, FlagSpec SafeHaskellMode)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
turnOn  [Char]
"X"         SafeHaskellMode -> DynP ()
setSafeHaskell    ) [(Deprecation, FlagSpec SafeHaskellMode)]
safeHaskellFlagsDeps

-- | Warnings have both new-style flags to control their state (@-W@, @-Wno-@,
-- @-Werror=@, @-Wwarn=@) and old-style flags (@-fwarn-@, @-fno-warn-@).  We
-- define these uniformly for individual warning flags and groups of warnings.
warningControls :: (warn_flag -> DynP ()) -- ^ Set the warning
                -> (warn_flag -> DynP ()) -- ^ Unset the warning
                -> (warn_flag -> DynP ()) -- ^ Make the warning an error
                -> (warn_flag -> DynP ()) -- ^ Clear the error status
                -> [(Deprecation, FlagSpec warn_flag)]
                -> [(Deprecation, Flag (CmdLineP DynFlags))]
warningControls :: forall warn_flag.
(warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> (warn_flag -> DynP ())
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
warningControls warn_flag -> DynP ()
set warn_flag -> DynP ()
unset warn_flag -> DynP ()
set_werror warn_flag -> DynP ()
unset_fatal [(Deprecation, FlagSpec warn_flag)]
xs =
    ((Deprecation, FlagSpec warn_flag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (TurnOnFlag
-> [Char]
-> (warn_flag -> DynP ())
-> (Deprecation, FlagSpec warn_flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
turnOn  [Char]
"W"          warn_flag -> DynP ()
set             ) [(Deprecation, FlagSpec warn_flag)]
xs
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec warn_flag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (TurnOnFlag
-> [Char]
-> (warn_flag -> DynP ())
-> (Deprecation, FlagSpec warn_flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
turnOff [Char]
"Wno-"       warn_flag -> DynP ()
unset           ) [(Deprecation, FlagSpec warn_flag)]
xs
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec warn_flag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (TurnOnFlag
-> [Char]
-> (warn_flag -> DynP ())
-> (Deprecation, FlagSpec warn_flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
turnOn  [Char]
"Werror="    warn_flag -> DynP ()
set_werror      ) [(Deprecation, FlagSpec warn_flag)]
xs
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec warn_flag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (TurnOnFlag
-> [Char]
-> (warn_flag -> DynP ())
-> (Deprecation, FlagSpec warn_flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
turnOn  [Char]
"Wwarn="     warn_flag -> DynP ()
unset_fatal     ) [(Deprecation, FlagSpec warn_flag)]
xs
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec warn_flag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (TurnOnFlag
-> [Char]
-> (warn_flag -> DynP ())
-> (Deprecation, FlagSpec warn_flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
turnOn  [Char]
"Wno-error=" warn_flag -> DynP ()
unset_fatal     ) [(Deprecation, FlagSpec warn_flag)]
xs
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec warn_flag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (TurnOnFlag
-> [Char]
-> (warn_flag -> DynP ())
-> (Deprecation, FlagSpec warn_flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
turnOn  [Char]
"fwarn-"     warn_flag -> DynP ()
set   ((Deprecation, FlagSpec warn_flag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> ((Deprecation, FlagSpec warn_flag)
    -> (Deprecation, FlagSpec warn_flag))
-> (Deprecation, FlagSpec warn_flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Deprecation, FlagSpec warn_flag)
-> (Deprecation, FlagSpec warn_flag)
forall a. (Deprecation, FlagSpec a) -> (Deprecation, FlagSpec a)
hideFlag) [(Deprecation, FlagSpec warn_flag)]
xs
 [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a. [a] -> [a] -> [a]
++ ((Deprecation, FlagSpec warn_flag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> [(Deprecation, FlagSpec warn_flag)]
-> [(Deprecation, Flag (CmdLineP DynFlags))]
forall a b. (a -> b) -> [a] -> [b]
map (TurnOnFlag
-> [Char]
-> (warn_flag -> DynP ())
-> (Deprecation, FlagSpec warn_flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall flag.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
turnOff [Char]
"fno-warn-"  warn_flag -> DynP ()
unset ((Deprecation, FlagSpec warn_flag)
 -> (Deprecation, Flag (CmdLineP DynFlags)))
-> ((Deprecation, FlagSpec warn_flag)
    -> (Deprecation, FlagSpec warn_flag))
-> (Deprecation, FlagSpec warn_flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Deprecation, FlagSpec warn_flag)
-> (Deprecation, FlagSpec warn_flag)
forall a. (Deprecation, FlagSpec a) -> (Deprecation, FlagSpec a)
hideFlag) [(Deprecation, FlagSpec warn_flag)]
xs

-- | This is where we handle unrecognised warning flags. If the flag is valid as
-- an extended warning category, we call the supplied action. Otherwise, issue a
-- warning if -Wunrecognised-warning-flags is set. See #11429 for context.
-- See Note [Warning categories] in GHC.Unit.Module.Warnings.
customOrUnrecognisedWarning :: String -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning :: [Char] -> (WarningCategory -> DynP ()) -> Flag (CmdLineP DynFlags)
customOrUnrecognisedWarning [Char]
prefix WarningCategory -> DynP ()
custom = 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 -> DynP ()
    action :: [Char] -> DynP ()
action [Char]
flag
      | WarningCategory -> TurnOnFlag
validWarningCategory WarningCategory
cat = WarningCategory -> DynP ()
custom WarningCategory
cat
      | TurnOnFlag
otherwise = [Char] -> DynP ()
unrecognised [Char]
flag
      where
        cat :: WarningCategory
cat = FastString -> WarningCategory
mkWarningCategory ([Char] -> FastString
mkFastString [Char]
flag)

    unrecognised :: [Char] -> DynP ()
unrecognised [Char]
flag = do
      -- #23402 and #12056
      -- for unrecognised flags we consider current dynflags, not the final one.
      -- But if final state says to not report unrecognised flags, they won't anyway.
      f <- WarningFlag -> DynFlags -> TurnOnFlag
wopt WarningFlag
Opt_WarnUnrecognisedWarningFlags (DynFlags -> TurnOnFlag)
-> DynP DynFlags -> EwM (CmdLineP DynFlags) TurnOnFlag
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
      when f $ addFlagWarn (DriverUnrecognisedFlag (prefix ++ 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
defGhcFlag [Char]
"working-dir"       (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setWorkingDirectory)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"this-package-name"  (([Char] -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
hasArg [Char] -> DynFlags -> DynFlags
setPackageName)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"hidden-module"      (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
addHiddenModule)
  , DynFlagMaker
-> [Char]
-> OptKind (CmdLineP DynFlags)
-> (Deprecation, Flag (CmdLineP DynFlags))
make_ord_flag DynFlagMaker
forall (m :: * -> *). [Char] -> OptKind m -> Flag m
defGhcFlag [Char]
"reexported-module"  (([Char] -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). ([Char] -> EwM m ()) -> OptKind m
HasArg [Char] -> DynP ()
addReexportedModule)

  , 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 = Just 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 :: TurnOnFlag -> [[Char]]
flagsForCompletion TurnOnFlag
isInteractive
    = [ Char
'-'Char -> [Char] -> [Char]
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 -> TurnOnFlag
modeFilter (Flag (CmdLineP DynFlags) -> GhcFlagMode
forall (m :: * -> *). Flag m -> GhcFlagMode
flagGhcMode Flag (CmdLineP DynFlags)
flag)
      ]
    where
      modeFilter :: GhcFlagMode -> TurnOnFlag
modeFilter GhcFlagMode
AllModes = TurnOnFlag
True
      modeFilter GhcFlagMode
OnlyGhci = TurnOnFlag
isInteractive
      modeFilter GhcFlagMode
OnlyGhc = TurnOnFlag -> TurnOnFlag
not TurnOnFlag
isInteractive
      modeFilter GhcFlagMode
HiddenFlag = TurnOnFlag
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 -> TurnOnFlag -> 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 -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
name flag
flag TurnOnFlag -> DynP ()
nop

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

-- | Define a warning flag.
warnSpec :: WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec :: WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
flag = WarningFlag
-> (TurnOnFlag -> DynP ()) -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec' WarningFlag
flag TurnOnFlag -> DynP ()
nop

-- | Define a warning flag with an effect.
warnSpec' :: WarningFlag -> (TurnOnFlag -> DynP ())
          -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec' :: WarningFlag
-> (TurnOnFlag -> DynP ()) -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec' WarningFlag
flag TurnOnFlag -> DynP ()
act = [ (Deprecation
NotDeprecated, [Char]
-> WarningFlag
-> (TurnOnFlag -> DynP ())
-> GhcFlagMode
-> FlagSpec WarningFlag
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name WarningFlag
flag TurnOnFlag -> DynP ()
act GhcFlagMode
AllModes)
                     | [Char]
name <- NonEmpty [Char] -> [[Char]]
forall a. NonEmpty a -> [a]
NE.toList (WarningFlag -> NonEmpty [Char]
warnFlagNames WarningFlag
flag)
                     ]

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

-- | Define a deprecated warning flag.
depWarnSpec :: WarningFlag -> String
            -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec :: WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
flag [Char]
dep = [ [Char]
-> WarningFlag
-> (TurnOnFlag -> DynP ())
-> [Char]
-> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char]
-> flag
-> (TurnOnFlag -> DynP ())
-> [Char]
-> (Deprecation, FlagSpec flag)
depFlagSpecOp [Char]
name WarningFlag
flag TurnOnFlag -> DynP ()
nop [Char]
dep
                       | [Char]
name <- NonEmpty [Char] -> [[Char]]
forall a. NonEmpty a -> [a]
NE.toList (WarningFlag -> NonEmpty [Char]
warnFlagNames WarningFlag
flag)
                       ]

-- | Define a deprecated warning name substituted by another.
subWarnSpec :: String -> WarningFlag -> String
            -> [(Deprecation, FlagSpec WarningFlag)]
subWarnSpec :: [Char]
-> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
subWarnSpec [Char]
oldname WarningFlag
flag [Char]
dep = [ [Char]
-> WarningFlag
-> (TurnOnFlag -> DynP ())
-> [Char]
-> (Deprecation, FlagSpec WarningFlag)
forall flag.
[Char]
-> flag
-> (TurnOnFlag -> DynP ())
-> [Char]
-> (Deprecation, FlagSpec flag)
depFlagSpecOp [Char]
oldname WarningFlag
flag TurnOnFlag -> 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
-> (TurnOnFlag -> DynP ())
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec flag)
depFlagSpecOp' [Char]
name flag
flag TurnOnFlag -> DynP ()
act TurnOnFlag -> [Char]
dep =
    (Deprecation
Deprecated, [Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name flag
flag (\TurnOnFlag
f -> TurnOnFlag -> DynP ()
act TurnOnFlag
f DynP () -> DynP () -> DynP ()
forall a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> ([Char] -> DynP ()
deprecate ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ TurnOnFlag -> [Char]
dep TurnOnFlag
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 -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
name flag
flag TurnOnFlag -> [Char]
dep = [Char]
-> flag
-> (TurnOnFlag -> DynP ())
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec flag)
forall flag.
[Char]
-> flag
-> (TurnOnFlag -> DynP ())
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec flag)
depFlagSpecOp' [Char]
name flag
flag TurnOnFlag -> DynP ()
nop TurnOnFlag -> [Char]
dep

-- | 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 -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag)
flagGhciSpec' [Char]
name flag
flag TurnOnFlag -> DynP ()
nop

-- | Define a new flag for GHCi with an effect.
flagGhciSpec' :: String -> flag -> (TurnOnFlag -> DynP ())
              -> (Deprecation, FlagSpec flag)
flagGhciSpec' :: forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag)
flagGhciSpec' [Char]
name flag
flag TurnOnFlag -> DynP ()
act = (Deprecation
NotDeprecated, [Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name flag
flag TurnOnFlag -> 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 -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag)
flagHiddenSpec' [Char]
name flag
flag TurnOnFlag -> 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 -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag)
flagHiddenSpec' [Char]
name flag
flag TurnOnFlag -> DynP ()
act = (Deprecation
NotDeprecated, [Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name flag
flag TurnOnFlag -> 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 = 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.
TurnOnFlag
-> [Char]
-> (flag -> DynP ())
-> (Deprecation, FlagSpec flag)
-> (Deprecation, Flag (CmdLineP DynFlags))
mkFlag TurnOnFlag
turn_on [Char]
flagPrefix flag -> DynP ()
f (Deprecation
dep, (FlagSpec [Char]
name flag
flag TurnOnFlag -> 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] -> [Char] -> [Char]
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 a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TurnOnFlag -> DynP ()
extra_action TurnOnFlag
turn_on)) GhcFlagMode
mode)

deprecate :: String -> DynP ()
deprecate :: [Char] -> DynP ()
deprecate [Char]
s = do
    arg <- EwM (CmdLineP DynFlags) [Char]
forall (m :: * -> *). Monad m => EwM m [Char]
getArg
    addFlagWarn (DriverDeprecatedFlag arg s)

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

deprecatedForExtensions :: [String] -> TurnOnFlag -> String
deprecatedForExtensions :: [[Char]] -> TurnOnFlag -> [Char]
deprecatedForExtensions [] TurnOnFlag
_ = [Char] -> [Char]
forall a. HasCallStack => [Char] -> a
panic [Char]
"new extension has not been specified"
deprecatedForExtensions [[Char]
lang] TurnOnFlag
turn_on = [Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
lang TurnOnFlag
turn_on
deprecatedForExtensions [[Char]]
langExts TurnOnFlag
turn_on
    = [Char]
"use " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [[Char]] -> [Char]
xExt [[Char]]
flags [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
" instead"
    where
      flags :: [[Char]]
flags | TurnOnFlag
turn_on = [[Char]]
langExts
            | TurnOnFlag
otherwise = ([Char]
"No" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++) ([Char] -> [Char]) -> [[Char]] -> [[Char]]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Char]]
langExts

      xExt :: [[Char]] -> [Char]
xExt [[Char]]
fls = [Char] -> [[Char]] -> [Char]
forall a. [a] -> [[a]] -> [a]
intercalate [Char]
" and "  ([[Char]] -> [Char]) -> [[Char]] -> [Char]
forall a b. (a -> b) -> a -> b
$ (\[Char]
flag -> [Char]
"-X" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
flag) ([Char] -> [Char]) -> [[Char]] -> [[Char]]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Char]]
fls

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

nop :: TurnOnFlag -> DynP ()
nop :: TurnOnFlag -> DynP ()
nop TurnOnFlag
_ = () -> DynP ()
forall a. a -> EwM (CmdLineP DynFlags) a
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
 -> Map WarningFlag (FlagSpec WarningFlag)
 -> Maybe (FlagSpec WarningFlag))
-> Map WarningFlag (FlagSpec WarningFlag)
-> WarningFlag
-> Maybe (FlagSpec WarningFlag)
forall a b c. (a -> b -> c) -> b -> a -> c
flip WarningFlag
-> Map WarningFlag (FlagSpec WarningFlag)
-> Maybe (FlagSpec WarningFlag)
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup Map WarningFlag (FlagSpec WarningFlag)
wWarningFlagMap

wWarningFlagMap :: Map.Map WarningFlag (FlagSpec WarningFlag)
wWarningFlagMap :: Map WarningFlag (FlagSpec WarningFlag)
wWarningFlagMap = (FlagSpec WarningFlag
 -> FlagSpec WarningFlag -> FlagSpec WarningFlag)
-> [(WarningFlag, FlagSpec WarningFlag)]
-> Map WarningFlag (FlagSpec WarningFlag)
forall k a. Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
Map.fromListWith (\FlagSpec WarningFlag
_ FlagSpec WarningFlag
x -> FlagSpec WarningFlag
x) ([(WarningFlag, FlagSpec WarningFlag)]
 -> Map WarningFlag (FlagSpec WarningFlag))
-> [(WarningFlag, FlagSpec WarningFlag)]
-> Map WarningFlag (FlagSpec WarningFlag)
forall a b. (a -> b) -> a -> b
$ (FlagSpec WarningFlag -> (WarningFlag, FlagSpec WarningFlag))
-> [FlagSpec WarningFlag] -> [(WarningFlag, FlagSpec WarningFlag)]
forall a b. (a -> b) -> [a] -> [b]
map (FlagSpec WarningFlag -> WarningFlag
forall flag. FlagSpec flag -> flag
flagSpecFlag (FlagSpec WarningFlag -> WarningFlag)
-> (FlagSpec WarningFlag -> FlagSpec WarningFlag)
-> FlagSpec WarningFlag
-> (WarningFlag, FlagSpec WarningFlag)
forall b c c'. (b -> c) -> (b -> c') -> b -> (c, c')
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& FlagSpec WarningFlag -> FlagSpec WarningFlag
forall a. a -> a
id) [FlagSpec WarningFlag]
wWarningFlags

-- | 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 = [WarningFlag
forall a. Bounded a => a
minBound..WarningFlag
forall a. Bounded a => a
maxBound] [WarningFlag]
-> (WarningFlag -> [(Deprecation, FlagSpec WarningFlag)])
-> [(Deprecation, FlagSpec WarningFlag)]
forall a b. [a] -> (a -> [b]) -> [b]
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \WarningFlag
x -> case WarningFlag
x of
-- See Note [Updating flag description in the User's Guide]
-- See Note [Supporting CLI completion]
  WarningFlag
Opt_WarnAlternativeLayoutRuleTransitional -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnAmbiguousFields -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnAutoOrphans -> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
x [Char]
"it has no effect"
  WarningFlag
Opt_WarnCPPUndef -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnBadlyStagedTypes -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnbangedStrictPatterns -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDeferredTypeErrors -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDeferredOutOfScopeVariables -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDeprecatedFlags -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDerivingDefaults -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDerivingTypeable -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDodgyExports -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDodgyForeignImports -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDodgyImports -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnEmptyEnumerations -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDuplicateConstraints
    -> [Char]
-> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
subWarnSpec [Char]
"duplicate-constraints" WarningFlag
x [Char]
"it is subsumed by -Wredundant-constraints"
  WarningFlag
Opt_WarnRedundantConstraints -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDuplicateExports -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnHiShadows
    -> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
x [Char]
"it is not used, and was never implemented"
  WarningFlag
Opt_WarnInaccessibleCode -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnImplicitPrelude -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnImplicitKindVars -> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
x [Char]
"it is now an error"
  WarningFlag
Opt_WarnIncompletePatterns -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnIncompletePatternsRecUpd -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnIncompleteUniPatterns -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnInconsistentFlags -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnInlineRuleShadowing -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnIdentities -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnLoopySuperclassSolve -> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
x [Char]
"it is now an error"
  WarningFlag
Opt_WarnMissingFields -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingImportList -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingExportList -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingLocalSignatures
    -> [Char]
-> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
subWarnSpec [Char]
"missing-local-sigs" WarningFlag
x
                   [Char]
"it is replaced by -Wmissing-local-signatures"
       [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, FlagSpec WarningFlag)]
forall a. [a] -> [a] -> [a]
++ WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingMethods -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingMonadFailInstances
    -> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
x [Char]
"fail is no longer a method of Monad"
  WarningFlag
Opt_WarnSemigroup -> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
x [Char]
"Semigroup is now a superclass of Monoid"
  WarningFlag
Opt_WarnMissingSignatures -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingKindSignatures -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingPolyKindSignatures -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingExportedSignatures
    -> [Char]
-> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
subWarnSpec [Char]
"missing-exported-sigs" WarningFlag
x
                   [Char]
"it is replaced by -Wmissing-exported-signatures"
       [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, FlagSpec WarningFlag)]
-> [(Deprecation, FlagSpec WarningFlag)]
forall a. [a] -> [a] -> [a]
++ WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMonomorphism -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnNameShadowing -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnNonCanonicalMonadInstances -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnNonCanonicalMonadFailInstances
    -> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
x [Char]
"fail is no longer a method of Monad"
  WarningFlag
Opt_WarnNonCanonicalMonoidInstances -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnOrphans -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnOverflowedLiterals -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnOverlappingPatterns -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissedSpecs -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnAllMissedSpecs -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnSafe -> WarningFlag
-> (TurnOnFlag -> DynP ()) -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec' WarningFlag
x TurnOnFlag -> DynP ()
setWarnSafe
  WarningFlag
Opt_WarnTrustworthySafe -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnInferredSafeImports -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingSafeHaskellMode -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnTabs -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnTypeDefaults -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnTypedHoles -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnPartialTypeSignatures -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnrecognisedPragmas -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMisplacedPragmas -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnsafe -> WarningFlag
-> (TurnOnFlag -> DynP ()) -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec' WarningFlag
x TurnOnFlag -> DynP ()
setWarnUnsafe
  WarningFlag
Opt_WarnUnsupportedCallingConventions -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnsupportedLlvmVersion -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissedExtraSharedLib -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUntickedPromotedConstructors -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedDoBind -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedForalls -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedImports -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedLocalBinds -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedMatches -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedPatternBinds -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedTopBinds -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedTypePatterns -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedRecordWildcards -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnRedundantBangPatterns -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnRedundantRecordWildcards -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnRedundantStrictnessFlags -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnWrongDoBind -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingPatternSynonymSignatures -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingDerivingStrategies -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnSimplifiableClassConstraints -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingHomeModules -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnrecognisedWarningFlags -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnStarBinder -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnStarIsType -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnSpaceAfterBang
    -> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
x [Char]
"bang patterns can no longer be written with a space"
  WarningFlag
Opt_WarnPartialFields -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnPrepositiveQualifiedModule -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnUnusedPackages -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnCompatUnqualifiedImports -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnInvalidHaddock -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnOperatorWhitespaceExtConflict -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnOperatorWhitespace -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnImplicitLift -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingExportedPatternSynonymSignatures -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnForallIdentifier
    -> WarningFlag -> [Char] -> [(Deprecation, FlagSpec WarningFlag)]
depWarnSpec WarningFlag
x [Char]
"forall is no longer a valid identifier"
  WarningFlag
Opt_WarnUnicodeBidirectionalFormatCharacters -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnGADTMonoLocalBinds -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnTypeEqualityOutOfScope -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnTypeEqualityRequiresOperators -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnTermVariableCapture -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnMissingRoleAnnotations -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnImplicitRhsQuantification -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnIncompleteExportWarnings -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnIncompleteRecordSelectors -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDataKindsTC -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDeprecatedTypeAbstractions -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnDefaultedExceptionContext -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x
  WarningFlag
Opt_WarnViewPatternSignatures -> WarningFlag -> [(Deprecation, FlagSpec WarningFlag)]
warnSpec WarningFlag
x

warningGroupsDeps :: [(Deprecation, FlagSpec WarningGroup)]
warningGroupsDeps :: [(Deprecation, FlagSpec WarningGroup)]
warningGroupsDeps = (WarningGroup -> (Deprecation, FlagSpec WarningGroup))
-> [WarningGroup] -> [(Deprecation, FlagSpec WarningGroup)]
forall a b. (a -> b) -> [a] -> [b]
map WarningGroup -> (Deprecation, FlagSpec WarningGroup)
mk [WarningGroup]
warningGroups
  where
    mk :: WarningGroup -> (Deprecation, FlagSpec WarningGroup)
mk WarningGroup
g = (Deprecation
NotDeprecated, [Char]
-> WarningGroup
-> (TurnOnFlag -> DynP ())
-> GhcFlagMode
-> FlagSpec WarningGroup
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec (WarningGroup -> [Char]
warningGroupName WarningGroup
g) WarningGroup
g TurnOnFlag -> DynP ()
nop GhcFlagMode
AllModes)

-- | 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
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"ppr-ticks"              GeneralFlag
Opt_PprShowTicks
     (\TurnOnFlag
turn_on -> [Char] -> [Char] -> TurnOnFlag -> [Char]
useInstead [Char]
"-d" [Char]
"suppress-ticks" (TurnOnFlag -> TurnOnFlag
not TurnOnFlag
turn_on)),
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-ticks"             GeneralFlag
Opt_SuppressTicks,
  [Char]
-> GeneralFlag
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"suppress-stg-free-vars" GeneralFlag
Opt_SuppressStgExts
     ([Char] -> [Char] -> TurnOnFlag -> [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-stg-reps"          GeneralFlag
Opt_SuppressStgReps,
  [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-coercion-types"    GeneralFlag
Opt_SuppressCoercionTypes,
  [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,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"suppress-core-sizes"        GeneralFlag
Opt_SuppressCoreSizes
  ]

-- | 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]
"diagnostics-as-json"              GeneralFlag
Opt_DiagnosticsAsJSON,
  -- With-ways needs to be reversible hence why its made via flagSpec unlike
  -- other debugging flags.
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"dump-with-ways"                   GeneralFlag
Opt_DumpWithWays,
  [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]
"do-clever-arg-eta-expansion"      GeneralFlag
Opt_DoCleverArgEtaExpansion, -- See Note [Eta expansion of arguments in CorePrep]
  [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]
"orig-thunk-info"                  GeneralFlag
Opt_OrigThunkInfo,
  [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-overloaded-unfoldings"     GeneralFlag
Opt_ExposeOverloadedUnfoldings,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"keep-auto-rules"                  GeneralFlag
Opt_KeepAutoRules,
  [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
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"fun-to-thunk"                 GeneralFlag
Opt_FunToThunk
      ([Char] -> [Char] -> TurnOnFlag -> [Char]
useInstead [Char]
"-f" [Char]
"full-laziness"),
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"local-float-out"                  GeneralFlag
Opt_LocalFloatOut,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"local-float-out-top-level"        GeneralFlag
Opt_LocalFloatOutTopLevel,
  [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-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-redundant-promotion-ticks"  GeneralFlag
Opt_PrintRedundantPromotionTicks,
  [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]
"prof-late"                        GeneralFlag
Opt_ProfLateCcs,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"prof-late-overloaded"             GeneralFlag
Opt_ProfLateOverloadedCcs,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"prof-late-overloaded-calls"       GeneralFlag
Opt_ProfLateoverloadedCallsCCs,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"prof-manual"                      GeneralFlag
Opt_ProfManualCcs,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"prof-late-inline"                 GeneralFlag
Opt_ProfLateInlineCcs,
  [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
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"rewrite-rules"                GeneralFlag
Opt_EnableRewriteRules
   ([Char] -> [Char] -> TurnOnFlag -> [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]
"polymorphic-specialisation"       GeneralFlag
Opt_PolymorphicSpecialisation,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"specialise-incoherents"           GeneralFlag
Opt_SpecialiseIncoherents,
  [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-if-simplified-core"         GeneralFlag
Opt_WriteIfSimplifiedCore,
  [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]
"unoptimized-core-for-interpreter" GeneralFlag
Opt_UnoptimizedCoreForInterpreter,
  [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]
"worker-wrapper-cbv"               GeneralFlag
Opt_WorkerWrapperUnlift, -- See Note [Worker/wrapper for strict arguments]
  [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-nonexhaustive-cases"        GeneralFlag
Opt_CatchNonexhaustiveCases,
  [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]
"check-prim-bounds"                GeneralFlag
Opt_DoBoundsChecking,
  [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]
"core-constant-folding"            GeneralFlag
Opt_CoreConstantFolding,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"fast-pap-calls"                   GeneralFlag
Opt_FastPAPCalls,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cmm-control-flow"                 GeneralFlag
Opt_CmmControlFlow,
  [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,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"byte-code-and-object-code"        GeneralFlag
Opt_ByteCodeAndObjectCode,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"prefer-byte-code"                 GeneralFlag
Opt_UseBytecodeRatherThanObjects,
  [Char]
-> GeneralFlag
-> (TurnOnFlag -> DynP ())
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> (Deprecation, FlagSpec flag)
flagSpec' [Char]
"compact-unwind"                  GeneralFlag
Opt_CompactUnwind
      (\TurnOnFlag
turn_on -> (DynFlags -> DynP DynFlags) -> DynP ()
updM (\DynFlags
dflags -> do
        TurnOnFlag -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => TurnOnFlag -> f () -> f ()
unless (Platform -> OS
platformOS (DynFlags -> Platform
targetPlatform DynFlags
dflags) OS -> OS -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== OS
OSDarwin TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&& TurnOnFlag
turn_on)
               ([Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
addWarn [Char]
"-compact-unwind is only implemented by the darwin platform. Ignoring.")
        DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
forall (m :: * -> *) a. Monad m => a -> m a
return DynFlags
dflags)),
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"show-error-context"               GeneralFlag
Opt_ShowErrorContext,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"cmm-thread-sanitizer"             GeneralFlag
Opt_CmmThreadSanitizer,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"split-sections"                   GeneralFlag
Opt_SplitSections,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"break-points"                     GeneralFlag
Opt_InsertBreakpoints,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"distinct-constructor-tables"      GeneralFlag
Opt_DistinctConstructorTables,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"info-table-map"                   GeneralFlag
Opt_InfoTableMap,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"info-table-map-with-stack"        GeneralFlag
Opt_InfoTableMapWithStack,
  [Char] -> GeneralFlag -> (Deprecation, FlagSpec GeneralFlag)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"info-table-map-with-fallback"     GeneralFlag
Opt_InfoTableMapWithFallback
  ]
  [(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
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec GeneralFlag)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"show-valid-substitutions"     GeneralFlag
Opt_ShowValidHoleFits
   ([Char] -> [Char] -> TurnOnFlag -> [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
-> (TurnOnFlag -> DynP ())
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag
-> (TurnOnFlag -> DynP ())
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec flag)
depFlagSpecOp' [Char]
"th"                           Extension
LangExt.TemplateHaskell
    TurnOnFlag -> DynP ()
checkTemplateHaskellOk
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"TemplateHaskell"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"fi"                             Extension
LangExt.ForeignFunctionInterface
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"ForeignFunctionInterface"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"ffi"                            Extension
LangExt.ForeignFunctionInterface
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"ForeignFunctionInterface"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"arrows"                         Extension
LangExt.Arrows
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"Arrows"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"implicit-prelude"               Extension
LangExt.ImplicitPrelude
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"ImplicitPrelude"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"bang-patterns"                  Extension
LangExt.BangPatterns
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"BangPatterns"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"monomorphism-restriction"       Extension
LangExt.MonomorphismRestriction
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"MonomorphismRestriction"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"extended-default-rules"         Extension
LangExt.ExtendedDefaultRules
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"ExtendedDefaultRules"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"implicit-params"                Extension
LangExt.ImplicitParams
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"ImplicitParams"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"scoped-type-variables"          Extension
LangExt.ScopedTypeVariables
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"ScopedTypeVariables"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"allow-overlapping-instances"    Extension
LangExt.OverlappingInstances
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"OverlappingInstances"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"allow-undecidable-instances"    Extension
LangExt.UndecidableInstances
    ([Char] -> TurnOnFlag -> [Char]
deprecatedForExtension [Char]
"UndecidableInstances"),
  [Char]
-> Extension
-> (TurnOnFlag -> [Char])
-> (Deprecation, FlagSpec Extension)
forall flag.
[Char]
-> flag -> (TurnOnFlag -> [Char]) -> (Deprecation, FlagSpec flag)
depFlagSpec' [Char]
"allow-incoherent-instances"     Extension
LangExt.IncoherentInstances
    ([Char] -> TurnOnFlag -> [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
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
      | TurnOnFlag
isAIX, FlagSpec Extension -> Extension
forall flag. FlagSpec flag -> flag
flagSpecFlag FlagSpec Extension
flg Extension -> Extension -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== Extension
LangExt.TemplateHaskell  = [[Char]
noName]
      | TurnOnFlag
isAIX, FlagSpec Extension -> Extension
forall flag. FlagSpec flag -> flag
flagSpecFlag FlagSpec Extension
flg Extension -> Extension -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== Extension
LangExt.QuasiQuotes      = [[Char]
noName]
      -- "JavaScriptFFI" is only supported on the JavaScript/Wasm backend
      | TurnOnFlag
notJSOrWasm, FlagSpec Extension -> Extension
forall flag. FlagSpec flag -> flag
flagSpecFlag FlagSpec Extension
flg Extension -> Extension -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== Extension
LangExt.JavaScriptFFI = [[Char]
noName]
      | TurnOnFlag
otherwise = [[Char]
name, [Char]
noName]
      where
        isAIX :: TurnOnFlag
isAIX = OS
os OS -> OS -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== OS
OSAIX
        notJSOrWasm :: TurnOnFlag
notJSOrWasm = TurnOnFlag -> TurnOnFlag
not (TurnOnFlag -> TurnOnFlag) -> TurnOnFlag -> TurnOnFlag
forall a b. (a -> b) -> a -> b
$ Arch
arch Arch -> [Arch] -> TurnOnFlag
forall a. Eq a => a -> [a] -> TurnOnFlag
forall (t :: * -> *) a.
(Foldable t, Eq a) =>
a -> t a -> TurnOnFlag
`elem` [ Arch
ArchJavaScript, Arch
ArchWasm32 ]
        noName :: [Char]
noName = [Char]
"No" [Char] -> [Char] -> [Char]
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,
  [Char] -> Language -> (Deprecation, FlagSpec Language)
forall flag. [Char] -> flag -> (Deprecation, FlagSpec flag)
flagSpec [Char]
"GHC2024"     Language
GHC2024
  ]

-- | 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

makeExtensionFlags :: LangExt.Extension -> [(Deprecation, FlagSpec LangExt.Extension)]
makeExtensionFlags :: Extension -> [(Deprecation, FlagSpec Extension)]
makeExtensionFlags Extension
ext = [ [Char]
-> ExtensionDeprecation
-> Extension
-> (Deprecation, FlagSpec Extension)
makeExtensionFlag [Char]
name ExtensionDeprecation
depr Extension
ext | (ExtensionDeprecation
depr, [Char]
name) <- Extension -> [(ExtensionDeprecation, [Char])]
extensionNames Extension
ext ]

xFlagsDeps :: [(Deprecation, FlagSpec LangExt.Extension)]
xFlagsDeps :: [(Deprecation, FlagSpec Extension)]
xFlagsDeps = (Extension -> [(Deprecation, FlagSpec Extension)])
-> [Extension] -> [(Deprecation, FlagSpec Extension)]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Extension -> [(Deprecation, FlagSpec Extension)]
makeExtensionFlags [Extension
forall a. Bounded a => a
minBound .. Extension
forall a. Bounded a => a
maxBound]

makeExtensionFlag :: String -> ExtensionDeprecation -> LangExt.Extension -> (Deprecation, FlagSpec LangExt.Extension)
makeExtensionFlag :: [Char]
-> ExtensionDeprecation
-> Extension
-> (Deprecation, FlagSpec Extension)
makeExtensionFlag [Char]
name ExtensionDeprecation
depr Extension
ext = (ExtensionDeprecation -> Deprecation
deprecation ExtensionDeprecation
depr, FlagSpec Extension
spec)
  where effect :: TurnOnFlag -> DynP ()
effect = Extension -> TurnOnFlag -> DynP ()
extensionEffect Extension
ext
        spec :: FlagSpec Extension
spec = [Char]
-> Extension
-> (TurnOnFlag -> DynP ())
-> GhcFlagMode
-> FlagSpec Extension
forall flag.
[Char]
-> flag -> (TurnOnFlag -> DynP ()) -> GhcFlagMode -> FlagSpec flag
FlagSpec [Char]
name Extension
ext (\TurnOnFlag
f -> TurnOnFlag -> DynP ()
effect TurnOnFlag
f DynP () -> DynP () -> DynP ()
forall a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> TurnOnFlag -> DynP ()
act TurnOnFlag
f) GhcFlagMode
AllModes
        act :: TurnOnFlag -> DynP ()
act = case ExtensionDeprecation
depr of
                ExtensionDeprecation
ExtensionNotDeprecated -> TurnOnFlag -> DynP ()
nop
                ExtensionDeprecatedFor [Extension]
xs
                  -> [Char] -> DynP ()
deprecate ([Char] -> DynP ())
-> (TurnOnFlag -> [Char]) -> TurnOnFlag -> DynP ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Char]] -> TurnOnFlag -> [Char]
deprecatedForExtensions ((Extension -> [Char]) -> [Extension] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Extension -> [Char]
extensionName [Extension]
xs)
                ExtensionFlagDeprecatedCond TurnOnFlag
cond [Char]
str
                  -> \TurnOnFlag
f -> TurnOnFlag -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => TurnOnFlag -> f () -> f ()
when (TurnOnFlag
f TurnOnFlag -> TurnOnFlag -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== TurnOnFlag
cond) ([Char] -> DynP ()
deprecate [Char]
str)
                ExtensionFlagDeprecated [Char]
str
                  -> DynP () -> TurnOnFlag -> DynP ()
forall a b. a -> b -> a
const ([Char] -> DynP ()
deprecate [Char]
str)

extensionEffect :: LangExt.Extension -> (TurnOnFlag -> DynP ())
extensionEffect :: Extension -> TurnOnFlag -> DynP ()
extensionEffect = \case
  Extension
LangExt.TemplateHaskell
    -> TurnOnFlag -> DynP ()
checkTemplateHaskellOk
  Extension
LangExt.OverlappingInstances
    -> TurnOnFlag -> DynP ()
setOverlappingInsts
  Extension
LangExt.GeneralizedNewtypeDeriving
    -> TurnOnFlag -> DynP ()
setGenDeriving
  Extension
LangExt.IncoherentInstances
    -> TurnOnFlag -> DynP ()
setIncoherentInsts
  Extension
LangExt.DerivingVia
    -> TurnOnFlag -> DynP ()
setDeriveVia
  Extension
_ -> TurnOnFlag -> DynP ()
nop

-- | Things you get with `-dlint`.
enableDLint :: DynP ()
enableDLint :: DynP ()
enableDLint = do
    (GeneralFlag -> DynP ()) -> [GeneralFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ GeneralFlag -> DynP ()
setGeneralFlag [GeneralFlag]
dLintFlags
    Way -> DynP ()
addWayDynP Way
WayDebug
  where
    dLintFlags :: [GeneralFlag]
    dLintFlags :: [GeneralFlag]
dLintFlags =
        [ GeneralFlag
Opt_DoCoreLinting
        , GeneralFlag
Opt_DoStgLinting
        , GeneralFlag
Opt_DoCmmLinting
        , GeneralFlag
Opt_DoAsmLinting
        , GeneralFlag
Opt_CatchNonexhaustiveCases
        , GeneralFlag
Opt_LlvmFillUndefWithGarbage
        ]

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


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

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

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

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

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

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

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

checkTemplateHaskellOk :: TurnOnFlag -> DynP ()
checkTemplateHaskellOk :: TurnOnFlag -> DynP ()
checkTemplateHaskellOk TurnOnFlag
_turn_on
  = EwM (CmdLineP DynFlags) SrcSpan
forall (m :: * -> *). Monad m => EwM m SrcSpan
getCurLoc EwM (CmdLineP DynFlags) SrcSpan -> (SrcSpan -> DynP ()) -> DynP ()
forall a b.
EwM (CmdLineP DynFlags) a
-> (a -> EwM (CmdLineP DynFlags) b) -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \SrcSpan
l -> (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
d -> DynFlags
d { thOnLoc = 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 dflags <- CmdLineP DynFlags DynFlags
forall s. CmdLineP s s
getCmdLineState
                    putCmdLineState $! f dflags)

updM :: (DynFlags -> DynP DynFlags) -> DynP ()
updM :: (DynFlags -> DynP DynFlags) -> DynP ()
updM DynFlags -> DynP DynFlags
f = do 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
            dflags' <- f dflags
            liftEwM $ putCmdLineState $! 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))

word64Suffix :: (Word64 -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
word64Suffix :: (Word64 -> DynFlags -> DynFlags) -> OptKind (CmdLineP DynFlags)
word64Suffix Word64 -> DynFlags -> DynFlags
fn = (Word64 -> DynP ()) -> OptKind (CmdLineP DynFlags)
forall (m :: * -> *). (Word64 -> EwM m ()) -> OptKind m
Word64Suffix (\Word64
n -> (DynFlags -> DynFlags) -> DynP ()
upd (Word64 -> DynFlags -> DynFlags
fn Word64
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_ = addWay w (targetWays_ dflags0) }
       dflags2 :: DynFlags
dflags2 = (GeneralFlag -> DynFlags -> DynFlags)
-> DynFlags -> [GeneralFlag] -> DynFlags
forall a b. (a -> b -> b) -> b -> [a] -> b
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 a b. (a -> b -> b) -> b -> [a] -> b
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

removeWayDynP :: Way -> DynP ()
removeWayDynP :: Way -> DynP ()
removeWayDynP Way
w = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags
dfs { targetWays_ = removeWay w (targetWays_ 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 a b. (a -> b -> b) -> b -> [a] -> b
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 TurnOnFlag
turn_on then GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag'   GeneralFlag
d
                        else GeneralFlag -> DynFlags -> DynFlags
unSetGeneralFlag' GeneralFlag
d
           | (GeneralFlag
f', TurnOnFlag
turn_on, GeneralFlag
d) <- [(GeneralFlag, TurnOnFlag, GeneralFlag)]
impliedGFlags, GeneralFlag
f' GeneralFlag -> GeneralFlag -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== 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 a b. (a -> b -> b) -> b -> [a] -> b
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 TurnOnFlag
turn_on then GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag' GeneralFlag
d
                        else GeneralFlag -> DynFlags -> DynFlags
unSetGeneralFlag' GeneralFlag
d
           | (GeneralFlag
f', TurnOnFlag
turn_on, GeneralFlag
d) <- [(GeneralFlag, TurnOnFlag, GeneralFlag)]
impliedOffGFlags, GeneralFlag
f' GeneralFlag -> GeneralFlag -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== 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.

--------------------------
setWarningGroup :: WarningGroup -> DynP ()
setWarningGroup :: WarningGroup -> DynP ()
setWarningGroup WarningGroup
g = do
    (WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
setWarningFlag (WarningGroup -> [WarningFlag]
warningGroupFlags WarningGroup
g)
    TurnOnFlag -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => TurnOnFlag -> f () -> f ()
when (WarningGroup -> TurnOnFlag
warningGroupIncludesExtendedWarnings WarningGroup
g) (DynP () -> DynP ()) -> DynP () -> DynP ()
forall a b. (a -> b) -> a -> b
$ (DynFlags -> DynFlags) -> DynP ()
upd DynFlags -> DynFlags
wopt_set_all_custom

unSetWarningGroup :: WarningGroup -> DynP ()
unSetWarningGroup :: WarningGroup -> DynP ()
unSetWarningGroup WarningGroup
g = do
    (WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
unSetWarningFlag (WarningGroup -> [WarningFlag]
warningGroupFlags WarningGroup
g)
    TurnOnFlag -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => TurnOnFlag -> f () -> f ()
when (WarningGroup -> TurnOnFlag
warningGroupIncludesExtendedWarnings WarningGroup
g) (DynP () -> DynP ()) -> DynP () -> DynP ()
forall a b. (a -> b) -> a -> b
$ (DynFlags -> DynFlags) -> DynP ()
upd DynFlags -> DynFlags
wopt_unset_all_custom

setWErrorWarningGroup :: WarningGroup -> DynP ()
setWErrorWarningGroup :: WarningGroup -> DynP ()
setWErrorWarningGroup WarningGroup
g =
  do { WarningGroup -> DynP ()
setWarningGroup WarningGroup
g
     ; WarningGroup -> DynP ()
setFatalWarningGroup WarningGroup
g }

setFatalWarningGroup :: WarningGroup -> DynP ()
setFatalWarningGroup :: WarningGroup -> DynP ()
setFatalWarningGroup WarningGroup
g = do
    (WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
setFatalWarningFlag (WarningGroup -> [WarningFlag]
warningGroupFlags WarningGroup
g)
    TurnOnFlag -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => TurnOnFlag -> f () -> f ()
when (WarningGroup -> TurnOnFlag
warningGroupIncludesExtendedWarnings WarningGroup
g) (DynP () -> DynP ()) -> DynP () -> DynP ()
forall a b. (a -> b) -> a -> b
$ (DynFlags -> DynFlags) -> DynP ()
upd DynFlags -> DynFlags
wopt_set_all_fatal_custom

unSetFatalWarningGroup :: WarningGroup -> DynP ()
unSetFatalWarningGroup :: WarningGroup -> DynP ()
unSetFatalWarningGroup WarningGroup
g = do
    (WarningFlag -> DynP ()) -> [WarningFlag] -> DynP ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ WarningFlag -> DynP ()
unSetFatalWarningFlag (WarningGroup -> [WarningFlag]
warningGroupFlags WarningGroup
g)
    TurnOnFlag -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => TurnOnFlag -> f () -> f ()
when (WarningGroup -> TurnOnFlag
warningGroupIncludesExtendedWarnings WarningGroup
g) (DynP () -> DynP ()) -> DynP () -> DynP ()
forall a b. (a -> b) -> a -> b
$ (DynFlags -> DynFlags) -> DynP ()
upd DynFlags -> DynFlags
wopt_unset_all_fatal_custom


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 }


setCustomWarningFlag, unSetCustomWarningFlag :: WarningCategory -> DynP ()
setCustomWarningFlag :: WarningCategory -> DynP ()
setCustomWarningFlag   WarningCategory
f = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> WarningCategory -> DynFlags
wopt_set_custom DynFlags
dfs WarningCategory
f)
unSetCustomWarningFlag :: WarningCategory -> DynP ()
unSetCustomWarningFlag WarningCategory
f = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> WarningCategory -> DynFlags
wopt_unset_custom DynFlags
dfs WarningCategory
f)

setCustomFatalWarningFlag, unSetCustomFatalWarningFlag :: WarningCategory -> DynP ()
setCustomFatalWarningFlag :: WarningCategory -> DynP ()
setCustomFatalWarningFlag   WarningCategory
f = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> WarningCategory -> DynFlags
wopt_set_fatal_custom DynFlags
dfs WarningCategory
f)
unSetCustomFatalWarningFlag :: WarningCategory -> DynP ()
unSetCustomFatalWarningFlag WarningCategory
f = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags -> WarningCategory -> DynFlags
wopt_unset_fatal_custom DynFlags
dfs WarningCategory
f)

setCustomWErrorFlag :: WarningCategory -> DynP ()
setCustomWErrorFlag :: WarningCategory -> DynP ()
setCustomWErrorFlag WarningCategory
flag =
  do { WarningCategory -> DynP ()
setCustomWarningFlag WarningCategory
flag
     ; WarningCategory -> DynP ()
setCustomFatalWarningFlag WarningCategory
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 a b. (a -> b -> b) -> b -> [a] -> b
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 TurnOnFlag
turn_on then Extension -> DynFlags -> DynFlags
setExtensionFlag'   Extension
d
                        else Extension -> DynFlags -> DynFlags
unSetExtensionFlag' Extension
d
           | (Extension
f', TurnOnFlag
turn_on, Extension
d) <- [(Extension, TurnOnFlag, Extension)]
impliedXFlags, Extension
f' Extension -> Extension -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== 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)

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

alterToolSettings :: (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings :: (ToolSettings -> ToolSettings) -> DynFlags -> DynFlags
alterToolSettings ToolSettings -> ToolSettings
f DynFlags
dynFlags = DynFlags
dynFlags { toolSettings = f (toolSettings 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)
       TurnOnFlag -> DynP () -> DynP ()
forall (f :: * -> *). Applicative f => TurnOnFlag -> f () -> f ()
when TurnOnFlag
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 :: TurnOnFlag
want_recomp = DumpFlag
dump_flag DumpFlag -> [DumpFlag] -> TurnOnFlag
forall (t :: * -> *) a.
(Foldable t, Eq a) =>
a -> t a -> TurnOnFlag
`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 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
                    when (force_recomp dfs) (setGeneralFlag Opt_ForceRecomp)
        where
          force_recomp :: DynFlags -> TurnOnFlag
force_recomp DynFlags
dfs = GhcMode -> TurnOnFlag
isOneShot (DynFlags -> GhcMode
ghcMode DynFlags
dfs)


setVerbosity :: Maybe Int -> DynP ()
setVerbosity :: Maybe Int -> DynP ()
setVerbosity Maybe Int
mb_n = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
dfs -> DynFlags
dfs{ verbosity = mb_n `orElse` 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 = 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 -> TurnOnFlag
forall a. Ord a => a -> a -> TurnOnFlag
> Int
2     = GeneralFlag -> DynFlags -> DynFlags
setGeneralFlag' GeneralFlag
Opt_ExposeInternalSymbols
      | TurnOnFlag
otherwise = DynFlags -> DynFlags
forall a. a -> a
id

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 = PackageDB p : packageDBFlags 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 = NoUserPackageDB : packageDBFlags 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 = NoGlobalPackageDB : packageDBFlags 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 = ClearPackageDBs : packageDBFlags 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]) -> TurnOnFlag)
-> [(PackageFlag, [Char])] -> [(PackageFlag, [Char])]
forall a. (a -> TurnOnFlag) -> [a] -> [a]
filter (([Char] -> [Char] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
==[Char]
"")([Char] -> TurnOnFlag)
-> ((PackageFlag, [Char]) -> [Char])
-> (PackageFlag, [Char])
-> TurnOnFlag
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] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
str)
  where doc :: [Char]
doc = [Char]
flag [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
" " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
str
        parse :: ReadP PackageFlag
parse = do
            pkg_arg <- ReadP PackageArg -> ReadP PackageArg
forall {b}. ReadP b -> ReadP b
tok ReadP PackageArg
arg_parse
            let mk_expose = [Char] -> PackageArg -> ModRenaming -> PackageFlag
ExposePackage [Char]
doc PackageArg
pkg_arg
            ( do _ <- tok $ string "with"
                 fmap (mk_expose . ModRenaming True) parseRns
             <++ fmap (mk_expose . ModRenaming False) parseRns
             <++ return (mk_expose (ModRenaming True [])))
        parseRns :: ReadP [(ModuleName, ModuleName)]
parseRns = do _ <- 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
'('
                      rns <- tok $ sepBy parseItem (tok $ R.char ',')
                      _ <- tok $ R.char ')'
                      return rns
        parseItem :: ReadP (ModuleName, ModuleName)
parseItem = do
            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 _ <- tok $ string "as"
                new <- tok $ parseModuleName
                return (orig, new)
              +++
             return (orig, orig))
        tok :: ReadP b -> ReadP b
tok ReadP b
m = ReadP b
m ReadP b -> (b -> ReadP b) -> ReadP b
forall a b. ReadP a -> (a -> 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 a b. ReadP a -> ReadP b -> ReadP b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> b -> ReadP b
forall a. a -> ReadP a
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 =
    parsePackageFlag "-package-id" parseUnitArg p : packageFlags s })
exposePluginPackage :: [Char] -> DynP ()
exposePluginPackage [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ pluginPackageFlags =
    parsePackageFlag "-plugin-package" parsePackageArg p : pluginPackageFlags s })
exposePluginPackageId :: [Char] -> DynP ()
exposePluginPackageId [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ pluginPackageFlags =
    parsePackageFlag "-plugin-package-id" parseUnitArg p : pluginPackageFlags s })
hidePackage :: [Char] -> DynP ()
hidePackage [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ packageFlags = HidePackage p : packageFlags s })
ignorePackage :: [Char] -> DynP ()
ignorePackage [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ ignorePackageFlags = IgnorePackage p : ignorePackageFlags s })

trustPackage :: [Char] -> DynP ()
trustPackage [Char]
p = [Char] -> DynP ()
exposePackage [Char]
p DynP () -> DynP () -> DynP ()
forall a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
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 = TrustPackage p : trustFlags s })
distrustPackage :: [Char] -> DynP ()
distrustPackage [Char]
p = [Char] -> DynP ()
exposePackage [Char]
p DynP () -> DynP () -> DynP ()
forall a b.
EwM (CmdLineP DynFlags) a
-> EwM (CmdLineP DynFlags) b -> EwM (CmdLineP DynFlags) b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>>
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ trustFlags = DistrustPackage p : trustFlags s })

exposePackage' :: String -> DynFlags -> DynFlags
exposePackage' :: [Char] -> DynFlags -> DynFlags
exposePackage' [Char]
p DynFlags
dflags
    = DynFlags
dflags { packageFlags =
            parsePackageFlag "-package" parsePackageArg p : packageFlags dflags }

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

parseUnitArg :: ReadP PackageArg
parseUnitArg :: ReadP PackageArg
parseUnitArg =
    (Unit -> PackageArg) -> ReadP Unit -> ReadP PackageArg
forall a b. (a -> b) -> ReadP a -> ReadP b
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_ = stringToUnitId p }

setWorkingDirectory :: String -> DynFlags -> DynFlags
setWorkingDirectory :: [Char] -> DynFlags -> DynFlags
setWorkingDirectory [Char]
p DynFlags
d = DynFlags
d { workingDirectory =  Just p }

{-
Note [Filepaths and Multiple Home Units]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It is common to assume that a package is compiled in the directory where its
cabal file resides. Thus, all paths used in the compiler are assumed to be relative
to this directory. When there are multiple home units the compiler is often
not operating in the standard directory and instead where the cabal.project
file is located. In this case the `-working-dir` option can be passed which specifies
the path from the current directory to the directory the unit assumes to be it's root,
normally the directory which contains the cabal file.

When the flag is passed, any relative paths used by the compiler are offset
by the working directory. Notably this includes `-i`, `-I⟨dir⟩`, `-hidir`, `-odir` etc and
the location of input files.

-}

augmentByWorkingDirectory :: DynFlags -> FilePath -> FilePath
augmentByWorkingDirectory :: DynFlags -> [Char] -> [Char]
augmentByWorkingDirectory DynFlags
dflags [Char]
fp | [Char] -> TurnOnFlag
isRelative [Char]
fp, Just [Char]
offset <- DynFlags -> Maybe [Char]
workingDirectory DynFlags
dflags = [Char]
offset [Char] -> [Char] -> [Char]
</> [Char]
fp
augmentByWorkingDirectory DynFlags
_ [Char]
fp = [Char]
fp

setPackageName :: String -> DynFlags -> DynFlags
setPackageName :: [Char] -> DynFlags -> DynFlags
setPackageName [Char]
p DynFlags
d = DynFlags
d { thisPackageName =  Just p }

addHiddenModule :: String -> DynP ()
addHiddenModule :: [Char] -> DynP ()
addHiddenModule [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ hiddenModules  = Set.insert (mkModuleName p) (hiddenModules s) })

addReexportedModule :: String -> DynP ()
addReexportedModule :: [Char] -> DynP ()
addReexportedModule [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{ reexportedModules  = (parseReexportedModule p) : (reexportedModules s) })

parseReexportedModule :: String                 -- string to parse
                      -> ReexportedModule
parseReexportedModule :: [Char] -> ReexportedModule
parseReexportedModule [Char]
str
 = case ((ReexportedModule, [Char]) -> TurnOnFlag)
-> [(ReexportedModule, [Char])] -> [(ReexportedModule, [Char])]
forall a. (a -> TurnOnFlag) -> [a] -> [a]
filter (([Char] -> [Char] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
==[Char]
"")([Char] -> TurnOnFlag)
-> ((ReexportedModule, [Char]) -> [Char])
-> (ReexportedModule, [Char])
-> TurnOnFlag
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(ReexportedModule, [Char]) -> [Char]
forall a b. (a, b) -> b
snd) (ReadP ReexportedModule -> ReadS ReexportedModule
forall a. ReadP a -> ReadS a
readP_to_S ReadP ReexportedModule
parseItem [Char]
str) of
    [(ReexportedModule
r, [Char]
"")] -> ReexportedModule
r
    [(ReexportedModule, [Char])]
_ -> GhcException -> ReexportedModule
forall a. GhcException -> a
throwGhcException (GhcException -> ReexportedModule)
-> GhcException -> ReexportedModule
forall a b. (a -> b) -> a -> b
$ [Char] -> GhcException
CmdLineError ([Char]
"Can't parse reexported module flag: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
str)
  where
        parseItem :: ReadP ReexportedModule
parseItem = do
            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 _ <- tok $ string "as"
                new <- tok $ parseModuleName
                return (ReexportedModule orig new))
              +++
             return (ReexportedModule orig orig)

        tok :: ReadP b -> ReadP b
tok ReadP b
m = ReadP b
m ReadP b -> (b -> ReadP b) -> ReadP b
forall a b. ReadP a -> (a -> 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 a b. ReadP a -> ReadP b -> ReadP b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> b -> ReadP b
forall a. a -> ReadP a
forall (m :: * -> *) a. Monad m => a -> m a
return b
x


-- 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 -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
/= GhcLink
LinkBinary TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| Backend -> TurnOnFlag
backendWritesFiles Backend
l
  then DynFlags
dfs{ 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 -> TurnOnFlag
backendWritesFiles (DynFlags -> Backend
backend DynFlags
dflags)
       = DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
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 = l }
     | TurnOnFlag
otherwise = DynFlags -> DynP DynFlags
forall a. a -> EwM (CmdLineP DynFlags) a
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 a. a -> EwM (CmdLineP DynFlags) a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> DynFlags -> DynFlags
updOptLevel Int
n 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 = filt : callerCcFilters 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 = (RdrName -> DynP ()) -> [Char] -> DynP ()
parse RdrName -> DynP ()
parse_main_f [Char]
arg
  where
    parse :: (RdrName -> DynP ()) -> [Char] -> DynP ()
parse RdrName -> DynP ()
callback [Char]
str = case P (LocatedN RdrName) -> PState -> ParseResult (LocatedN RdrName)
forall a. P a -> PState -> ParseResult a
unP P (LocatedN RdrName)
parseIdentifier ([Char] -> PState
p_state [Char]
str) of
      PFailed PState
_      -> [Char] -> DynP ()
forall (m :: * -> *). Monad m => [Char] -> EwM m ()
addErr ([Char] -> DynP ()) -> [Char] -> DynP ()
forall a b. (a -> b) -> a -> b
$ [Char]
"Can't parse -main-is \"" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
arg [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"\" as an identifier or module."
      POk PState
_ (L SrcSpanAnnN
_ RdrName
re) -> RdrName -> DynP ()
callback RdrName
re

    -- dummy parser state.
    p_state :: [Char] -> PState
p_state [Char]
str = ParserOpts -> StringBuffer -> RealSrcLoc -> PState
initParserState
              (EnumSet Extension
-> DiagOpts
-> [[Char]]
-> TurnOnFlag
-> TurnOnFlag
-> TurnOnFlag
-> TurnOnFlag
-> ParserOpts
mkParserOpts EnumSet Extension
forall a. Monoid a => a
mempty DiagOpts
emptyDiagOpts [] TurnOnFlag
False TurnOnFlag
False TurnOnFlag
False TurnOnFlag
True)
              ([Char] -> StringBuffer
stringToStringBuffer [Char]
str)
              (FastString -> Int -> Int -> RealSrcLoc
mkRealSrcLoc ([Char] -> FastString
mkFastString []) Int
1 Int
1)

    parse_main_f :: RdrName -> DynP ()
parse_main_f (Unqual OccName
occ)
      | OccName -> TurnOnFlag
isVarOcc OccName
occ = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
d -> DynFlags
d { mainFunIs = main_f occ }
    parse_main_f (Qual (ModuleName FastString
mod) OccName
occ)
      | OccName -> TurnOnFlag
isVarOcc OccName
occ = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
d -> DynFlags
d { mainModuleNameIs = mkModuleNameFS mod
                                     , mainFunIs = main_f occ }
    -- append dummy "function" to parse A.B as the module A.B
    -- and not the Data constructor B from the module A
    parse_main_f RdrName
_ = (RdrName -> DynP ()) -> [Char] -> DynP ()
parse RdrName -> DynP ()
parse_mod ([Char]
arg [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
".main")

    main_f :: OccName -> Maybe [Char]
main_f = [Char] -> Maybe [Char]
forall a. a -> Maybe a
Just ([Char] -> Maybe [Char])
-> (OccName -> [Char]) -> OccName -> Maybe [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OccName -> [Char]
occNameString

    parse_mod :: RdrName -> DynP ()
parse_mod (Qual (ModuleName FastString
mod) OccName
_) = (DynFlags -> DynFlags) -> DynP ()
upd ((DynFlags -> DynFlags) -> DynP ())
-> (DynFlags -> DynFlags) -> DynP ()
forall a b. (a -> b) -> a -> b
$ \DynFlags
d -> DynFlags
d { mainModuleNameIs = mkModuleNameFS mod }
    -- we appended ".m" and any parse error was caught. We are Qual or something went very wrong
    parse_mod RdrName
_ = [Char] -> DynP ()
forall a. HasCallStack => [Char] -> a
error [Char]
"unreachable"

addLdInputs :: Option -> DynFlags -> DynFlags
addLdInputs :: Option -> DynFlags -> DynFlags
addLdInputs Option
p DynFlags
dflags = DynFlags
dflags{ldInputs = ldInputs dflags ++ [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] -> [Char] -> [Char]
</> [Char]
db))
        -- relative package dbs are interpreted relative to the env file
        where envdir :: [Char]
envdir = [Char] -> [Char]
takeDirectory [Char]
envfile
              db :: [Char]
db     = Int -> [Char] -> [Char]
forall a. Int -> [a] -> [a]
drop Int
11 [Char]
str
      [[Char]
"clear-package-db"]  -> DynP ()
clearPkgDb
      [[Char]
"hide-package", [Char]
pkg]  -> [Char] -> DynP ()
hidePackage [Char]
pkg
      [[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 a. a -> EwM (CmdLineP DynFlags) a
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 a. a -> EwM (CmdLineP DynFlags) a
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] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
envfile [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
": " [Char] -> [Char] -> [Char]
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 = []})
addImportPath [Char]
p  = (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{importPaths = importPaths s ++ splitPathList p})

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

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

addFrameworkPath :: [Char] -> DynP ()
addFrameworkPath [Char]
p =
  (DynFlags -> DynFlags) -> DynP ()
upd (\DynFlags
s -> DynFlags
s{frameworkPaths = frameworkPaths s ++ splitPathList 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] -> TurnOnFlag) -> [[Char]] -> [[Char]]
forall a. (a -> TurnOnFlag) -> [a] -> [a]
filter [Char] -> TurnOnFlag
forall (f :: * -> *) a. Foldable f => f a -> TurnOnFlag
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 DynFlags
d = DynFlags
d { tmpDir = TempDir (normalise 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 = Just 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 = 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 = 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 =
      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 -> TurnOnFlag
gopt GeneralFlag
Opt_PIC DynFlags
dflags -> [[Char]
"-fno-common", [Char]
"-U__PIC__", [Char]
"-D__PIC__"]
       | TurnOnFlag
otherwise           -> [[Char]
"-mdynamic-no-pic"]
      OS
OSMinGW32 -- no -fPIC for Windows
       | GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_PIC DynFlags
dflags -> [[Char]
"-U__PIC__", [Char]
"-D__PIC__"]
       | TurnOnFlag
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 -> TurnOnFlag
gopt GeneralFlag
Opt_PIC DynFlags
dflags TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| DynFlags -> Set Way
ways DynFlags
dflags Set Way -> Way -> TurnOnFlag
`hasWay` Way
WayDyn ->
          [[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
       | TurnOnFlag
otherwise -> [[Char]
"-fno-PIC"]

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


{-
Note [No PIE when 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 -> TurnOnFlag
gopt GeneralFlag
Opt_PIC DynFlags
dflags = [[Char]
"-U__PIC__", [Char]
"-D__PIC__"]
 | TurnOnFlag
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 (([Char] -> [Char]) -> ([Char], [Char]) -> ([Char], [Char])
forall a b. (a -> b) -> ([Char], a) -> ([Char], b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (([Char] -> [Char]) -> ([Char], [Char]) -> ([Char], [Char]))
-> ([Char] -> [Char]) -> ([Char], [Char]) -> ([Char], [Char])
forall a b. (a -> b) -> a -> b
$ [Char] -> Maybe [Char] -> [Char] -> [Char]
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]
"Project Version Int",         [Char]
cProjectVersionInt),
       ([Char]
"Project Patch Level",         [Char]
cProjectPatchLevel),
       ([Char]
"Project Patch Level1",        [Char]
cProjectPatchLevel1),
       ([Char]
"Project Patch Level2",        [Char]
cProjectPatchLevel2),
       ([Char]
"Project Unit Id",             [Char]
cProjectUnitId),
       ([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",            TurnOnFlag -> [Char]
showBool (TurnOnFlag -> [Char]) -> TurnOnFlag -> [Char]
forall a b. (a -> b) -> a -> b
$ PlatformMisc -> TurnOnFlag
platformMisc_ghcWithInterpreter (PlatformMisc -> TurnOnFlag) -> PlatformMisc -> TurnOnFlag
forall a b. (a -> b) -> a -> b
$ DynFlags -> PlatformMisc
platformMisc DynFlags
dflags),
       ([Char]
"Object splitting supported",  TurnOnFlag -> [Char]
showBool TurnOnFlag
False),
       ([Char]
"Have native code generator",  TurnOnFlag -> [Char]
showBool (TurnOnFlag -> [Char]) -> TurnOnFlag -> [Char]
forall a b. (a -> b) -> a -> b
$ Platform -> TurnOnFlag
platformNcgSupported Platform
platform),
       ([Char]
"target has RTS linker",       TurnOnFlag -> [Char]
showBool (TurnOnFlag -> [Char]) -> TurnOnFlag -> [Char]
forall a b. (a -> b) -> a -> b
$ Platform -> TurnOnFlag
platformHasRTSLinker Platform
platform),
       ([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 Platform
platform),
       -- Whether or not we support @-dynamic-too@
       ([Char]
"Support dynamic-too",         TurnOnFlag -> [Char]
showBool (TurnOnFlag -> [Char]) -> TurnOnFlag -> [Char]
forall a b. (a -> b) -> a -> b
$ TurnOnFlag -> TurnOnFlag
not TurnOnFlag
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",                 TurnOnFlag -> [Char]
showBool TurnOnFlag
hostIsDynamic),
       -- Whether or not GHC was compiled using -prof
       ([Char]
"GHC Profiled",                TurnOnFlag -> [Char]
showBool TurnOnFlag
hostIsProfiled),
       ([Char]
"Debug on",                    TurnOnFlag -> [Char]
showBool TurnOnFlag
debugIsOn),
       ([Char]
"LibDir",                      DynFlags -> [Char]
topDir DynFlags
dflags),
       -- This is always an absolute path, unlike "Relative Global Package DB" which is
       -- in the settings file.
       ([Char]
"Global Package DB",           DynFlags -> [Char]
globalPackageDatabasePath DynFlags
dflags)
      ]
  where
    showBool :: TurnOnFlag -> [Char]
showBool TurnOnFlag
True  = [Char]
"YES"
    showBool TurnOnFlag
False = [Char]
"NO"
    platform :: Platform
platform  = DynFlags -> Platform
targetPlatform DynFlags
dflags
    isWindows :: TurnOnFlag
isWindows = Platform -> OS
platformOS Platform
platform OS -> OS -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== OS
OSMinGW32
    useInplaceMinGW :: TurnOnFlag
useInplaceMinGW = ToolSettings -> TurnOnFlag
toolSettings_useInplaceMinGW (ToolSettings -> TurnOnFlag) -> ToolSettings -> TurnOnFlag
forall a b. (a -> b) -> a -> b
$ DynFlags -> ToolSettings
toolSettings DynFlags
dflags
    expandDirectories :: FilePath -> Maybe FilePath -> String -> String
    expandDirectories :: [Char] -> Maybe [Char] -> [Char] -> [Char]
expandDirectories [Char]
topd Maybe [Char]
mtoold = TurnOnFlag -> Maybe [Char] -> [Char] -> [Char]
expandToolDir TurnOnFlag
useInplaceMinGW Maybe [Char]
mtoold ([Char] -> [Char]) -> ([Char] -> [Char]) -> [Char] -> [Char]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Char] -> [Char] -> [Char]
expandTopDir [Char]
topd

{- -----------------------------------------------------------------------------
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, [Warn])
-- 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, [Warn])
makeDynFlagsConsistent DynFlags
dflags
 -- Disable -dynamic-too on Windows (#8228, #7134, #5987)
 | OS
os OS -> OS -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== OS
OSMinGW32 TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&& GeneralFlag -> DynFlags -> TurnOnFlag
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, [Warn])
loop DynFlags
dflags' [Char]
warn
 -- Disable -dynamic-too if we are are compiling with -dynamic already, otherwise
 -- you get two dynamic object files (.o and .dyn_o). (#20436)
 | DynFlags -> Set Way
ways DynFlags
dflags Set Way -> Way -> TurnOnFlag
`hasWay` Way
WayDyn TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&& GeneralFlag -> DynFlags -> TurnOnFlag
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 ignored when using -dynamic"
      in DynFlags -> [Char] -> (DynFlags, [Warn])
loop DynFlags
dflags' [Char]
warn

 | GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_SplitSections DynFlags
dflags
 , Platform -> TurnOnFlag
platformHasSubsectionsViaSymbols (DynFlags -> Platform
targetPlatform DynFlags
dflags)
    = let dflags' :: DynFlags
dflags' = DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dflags GeneralFlag
Opt_SplitSections
          warn :: [Char]
warn = [Char]
"-fsplit-sections is not useful on this platform " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++
                 [Char]
"since it uses subsections-via-symbols. Ignoring."
      in DynFlags -> [Char] -> (DynFlags, [Warn])
loop DynFlags
dflags' [Char]
warn

   -- Via-C backend only supports unregisterised ABI. Switch to a backend
   -- supporting it if possible.
 | Backend -> TurnOnFlag
backendUnregisterisedAbiOnly (DynFlags -> Backend
backend DynFlags
dflags) TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&&
   TurnOnFlag -> TurnOnFlag
not (Platform -> TurnOnFlag
platformUnregisterised (DynFlags -> Platform
targetPlatform DynFlags
dflags))
    = let b :: Backend
b = Platform -> Backend
platformDefaultBackend (DynFlags -> Platform
targetPlatform DynFlags
dflags)
      in if Backend -> TurnOnFlag
backendSwappableWithViaC Backend
b then
           let dflags' :: DynFlags
dflags' = DynFlags
dflags { backend = b }
               warn :: [Char]
warn = [Char]
"Target platform doesn't use unregisterised ABI, so using " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++
                      Backend -> [Char]
backendDescription Backend
b [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
" rather than " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++
                      Backend -> [Char]
backendDescription (DynFlags -> Backend
backend DynFlags
dflags)
           in DynFlags -> [Char] -> (DynFlags, [Warn])
loop DynFlags
dflags' [Char]
warn
         else
           [Char] -> (DynFlags, [Warn])
forall a. HasCallStack => [Char] -> a
pgmError (Backend -> [Char]
backendDescription (DynFlags -> Backend
backend DynFlags
dflags) [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++
                     [Char]
" supports only unregisterised ABI but target platform doesn't use it.")

 | GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_Hpc DynFlags
dflags TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&& TurnOnFlag -> TurnOnFlag
not (Backend -> TurnOnFlag
backendSupportsHpc (DynFlags -> Backend
backend DynFlags
dflags))
    = let dflags' :: DynFlags
dflags' = DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dflags GeneralFlag
Opt_Hpc
          warn :: [Char]
warn = [Char]
"Hpc can't be used with " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ Backend -> [Char]
backendDescription (DynFlags -> Backend
backend DynFlags
dflags) [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++
                 [Char]
". Ignoring -fhpc."
      in DynFlags -> [Char] -> (DynFlags, [Warn])
loop DynFlags
dflags' [Char]
warn

 | Backend -> TurnOnFlag
backendSwappableWithViaC (DynFlags -> Backend
backend DynFlags
dflags) TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&&
   Platform -> TurnOnFlag
platformUnregisterised (DynFlags -> Platform
targetPlatform DynFlags
dflags)
    = DynFlags -> [Char] -> (DynFlags, [Warn])
loop (DynFlags
dflags { backend = viaCBackend })
           [Char]
"Target platform uses unregisterised ABI, so compiling via C"

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

 | TurnOnFlag -> TurnOnFlag
not (OS -> TurnOnFlag
osElfTarget OS
os) TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&& GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_PIE DynFlags
dflags
    = DynFlags -> [Char] -> (DynFlags, [Warn])
loop (DynFlags -> GeneralFlag -> DynFlags
gopt_unset DynFlags
dflags GeneralFlag
Opt_PIE)
           [Char]
"Position-independent only supported on ELF platforms"
 | OS
os OS -> OS -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== OS
OSDarwin TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&&
   Arch
arch Arch -> Arch -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== Arch
ArchX86_64 TurnOnFlag -> TurnOnFlag -> TurnOnFlag
&&
   TurnOnFlag -> TurnOnFlag
not (GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_PIC DynFlags
dflags)
    = DynFlags -> [Char] -> (DynFlags, [Warn])
loop (DynFlags -> GeneralFlag -> DynFlags
gopt_set DynFlags
dflags GeneralFlag
Opt_PIC)
           [Char]
"Enabling -fPIC as it is always on for this platform"

 | Backend -> TurnOnFlag
backendForcesOptimization0 (DynFlags -> Backend
backend DynFlags
dflags)
 , GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_UnoptimizedCoreForInterpreter DynFlags
dflags
 , let (DynFlags
dflags', TurnOnFlag
changed) = Int -> DynFlags -> (DynFlags, TurnOnFlag)
updOptLevelChanged Int
0 DynFlags
dflags
 , TurnOnFlag
changed
    = DynFlags -> [Char] -> (DynFlags, [Warn])
loop DynFlags
dflags' ([Char] -> (DynFlags, [Warn])) -> [Char] -> (DynFlags, [Warn])
forall a b. (a -> b) -> a -> b
$
      [Char]
"Ignoring optimization flags since they are experimental for the " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++
      Backend -> [Char]
backendDescription (DynFlags -> Backend
backend DynFlags
dflags) [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++
      [Char]
". Pass -fno-unoptimized-core-for-interpreter to enable this feature."

 | GhcLink
LinkInMemory <- DynFlags -> GhcLink
ghcLink DynFlags
dflags
 , TurnOnFlag -> TurnOnFlag
not (GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_ExternalInterpreter DynFlags
dflags)
 , TurnOnFlag
hostIsProfiled
 , Backend -> TurnOnFlag
backendWritesFiles (DynFlags -> Backend
backend DynFlags
dflags)
 , DynFlags -> Set Way
ways DynFlags
dflags Set Way -> Way -> TurnOnFlag
`hasNotWay` Way
WayProf
    = DynFlags -> [Char] -> (DynFlags, [Warn])
loop DynFlags
dflags{targetWays_ = addWay WayProf (targetWays_ dflags)}
         [Char]
"Enabling -prof, because -fobject-code is enabled and GHCi is profiled"

 | GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_ByteCode DynFlags
dflags TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_ByteCodeAndObjectCode DynFlags
dflags
 , TurnOnFlag -> TurnOnFlag
not (GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_ExternalInterpreter DynFlags
dflags)
 , TurnOnFlag
hostIsProfiled
 , DynFlags -> Set Way
ways DynFlags
dflags Set Way -> Way -> TurnOnFlag
`hasNotWay` Way
WayProf
    = DynFlags -> [Char] -> (DynFlags, [Warn])
loop (DynFlags -> GeneralFlag -> DynFlags
gopt_set DynFlags
dflags GeneralFlag
Opt_ExternalInterpreter)
         [Char]
"Enabling external interpreter, because GHC is profiled and bytecode is being used for TH"

 | GhcLink
LinkMergedObj <- DynFlags -> GhcLink
ghcLink DynFlags
dflags
 , Maybe [Char]
Nothing <- DynFlags -> Maybe [Char]
outputFile DynFlags
dflags
 = [Char] -> (DynFlags, [Warn])
forall a. HasCallStack => [Char] -> a
pgmError [Char]
"--output must be specified when using --merge-objs"

 | TurnOnFlag
otherwise = (DynFlags
dflags, [Warn]
forall a. Monoid a => a
mempty)
    where loc :: SrcSpan
loc = FastString -> SrcSpan
mkGeneralSrcSpan ([Char] -> FastString
fsLit [Char]
"when making flags consistent")
          loop :: DynFlags -> [Char] -> (DynFlags, [Warn])
loop DynFlags
updated_dflags [Char]
warning
              = case DynFlags -> (DynFlags, [Warn])
makeDynFlagsConsistent DynFlags
updated_dflags of
                (DynFlags
dflags', [Warn]
ws) -> (DynFlags
dflags', SrcSpan -> DriverMessage -> Warn
forall l e. l -> e -> GenLocated l e
L SrcSpan
loc ([Char] -> DriverMessage
DriverInconsistentDynFlags [Char]
warning) Warn -> [Warn] -> [Warn]
forall a. a -> [a] -> [a]
: [Warn]
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 TurnOnFlag -> TurnOnFlag -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef TurnOnFlag
v_unsafeHasPprDebug (DynFlags -> TurnOnFlag
hasPprDebug DynFlags
dflags)
   IORef TurnOnFlag -> TurnOnFlag -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef TurnOnFlag
v_unsafeHasNoDebugOutput (DynFlags -> TurnOnFlag
hasNoDebugOutput DynFlags
dflags)
   IORef TurnOnFlag -> TurnOnFlag -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef TurnOnFlag
v_unsafeHasNoStateHack (DynFlags -> TurnOnFlag
hasNoStateHack DynFlags
dflags)


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

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

-- | Indicate whether we need to generate source notes
needSourceNotes :: DynFlags -> Bool
needSourceNotes :: DynFlags -> TurnOnFlag
needSourceNotes DynFlags
dflags = DynFlags -> Int
debugLevel DynFlags
dflags Int -> Int -> TurnOnFlag
forall a. Ord a => a -> a -> TurnOnFlag
> Int
0
                       TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_InfoTableMap DynFlags
dflags

                       -- Source ticks are used to approximate the location of
                       -- overloaded call cost centers
                       TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| GeneralFlag -> DynFlags -> TurnOnFlag
gopt GeneralFlag
Opt_ProfLateoverloadedCallsCCs DynFlags
dflags

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

-- | Should we use `-XLinker -rpath` when linking or not?
-- See Note [-fno-use-rpaths]
useXLinkerRPath :: DynFlags -> OS -> Bool
useXLinkerRPath :: DynFlags -> OS -> TurnOnFlag
useXLinkerRPath DynFlags
_ OS
OSDarwin = TurnOnFlag
False -- See Note [Dynamic linking on macOS]
useXLinkerRPath DynFlags
dflags OS
_ = GeneralFlag -> DynFlags -> TurnOnFlag
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] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== [Char]
""      = Rational -> Integer
forall b. Integral b => Rational -> b
forall a b. (RealFrac a, Integral b) => a -> b
truncate Rational
n
  | [Char]
c [Char] -> [Char] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== [Char]
"K" TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| [Char]
c [Char] -> [Char] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== [Char]
"k" = Rational -> Integer
forall b. Integral b => Rational -> b
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] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== [Char]
"M" TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| [Char]
c [Char] -> [Char] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== [Char]
"m" = Rational -> Integer
forall b. Integral b => Rational -> b
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] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== [Char]
"G" TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| [Char]
c [Char] -> [Char] -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== [Char]
"g" = Rational -> Integer
forall b. Integral b => Rational -> b
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)
  | TurnOnFlag
otherwise            = GhcException -> Integer
forall a. GhcException -> a
throwGhcException ([Char] -> GhcException
CmdLineError ([Char]
"can't decode size: " [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
str))
  where ([Char]
m, [Char]
c) = (Char -> TurnOnFlag) -> [Char] -> ([Char], [Char])
forall a. (a -> TurnOnFlag) -> [a] -> ([a], [a])
span Char -> TurnOnFlag
pred [Char]
str
        n :: Rational
n      = [Char] -> Rational
readRational [Char]
m
        pred :: Char -> TurnOnFlag
pred Char
c = Char -> TurnOnFlag
isDigit Char
c TurnOnFlag -> TurnOnFlag -> TurnOnFlag
|| Char
c Char -> Char -> TurnOnFlag
forall a. Eq a => a -> a -> TurnOnFlag
== Char
'.'

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

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

objectSuf :: DynFlags -> String
objectSuf :: DynFlags -> [Char]
objectSuf DynFlags
dflags
   | DynFlags -> TurnOnFlag
dynamicNow DynFlags
dflags = DynFlags -> [Char]
dynObjectSuf_ DynFlags
dflags
   | TurnOnFlag
otherwise         = DynFlags -> [Char]
objectSuf_    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 {k} (a :: k). 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 {k} (a :: k). 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 {k} (a :: k). 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 {k} (a :: k). EnumSet a -> EnumSet a -> EnumSet a
EnumSet.difference (DynFlags -> EnumSet Extension
extensionFlags DynFlags
d2) (DynFlags -> EnumSet Extension
extensionFlags DynFlags
d1)
   in [SDoc] -> SDoc
forall doc. IsDoc doc => [doc] -> doc
vcat
      [ [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Added general flags:"
      , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
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
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Removed general flags:"
      , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
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
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Added extension flags:"
      , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
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
forall doc. IsLine doc => [Char] -> doc
text [Char]
"Removed extension flags:"
      , [Char] -> SDoc
forall doc. IsLine doc => [Char] -> doc
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 = mconstants }
  let dflags1 :: DynFlags
dflags1   = DynFlags
dflags { targetPlatform = platform1 }
  DynFlags -> IO DynFlags
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return DynFlags
dflags1