[commit: ghc] master: Disable failed specialisation warnings by default & update documentation. (f405e1e)

git at git.haskell.org git at git.haskell.org
Wed Nov 18 11:53:47 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f405e1e75cd845c436e51c934958560c0e401248/ghc

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

commit f405e1e75cd845c436e51c934958560c0e401248
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Wed Nov 18 12:19:01 2015 +0100

    Disable failed specialisation warnings by default & update documentation.
    
    These were far too noisy to enable by default. In the future we will
    hopefully have a more variant of -Wall targetted at these sorts of
    diagnostics.
    
    In the interim I've pointed out the existence of these options in the
    release
    notes in hopes that people will discover them.
    
    Test Plan: Validate
    
    Reviewers: hvr, austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1492


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

f405e1e75cd845c436e51c934958560c0e401248
 compiler/main/DynFlags.hs                   |  6 ++----
 docs/users_guide/7.12.1-notes.rst           |  7 +++++++
 docs/users_guide/using-warnings.rst         | 21 ++++++++++-----------
 testsuite/tests/ghci/scripts/T9293.stdout   |  4 ----
 testsuite/tests/ghci/scripts/ghci024.stdout |  1 -
 testsuite/tests/ghci/scripts/ghci057.stdout |  4 ----
 utils/mkUserGuidePart/Options/Warnings.hs   | 12 ++++++++++++
 7 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 3a93e02..655998e 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -3436,8 +3436,7 @@ standardWarnings -- see Note [Documenting warning flags]
         Opt_WarnAlternativeLayoutRuleTransitional,
         Opt_WarnUnsupportedLlvmVersion,
         Opt_WarnContextQuantification,
-        Opt_WarnTabs,
-        Opt_WarnMissedSpecs
+        Opt_WarnTabs
       ]
 
 minusWOpts :: [WarningFlag]
@@ -3465,8 +3464,7 @@ minusWallOpts
         Opt_WarnOrphans,
         Opt_WarnUnusedDoBind,
         Opt_WarnTrustworthySafe,
-        Opt_WarnUntickedPromotedConstructors,
-        Opt_WarnAllMissedSpecs
+        Opt_WarnUntickedPromotedConstructors
       ]
 
 enableUnusedBinds :: DynP ()
diff --git a/docs/users_guide/7.12.1-notes.rst b/docs/users_guide/7.12.1-notes.rst
index d9ac18b..bd4f78b 100644
--- a/docs/users_guide/7.12.1-notes.rst
+++ b/docs/users_guide/7.12.1-notes.rst
@@ -108,6 +108,13 @@ Compiler
    Enabling ``-fworker-wrapper`` while strictness analysis is disabled (by
    ``-fno-strictness``) has no effect.
 
+-  Added the options ``-fwarn-missed-specialisations`` and
+   ``-fwarn-all-missed-specialisations``. When enabled, the simplifier will
+   produce a warning when a overloaded imported function cannot be
+   specialised (typically due to a missing ``INLINEABLE`` pragma). This
+   is intended to alert users to cases where they apply ``INLINEABLE`` but
+   may not get the speed-up they expect.
+
 GHCi
 ~~~~
 
diff --git a/docs/users_guide/using-warnings.rst b/docs/users_guide/using-warnings.rst
index 8cf329c..db57b18 100644
--- a/docs/users_guide/using-warnings.rst
+++ b/docs/users_guide/using-warnings.rst
@@ -158,17 +158,16 @@ command line.
        single: warnings
        single: pragmas
 
-    Emits a warning if GHC cannot specialise a function that is imported
-    and overloaded, usually because the function needs an ``INLINEABLE``
-    pragma.. The "all" form reports all such situations. The "non-all"
-    form only reports when the situation arises during specialisation of
-    an imported function; presumably teh latter was marked
-    ``INLINEABLE`` so that it would specialise but if it, in turn, calls
-    other functions that are not specialised you won't get the
-    performance boost you expect.
-
-    ``-fwarn-missed-specialisations`` is on by default;
-    ``-fwarn-all-missed-specialisations`` is implied by ``-Wall``.
+    Emits a warning if GHC cannot specialise an overloaded function, usually
+    because the function needs an ``INLINEABLE`` pragma. The "all" form reports
+    all such situations whereas the "non-all" form only reports when the
+    situation arises during specialisation of an imported function.
+
+    The "non-all" form is intended to catch cases where an imported function
+    that is marked as ``INLINEABLE`` (presumably to enable specialisation) cannot
+    be specialised as it calls other functions that are themselves not specialised.
+
+    These options are both off by default.
 
 ``-fwarn-warnings-deprecations``
     .. index::
