[commit: ghc] ghc-7.10: Dont call unsafeGlobalDynFlags if it is not set (f92acd8)

git at git.haskell.org git at git.haskell.org
Tue Mar 17 16:22:54 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.10
Link       : http://ghc.haskell.org/trac/ghc/changeset/f92acd8ed223ebbbf62fab930c6c346f5531d431/ghc

>---------------------------------------------------------------

commit f92acd8ed223ebbbf62fab930c6c346f5531d431
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Mon Mar 16 18:36:59 2015 +0100

    Dont call unsafeGlobalDynFlags if it is not set
    
    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). This
    regression was introduced in 1d6124de.
    
    Also rename showSDocSimple to showSDocUnsafe, to hopefully prevent this
    from happening again.
    
    Reviewed By: austin
    
    Differential Revision: https://phabricator.haskell.org/D730
    
    GHC Trac Issues: #9963
    
    (cherry picked from commit 5166ee94e439375a4e6acb80f88ec6ee65476bbd)


>---------------------------------------------------------------

f92acd8ed223ebbbf62fab930c6c346f5531d431
 compiler/basicTypes/SrcLoc.hs       |  5 +----
 compiler/main/CmdLineParser.hs      | 24 +++++++++++++++++++++---
 compiler/main/DynFlags.hs           | 10 +++++++---
 compiler/main/StaticFlags.hs        |  7 +++++--
 compiler/typecheck/TcGenDeriv.hs    |  6 ++++--
 compiler/utils/Outputable.hs        |  8 +++++---
 ghc/Main.hs                         |  9 ++++++---
 testsuite/tests/driver/T9963.stderr |  2 ++
 testsuite/tests/driver/all.T        |  2 ++
 9 files changed, 53 insertions(+), 20 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc f92acd8ed223ebbbf62fab930c6c346f5531d431


More information about the ghc-commits mailing list