Added a set of enabled warnings to CompState
This commit is contained in:
parent
53240825dd
commit
f88c671cf7
|
@ -23,6 +23,7 @@ module Errors (checkJust, Die(..),
|
||||||
|
|
||||||
import Control.Monad.Error
|
import Control.Monad.Error
|
||||||
import Control.Monad.Trans
|
import Control.Monad.Trans
|
||||||
|
import Data.Generics
|
||||||
import Data.List
|
import Data.List
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.IO.Error
|
import System.IO.Error
|
||||||
|
@ -49,7 +50,7 @@ data WarningType
|
||||||
| WarnUnknownPreprocessorDirective
|
| WarnUnknownPreprocessorDirective
|
||||||
| WarnUninitialisedVariable
|
| WarnUninitialisedVariable
|
||||||
| WarnUnusedVariable
|
| WarnUnusedVariable
|
||||||
deriving (Eq, Show, Ord, Read, Enum, Bounded)
|
deriving (Eq, Show, Ord, Read, Enum, Bounded, Typeable, Data)
|
||||||
-- I intend the above warnings to be part of a command-line mechanism to enable
|
-- I intend the above warnings to be part of a command-line mechanism to enable
|
||||||
-- or suppress them according to various flags. So that you might write:
|
-- or suppress them according to various flags. So that you might write:
|
||||||
-- -WnoWarnParserOddity
|
-- -WnoWarnParserOddity
|
||||||
|
|
|
@ -31,7 +31,7 @@ import Data.Set (Set)
|
||||||
import qualified Data.Set as Set
|
import qualified Data.Set as Set
|
||||||
|
|
||||||
import qualified AST as A
|
import qualified AST as A
|
||||||
import Errors (Die, dieP, ErrorReport, Warn, WarningType, warnP)
|
import Errors (Die, dieP, ErrorReport, Warn, WarningType(..), warnP)
|
||||||
import Metadata
|
import Metadata
|
||||||
import OrdAST ()
|
import OrdAST ()
|
||||||
import UnifyType
|
import UnifyType
|
||||||
|
@ -101,6 +101,7 @@ data CompState = CompState {
|
||||||
csVerboseLevel :: Int,
|
csVerboseLevel :: Int,
|
||||||
csOutputFile :: String,
|
csOutputFile :: String,
|
||||||
csKeepTemporaries :: Bool,
|
csKeepTemporaries :: Bool,
|
||||||
|
csEnabledWarnings :: Set WarningType,
|
||||||
|
|
||||||
-- Set by preprocessor
|
-- Set by preprocessor
|
||||||
csCurrentFile :: String,
|
csCurrentFile :: String,
|
||||||
|
@ -138,6 +139,12 @@ emptyState = CompState {
|
||||||
csVerboseLevel = 0,
|
csVerboseLevel = 0,
|
||||||
csOutputFile = "-",
|
csOutputFile = "-",
|
||||||
csKeepTemporaries = False,
|
csKeepTemporaries = False,
|
||||||
|
csEnabledWarnings = Set.fromList
|
||||||
|
[ WarnInternal
|
||||||
|
, WarnParserOddity
|
||||||
|
, WarnUnknownPreprocessorDirective
|
||||||
|
, WarnUnusedVariable],
|
||||||
|
-- TODO enable WarnUninitialisedVariable by default
|
||||||
|
|
||||||
csCurrentFile = "none",
|
csCurrentFile = "none",
|
||||||
csUsedFiles = Set.empty,
|
csUsedFiles = Set.empty,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user