diff --git a/testsuite/tests/ghci/scripts/T9293.stdout b/testsuite/tests/ghci/scripts/T9293.stdout
index 1dc12f1..67fc630 100644
--- a/testsuite/tests/ghci/scripts/T9293.stdout
+++ b/testsuite/tests/ghci/scripts/T9293.stdout
@@ -8,7 +8,6 @@ other dynamic, non-language, flag settings:
   -fno-ghci-history
   -fimplicit-import-qualified
 warning settings:
-  -fno-warn-missed-specialisations
 Should fail, GADTs is not enabled
 options currently set: none.
 base language is: Haskell2010
@@ -23,7 +22,6 @@ other dynamic, non-language, flag settings:
   -fno-ghci-history
   -fimplicit-import-qualified
 warning settings:
-  -fno-warn-missed-specialisations
 Should work, GADTs is in force from :set
 options currently set: none.
 base language is: Haskell2010
@@ -37,7 +35,6 @@ other dynamic, non-language, flag settings:
   -fno-ghci-history
   -fimplicit-import-qualified
 warning settings:
-  -fno-warn-missed-specialisations
 Should fail, GADTs is now disabled
 base language is: Haskell2010
 with the following modifiers:
@@ -53,6 +50,5 @@ other dynamic, non-language, flag settings:
   -fno-ghci-history
   -fimplicit-import-qualified
 warning settings:
-  -fno-warn-missed-specialisations
 Should fail, GADTs is only enabled at the prompt
 C :: T Int
diff --git a/testsuite/tests/ghci/scripts/ghci024.stdout b/testsuite/tests/ghci/scripts/ghci024.stdout
index 084f1ff..1624322 100644
--- a/testsuite/tests/ghci/scripts/ghci024.stdout
+++ b/testsuite/tests/ghci/scripts/ghci024.stdout
@@ -9,7 +9,6 @@ other dynamic, non-language, flag settings:
   -fforce-recomp
   -fimplicit-import-qualified
 warning settings:
-  -fno-warn-missed-specialisations
   -fno-warn-tabs
 ~~~~~~~~~~ Testing :set -a
 options currently set: none.
diff --git a/testsuite/tests/ghci/scripts/ghci057.stdout b/testsuite/tests/ghci/scripts/ghci057.stdout
index 1dc12f1..67fc630 100644
--- a/testsuite/tests/ghci/scripts/ghci057.stdout
+++ b/testsuite/tests/ghci/scripts/ghci057.stdout
@@ -8,7 +8,6 @@ other dynamic, non-language, flag settings:
   -fno-ghci-history
   -fimplicit-import-qualified
 warning settings:
-  -fno-warn-missed-specialisations
 Should fail, GADTs is not enabled
 options currently set: none.
 base language is: Haskell2010
@@ -23,7 +22,6 @@ other dynamic, non-language, flag settings:
   -fno-ghci-history
   -fimplicit-import-qualified
 warning settings:
-  -fno-warn-missed-specialisations
 Should work, GADTs is in force from :set
 options currently set: none.
 base language is: Haskell2010
@@ -37,7 +35,6 @@ other dynamic, non-language, flag settings:
   -fno-ghci-history
   -fimplicit-import-qualified
 warning settings:
-  -fno-warn-missed-specialisations
 Should fail, GADTs is now disabled
 base language is: Haskell2010
 with the following modifiers:
@@ -53,6 +50,5 @@ other dynamic, non-language, flag settings:
   -fno-ghci-history
   -fimplicit-import-qualified
 warning settings:
-  -fno-warn-missed-specialisations
 Should fail, GADTs is only enabled at the prompt
 C :: T Int
diff --git a/utils/mkUserGuidePart/Options/Warnings.hs b/utils/mkUserGuidePart/Options/Warnings.hs
index 688a7e6..593a20c 100644
--- a/utils/mkUserGuidePart/Options/Warnings.hs
+++ b/utils/mkUserGuidePart/Options/Warnings.hs
@@ -145,6 +145,18 @@ warningsOptions =
          , flagType = DynamicFlag
          , flagReverse = "-fno-warn-missing-local-sigs"
          }
+  , flag { flagName = "-fwarn-missed-specialisations"
+         , flagDescription =
+           "warn when specialisation of an imported, overloaded function fails."
+         , flagType = DynamicFlag
+         , flagReverse = "-fno-warn-missed-specialisations"
+         }
+  , flag { flagName = "-fwarn-all-missed-specialisations"
+         , flagDescription =
+           "warn when specialisation of any overloaded function fails."
+         , flagType = DynamicFlag
+         , flagReverse = "-fno-warn-all-missed-specialisations"
+         }
   , flag { flagName = "-fwarn-monomorphism-restriction"
          , flagDescription = "warn when the Monomorphism Restriction is applied"
          , flagType = DynamicFlag



More information about the ghc-commits mailing list