[GHC] #12056: Too aggressive `-w` option
GHC
ghc-devs at haskell.org
Sat Jun 11 10:54:05 UTC 2016
#12056: Too aggressive `-w` option
-------------------------------------+-------------------------------------
Reporter: asr | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: newcomer
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: #11429, #11789 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by wozgonon):
Error appears to be in parsing of flags before DynFlags.
See comment at end of ghc/compiler/main/CmdLineParser.hs
{{{
errorsToGhcException errs =
UsageError $ intercalate "\n" $ [ l ++ ": " ++ e | (l, e) <- errs ]
{- Note [Handling errors when parsing commandline flags]
Parsing of static and mode flags happens before any session is started,
i.e.,
before the first call to 'GHC.withGhc'. Therefore, to report errors for
invalid usage of these two types of flags, we can not call any function
that
needs DynFlags, as there are no DynFlags available yet
(unsafeGlobalDynFlags
is not set either). So we always print "on the commandline" as the
location,
which is true except for Api users, which is probably ok.
When reporting errors for invalid usage of dynamic flags we /can/ make use
of
DynFlags, and we do so explicitly in DynFlags.parseDynamicFlagsFull.
Before, we called unsafeGlobalDynFlags when an invalid (combination of)
flag(s) was given on the commandline, resulting in panics (#9963).
-}
}}}
The actual error displayed seems to originate from
ghc/compiler/main/StaticFlags.hs which calls the above
'errorsToGhcException' in CmdLineParser.hs
{{{
StaticFlags.hs:86: errorsToGhcException . map (("on the commandline",
) . unLoc) $ errs
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12056#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list