[commit: ghc] ghc-8.0: Document -fmax-pmcheck-iterations a bit better (d90a177)

git at git.haskell.org git at git.haskell.org
Tue May 3 19:24:28 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/d90a177a9f95cc1bdfb5ebeae0f3bb7d6237fb26/ghc

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

commit d90a177a9f95cc1bdfb5ebeae0f3bb7d6237fb26
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Wed Apr 27 09:57:41 2016 +0200

    Document -fmax-pmcheck-iterations a bit better
    
    (cherry picked from commit 5adf8f3b74a4ee11d594b9993493bed4e3521ce2)


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

d90a177a9f95cc1bdfb5ebeae0f3bb7d6237fb26
 docs/users_guide/8.0.1-notes.rst          |  2 +-
 docs/users_guide/using-warnings.rst       | 12 ++++++++++++
 utils/mkUserGuidePart/Options/Warnings.hs |  5 +++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/docs/users_guide/8.0.1-notes.rst b/docs/users_guide/8.0.1-notes.rst
index f627a6f..5f88037 100644
--- a/docs/users_guide/8.0.1-notes.rst
+++ b/docs/users_guide/8.0.1-notes.rst
@@ -344,7 +344,7 @@ Compiler
    the pattern match checker iterates. Since coverage checking is exponential
    in the general case, setting a default number of iterations prevents memory
    and performance blowups. By default, the number of iterations is set to
-   10000000 but it can be set to ``n`` with: ``-fmax-pmcheck-iterations=n``.
+   2000000 but it can be set with: ``-fmax-pmcheck-iterations=<n>``.
    If the set number of iterations is exceeded, an informative warning is
    issued.
 
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 16c6585..892be26 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -516,6 +516,18 @@ of ``-W(no-)*``.
         h = \[] -> 2
         Just k = f y
 
+.. ghc-flag:: -fmax-pmcheck-iterations=<N>
+
+    :default: 2000000
+
+    Sets how many iterations of the pattern-match checker will perform before
+    giving up. This limit is to catch cases where pattern-match checking might
+    be excessively costly (due to the exponential complexity of coverage
+    checking in the general case). It typically shouldn't be necessary to set
+    this unless GHC informs you that it has exceeded the pattern match checker's
+    iteration limit (in which case you may want to consider refactoring your
+    pattern match, for the sake of future readers of your code.
+
 .. ghc-flag:: -Wincomplete-record-updates
 
     .. index::
diff --git a/utils/mkUserGuidePart/Options/Warnings.hs b/utils/mkUserGuidePart/Options/Warnings.hs
index 3552172..31513d9 100644
--- a/utils/mkUserGuidePart/Options/Warnings.hs
+++ b/utils/mkUserGuidePart/Options/Warnings.hs
@@ -117,6 +117,11 @@ warningsOptions =
          , flagType = DynamicFlag
          , flagReverse = "-Wno-incomplete-uni-patterns"
          }
+  , flag { flagName = "-Wmax-pmcheck-iterations=<N>"
+         , flagDescription =
+           "the iteration limit for the pattern match checker"
+         , flagType = DynamicFlag
+         }
   , flag { flagName = "-Wincomplete-record-updates"
          , flagDescription = "warn when a record update could fail"
          , flagType = DynamicFlag



More information about the ghc-commits mailing list