module GHC.Driver.Config.Diagnostic
  ( initDiagOpts
  )
where

import GHC.Driver.Flags
import GHC.Driver.Session

import GHC.Utils.Outputable
import GHC.Utils.Error (DiagOpts (..))

initDiagOpts :: DynFlags -> DiagOpts
initDiagOpts :: DynFlags -> DiagOpts
initDiagOpts DynFlags
dflags = DiagOpts
  { diag_warning_flags :: EnumSet WarningFlag
diag_warning_flags       = DynFlags -> EnumSet WarningFlag
warningFlags DynFlags
dflags
  , diag_fatal_warning_flags :: EnumSet WarningFlag
diag_fatal_warning_flags = DynFlags -> EnumSet WarningFlag
fatalWarningFlags DynFlags
dflags
  , diag_warn_is_error :: Bool
diag_warn_is_error       = GeneralFlag -> DynFlags -> Bool
gopt GeneralFlag
Opt_WarnIsError DynFlags
dflags
  , diag_reverse_errors :: Bool
diag_reverse_errors      = DynFlags -> Bool
reverseErrors DynFlags
dflags
  , diag_max_errors :: Maybe Int
diag_max_errors          = DynFlags -> Maybe Int
maxErrors DynFlags
dflags
  , diag_ppr_ctx :: SDocContext
diag_ppr_ctx             = DynFlags -> PprStyle -> SDocContext
initSDocContext DynFlags
dflags PprStyle
defaultErrStyle
  }