diff options
| author | Ian Lynagh <ian@well-typed.com> | 2012-10-09 00:07:15 +0100 |
|---|---|---|
| committer | Ian Lynagh <ian@well-typed.com> | 2012-10-09 00:07:15 +0100 |
| commit | c3939fdb9cc66569f781083b08c4a881edfd137d (patch) | |
| tree | 28db5ed3c1b9a4fa465677963435791222668258 | |
| parent | f7cd14fd30d40ae7e904a533804f43d43dd8f439 (diff) | |
| download | haskell-c3939fdb9cc66569f781083b08c4a881edfd137d.tar.gz | |
Make the -ferror-spans flag dynamic
| -rw-r--r-- | compiler/main/DynFlags.hs | 3 | ||||
| -rw-r--r-- | compiler/main/ErrUtils.lhs | 8 | ||||
| -rw-r--r-- | compiler/main/StaticFlagParser.hs | 3 | ||||
| -rw-r--r-- | compiler/main/StaticFlags.hs | 8 | ||||
| -rw-r--r-- | docs/users_guide/flags.xml | 2 |
5 files changed, 10 insertions, 14 deletions
diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs index 9639e2e7c7..b89e2be593 100644 --- a/compiler/main/DynFlags.hs +++ b/compiler/main/DynFlags.hs @@ -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 ), diff --git a/compiler/main/ErrUtils.lhs b/compiler/main/ErrUtils.lhs index 1643128eb7..b164d1c6c7 100644 --- a/compiler/main/ErrUtils.lhs +++ b/compiler/main/ErrUtils.lhs @@ -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:") diff --git a/compiler/main/StaticFlagParser.hs b/compiler/main/StaticFlagParser.hs index aceb67229e..9c98836e63 100644 --- a/compiler/main/StaticFlagParser.hs +++ b/compiler/main/StaticFlagParser.hs @@ -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", diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs index 68954a87e0..598ea00848 100644 --- a/compiler/main/StaticFlags.hs +++ b/compiler/main/StaticFlags.hs @@ -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 diff --git a/docs/users_guide/flags.xml b/docs/users_guide/flags.xml index c2e226cf38..a122e5a0ca 100644 --- a/docs/users_guide/flags.xml +++ b/docs/users_guide/flags.xml @@ -86,7 +86,7 @@ <row> <entry><option>-ferror-spans</option></entry> <entry>output full span in error messages</entry> - <entry>static</entry> + <entry>dynamic</entry> <entry>-</entry> </row> <row> |
