Ensure DynFlags are consistent
authorBen Gamari <bgamari.foss@gmail.com>
Thu, 6 Aug 2015 15:25:46 +0000 (17:25 +0200)
committerBen Gamari <ben@smart-cactus.org>
Thu, 6 Aug 2015 15:25:47 +0000 (17:25 +0200)
commiteca9a1a17c12d01636417fb88bda5ee5fe34577f
tree671d7f90ed254d63517c100fe503804dacd322f1
parent64dba5119fdecb4a5b6a2993919a963d02171783
Ensure DynFlags are consistent

While we have always had makeDynFlagsConsistent to enforce a variety of
consistency invariants on DynFlags, it hasn't been widely used.
GHC.Main, for instance, ignored it entirely. This leads to issues like
Trac #10549, where an OPTIONS_GHC pragma introduced an inconsistency,
leading to a perplexing crash later in compilation.

Here I add consistency checks in GHC.Main.set{Session,Program}DynFlags,
closing this hole.

Fixes #10549.

Test Plan: Validate with T10549

Reviewers: austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1128

GHC Trac Issues: #10549
compiler/main/DynFlags.hs
compiler/main/GHC.hs
testsuite/tests/ghc-api/T10052/T10052.stderr
testsuite/tests/ghci.debugger/scripts/print007.stderr
testsuite/tests/ghci/should_fail/Makefile [new file with mode: 0644]
testsuite/tests/ghci/should_fail/T10549.hs [new file with mode: 0644]
testsuite/tests/ghci/should_fail/T10549.script [new file with mode: 0644]
testsuite/tests/ghci/should_fail/T10549.stderr [new file with mode: 0644]
testsuite/tests/ghci/should_fail/all.T [new file with mode: 0644]