Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
c3939fdb
Commit
c3939fdb
authored
Oct 09, 2012
by
ian@well-typed.com
Browse files
Make the -ferror-spans flag dynamic
parent
f7cd14fd
Changes
5
Hide whitespace changes
Inline
Side-by-side
compiler/main/DynFlags.hs
View file @
c3939fdb
...
...
@@ -344,6 +344,8 @@ data DynFlag
|
Opt_Hpc
-- output style opts
|
Opt_ErrorSpans
-- Include full span info in error messages,
-- instead of just the start position.
|
Opt_PprCaseAsLet
-- temporary flags
...
...
@@ -2205,6 +2207,7 @@ dFlags = [
-- | These @-f\<blah\>@ flags can all be reversed with @-fno-\<blah\>@
fFlags
::
[
FlagSpec
DynFlag
]
fFlags
=
[
(
"error-spans"
,
Opt_ErrorSpans
,
nop
),
(
"print-explicit-foralls"
,
Opt_PrintExplicitForalls
,
nop
),
(
"strictness"
,
Opt_Strictness
,
nop
),
(
"specialise"
,
Opt_Specialise
,
nop
),
...
...
compiler/main/ErrUtils.lhs
View file @
c3939fdb
...
...
@@ -42,7 +42,6 @@ import Panic
import FastString
import SrcLoc
import DynFlags
import StaticFlags ( opt_ErrorSpans )
import System.Directory
import System.Exit ( ExitCode(..), exitWith )
...
...
@@ -93,8 +92,11 @@ mkLocMessage :: Severity -> SrcSpan -> MsgDoc -> MsgDoc
-- are supposed to be in a standard format, and one without a location
-- would look strange. Better to say explicitly "<no location info>".
mkLocMessage severity locn msg
| opt_ErrorSpans = hang (ppr locn <> colon <+> sev_info) 4 msg
| otherwise = hang (ppr (srcSpanStart locn) <> colon <+> sev_info) 4 msg
= sdocWithDynFlags $ \dflags ->
let locn' = if dopt Opt_ErrorSpans dflags
then ppr locn
else ppr (srcSpanStart locn)
in hang (locn' <> colon <+> sev_info) 4 msg
where
sev_info = case severity of
SevWarning -> ptext (sLit "Warning:")
...
...
compiler/main/StaticFlagParser.hs
View file @
c3939fdb
...
...
@@ -134,8 +134,7 @@ isStaticFlag f =
"fno-flat-cache"
,
"fexcess-precision"
,
"fhardwire-lib-paths"
,
"fcpr-off"
,
"ferror-spans"
"fcpr-off"
]
||
any
(`
isPrefixOf
`
f
)
[
"fliberate-case-threshold"
,
...
...
compiler/main/StaticFlags.hs
View file @
c3939fdb
...
...
@@ -60,9 +60,6 @@ module StaticFlags (
opt_UF_KeenessFactor
,
opt_UF_DearOp
,
-- misc opts
opt_ErrorSpans
,
-- For the parser
addOpt
,
removeOpt
,
v_opt_C_ready
,
...
...
@@ -291,11 +288,6 @@ opt_UF_DictDiscount = lookup_def_int "-funfolding-dict-discount" (30::
opt_UF_KeenessFactor
=
lookup_def_float
"-funfolding-keeness-factor"
(
1.5
::
Float
)
opt_UF_DearOp
=
(
40
::
Int
)
-- Include full span info in error messages, instead of just the start position.
opt_ErrorSpans
::
Bool
opt_ErrorSpans
=
lookUp
(
fsLit
"-ferror-spans"
)
-----------------------------------------------------------------------------
-- Tunneling our global variables into a new instance of the GHC library
...
...
docs/users_guide/flags.xml
View file @
c3939fdb
...
...
@@ -86,7 +86,7 @@
<row>
<entry><option>
-ferror-spans
</option></entry>
<entry>
output full span in error messages
</entry>
<entry>
stat
ic
</entry>
<entry>
dynam
ic
</entry>
<entry>
-
</entry>
</row>
<row>
...
...
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