Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
beea3d14
Commit
beea3d14
authored
Jul 22, 2008
by
Ian Lynagh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Warn about unrecognised pragmas; these often mean we've typoed
parent
3e7f0e70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
+21
-3
compiler/main/DynFlags.hs
compiler/main/DynFlags.hs
+4
-0
compiler/parser/Lexer.x
compiler/parser/Lexer.x
+17
-3
No files found.
compiler/main/DynFlags.hs
View file @
beea3d14
...
...
@@ -174,6 +174,7 @@ data DynFlag
|
Opt_WarnDodgyImports
|
Opt_WarnOrphans
|
Opt_WarnTabs
|
Opt_WarnUnrecognisedPragmas
|
Opt_WarnDodgyForeignImports
-- language opts
...
...
@@ -793,6 +794,7 @@ standardWarnings :: [DynFlag]
standardWarnings
=
[
Opt_WarnWarningsDeprecations
,
Opt_WarnDeprecatedFlags
,
Opt_WarnUnrecognisedPragmas
,
Opt_WarnOverlappingPatterns
,
Opt_WarnMissingFields
,
Opt_WarnMissingMethods
,
...
...
@@ -828,6 +830,7 @@ minuswRemovesOpts
Opt_WarnIncompletePatternsRecUpd
,
Opt_WarnSimplePatterns
,
Opt_WarnMonomorphism
,
Opt_WarnUnrecognisedPragmas
,
Opt_WarnTabs
]
...
...
@@ -1465,6 +1468,7 @@ fFlags = [
(
"warn-deprecated-flags"
,
Opt_WarnDeprecatedFlags
,
const
Supported
),
(
"warn-orphans"
,
Opt_WarnOrphans
,
const
Supported
),
(
"warn-tabs"
,
Opt_WarnTabs
,
const
Supported
),
(
"warn-unrecognised-pragmas"
,
Opt_WarnUnrecognisedPragmas
,
const
Supported
),
(
"print-explicit-foralls"
,
Opt_PrintExplicitForalls
,
const
Supported
),
(
"strictness"
,
Opt_Strictness
,
const
Supported
),
(
"static-argument-transformation"
,
Opt_StaticArgumentTransformation
,
const
Supported
),
...
...
compiler/parser/Lexer.x
View file @
beea3d14
...
...
@@ -258,7 +258,10 @@ $tab+ { warn Opt_WarnTabs (text "Tab character") }
"{-#" $whitechar* (CORE|core) { token ITcore_prag }
"{-#" $whitechar* (UNPACK|unpack) { token ITunpack_prag }
"{-#" { nested_comment lexToken }
-- We ignore all these pragmas, but don't generate a warning for them
-- CFILES is a hugs-only thing.
"{-#" $whitechar* (OPTIONS_HUGS|options_hugs|OPTIONS_NHC98|options_nhc98|OPTIONS_JHC|options_jhc|CFILES|cfiles)
{ nested_comment lexToken }
-- ToDo: should only be valid inside a pragma:
"#-}" { token ITclose_prag}
...
...
@@ -275,13 +278,19 @@ $tab+ { warn Opt_WarnTabs (text "Tab character") }
"{-#" $whitechar* (INCLUDE|include) { lex_string_prag ITinclude_prag }
}
<0> {
-- In the "0" mode we ignore these pragmas
"{-#" $whitechar* (OPTIONS|options|OPTIONS_GHC|options_ghc|OPTIONS_HADDOCK|options_haddock|LANGUAGE|language|INCLUDE|include)
{ nested_comment lexToken }
}
<0> {
"-- #" .* ;
}
<0,option_prags> {
-- This is to catch things like {-# OPTIONS OPTIONS_HUGS ...
"{-#" $whitechar* $idchar+ { nested_comment lexToken
}
"{-#" { warnThen Opt_WarnUnrecognisedPragmas (text "Unrecognised pragma")
(nested_comment lexToken)
}
}
-- '0' state: ordinary lexemes
...
...
@@ -1378,6 +1387,11 @@ warn option warning srcspan _buf _len = do
addWarning option srcspan warning
lexToken
warnThen :: DynFlag -> SDoc -> Action -> Action
warnThen option warning action srcspan buf len = do
addWarning option srcspan warning
action srcspan buf len
-- -----------------------------------------------------------------------------
-- The Parse Monad
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment