Start using `-W` instead of `-f(no-)warn` in some places
authorHerbert Valerio Riedel <hvr@gnu.org>
Wed, 16 Dec 2015 12:32:32 +0000 (13:32 +0100)
committerHerbert Valerio Riedel <hvr@gnu.org>
Wed, 16 Dec 2015 13:45:00 +0000 (14:45 +0100)
This replaces some occurences of `-f(no-)warn` with the new `-W`-aliases
introduced via 2206fa8cdb120932 / #11218, in cases which are guaranteed
to be invoked with recent enough GHC (i.e. the stage1+ GHC).

After this commit, mostly the compiler and the testsuite remain using
`-f(wo-)warn...` because the compiler needs to be bootstrappable with
older GHCs, while for the testsuite it's convenient to be able to quickly
compare the behavior to older GHCs (which may not support the new flags yet).

The compiler-part can be updated to use the new flags once GHC 8.3 development
starts.

Reviewed By: quchen

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

20 files changed:
libraries/base/Control/Arrow.hs
libraries/base/Control/Category.hs
libraries/base/Control/Concurrent.hs
libraries/base/Foreign/C/Types.hs
libraries/base/GHC/Base.hs
libraries/base/GHC/Conc.hs
libraries/base/GHC/Conc/IO.hs
libraries/base/GHC/Conc/Sync.hs
libraries/base/GHC/Conc/Windows.hs
libraries/base/GHC/Event/IntTable.hs
libraries/base/GHC/Float.hs
libraries/base/GHC/IO/Encoding/CodePage/API.hs
libraries/base/GHC/IO/FD.hs
libraries/base/GHC/IO/Handle.hs
libraries/base/GHC/IO/Handle/Internals.hs
libraries/base/GHC/IO/Handle/Text.hs
libraries/base/GHC/Real.hs
libraries/base/Text/Show/Functions.hs
libraries/ghc-prim/GHC/Classes.hs
mk/warnings.mk

index 8a4bc2d..3417f30 100644 (file)
@@ -1,6 +1,6 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE NoImplicitPrelude #-}
-{-# OPTIONS_GHC -fno-warn-inline-rule-shadowing #-}
+{-# OPTIONS_GHC -Wno-inline-rule-shadowing #-}
     -- The RULES for the methods of class Arrow may never fire
     -- e.g. compose/arr;  see Trac #10528
 
index 8616a17..b638189 100644 (file)
@@ -2,7 +2,7 @@
 {-# LANGUAGE GADTs #-}
 {-# LANGUAGE NoImplicitPrelude #-}
 {-# LANGUAGE PolyKinds #-}
-{-# OPTIONS_GHC -fno-warn-inline-rule-shadowing #-}
+{-# OPTIONS_GHC -Wno-inline-rule-shadowing #-}
     -- The RULES for the methods of class Category may never fire
     -- e.g. identity/left, identity/right, association;  see Trac #10528
 
index 1786c3d..babe8d9 100644 (file)
@@ -5,7 +5,7 @@
            , ScopedTypeVariables
            , RankNTypes
   #-}
-{-# OPTIONS_GHC -fno-warn-deprecations #-}
+{-# OPTIONS_GHC -Wno-deprecations #-}
 -- kludge for the Control.Concurrent.QSem, Control.Concurrent.QSemN
 -- and Control.Concurrent.SampleVar imports.
 
index cc0eb1b..fef8e4a 100644 (file)
@@ -1,8 +1,8 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, GeneralizedNewtypeDeriving,
              StandaloneDeriving #-}
-{-# OPTIONS_GHC -fno-warn-unused-binds #-}
--- XXX -fno-warn-unused-binds stops us warning about unused constructors,
+{-# OPTIONS_GHC -Wno-unused-binds #-}
+-- XXX -Wno-unused-binds stops us warning about unused constructors,
 -- but really we should just remove them if we don't want them
 
 -----------------------------------------------------------------------------
index 90eaaf0..89ec703 100644 (file)
@@ -84,9 +84,9 @@ Other Prelude modules are much easier with fewer complex dependencies.
            , ExistentialQuantification
            , RankNTypes
   #-}
--- -fno-warn-orphans is needed for things like:
+-- -Wno-orphans is needed for things like:
 -- Orphan rule: "x# -# x#" ALWAYS forall x# :: Int# -# x# x# = 0
-{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
 {-# OPTIONS_HADDOCK hide #-}
 
 -----------------------------------------------------------------------------
index 68182a1..38fac43 100644 (file)
@@ -1,6 +1,6 @@
 {-# LANGUAGE Unsafe #-}
 {-# LANGUAGE CPP, NoImplicitPrelude #-}
-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -Wno-missing-signatures #-}
 {-# OPTIONS_HADDOCK not-home #-}
 
 -----------------------------------------------------------------------------
index 3a57c93..b2c96b9 100644 (file)
@@ -4,7 +4,7 @@
            , MagicHash
            , UnboxedTuples
   #-}
-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -Wno-missing-signatures #-}
 {-# OPTIONS_HADDOCK not-home #-}
 
 -----------------------------------------------------------------------------
index 83934fe..5e27733 100644 (file)
@@ -8,7 +8,7 @@
            , StandaloneDeriving
            , RankNTypes
   #-}
-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -Wno-missing-signatures #-}
 {-# OPTIONS_HADDOCK not-home #-}
 
 -----------------------------------------------------------------------------
index 16112cd..8913a65 100644 (file)
@@ -1,6 +1,6 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, UnboxedTuples #-}
-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
+{-# OPTIONS_GHC -Wno-missing-signatures #-}
 {-# OPTIONS_HADDOCK not-home #-}
 
 -----------------------------------------------------------------------------
index 8d0f179..ea487d5 100644 (file)
@@ -1,6 +1,6 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE BangPatterns, NoImplicitPrelude, RecordWildCards #-}
-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+{-# OPTIONS_GHC -Wno-name-shadowing #-}
 
 module GHC.Event.IntTable
     (
index 74d7cb8..e6180af 100644 (file)
@@ -6,7 +6,7 @@
   #-}
 -- We believe we could deorphan this module, by moving lots of things
 -- around, but we haven't got there yet:
-{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
 {-# OPTIONS_HADDOCK hide #-}
 
 -----------------------------------------------------------------------------
index 7fd22cb..103eb87 100644 (file)
@@ -1,7 +1,7 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE CPP, NoImplicitPrelude, NondecreasingIndentation,
              RecordWildCards, ScopedTypeVariables #-}
-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+{-# OPTIONS_GHC -Wno-name-shadowing #-}
 
 module GHC.IO.Encoding.CodePage.API (
     mkCodePageEncoding
index edce500..eb7b80b 100644 (file)
@@ -3,7 +3,7 @@
            , NoImplicitPrelude
            , BangPatterns
   #-}
-{-# OPTIONS_GHC -fno-warn-identities #-}
+{-# OPTIONS_GHC -Wno-identities #-}
 -- Whether there are identities depends on the platform
 {-# OPTIONS_HADDOCK hide #-}
 
index ac37ad4..750dbf7 100644 (file)
@@ -4,7 +4,7 @@
            , RecordWildCards
            , NondecreasingIndentation
   #-}
-{-# OPTIONS_GHC -fno-warn-unused-matches #-}
+{-# OPTIONS_GHC -Wno-unused-matches #-}
 
 -----------------------------------------------------------------------------
 -- |
index 37251ab..581eb9b 100644 (file)
@@ -5,8 +5,8 @@
            , NondecreasingIndentation
            , RankNTypes
   #-}
-{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+{-# OPTIONS_GHC -Wno-unused-matches #-}
+{-# OPTIONS_GHC -Wno-name-shadowing #-}
 {-# OPTIONS_HADDOCK hide #-}
 
 -----------------------------------------------------------------------------
index 88ec3c4..c31ab70 100644 (file)
@@ -6,8 +6,8 @@
            , NondecreasingIndentation
            , MagicHash
   #-}
-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
-{-# OPTIONS_GHC -fno-warn-unused-matches #-}
+{-# OPTIONS_GHC -Wno-name-shadowing #-}
+{-# OPTIONS_GHC -Wno-unused-matches #-}
 {-# OPTIONS_HADDOCK hide #-}
 
 -----------------------------------------------------------------------------
index 71de0d2..31381d6 100644 (file)
@@ -1,6 +1,6 @@
 {-# LANGUAGE Trustworthy #-}
 {-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, UnboxedTuples, BangPatterns #-}
-{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
 {-# OPTIONS_HADDOCK hide #-}
 
 -----------------------------------------------------------------------------
index 690b203..5230a4b 100644 (file)
@@ -1,6 +1,6 @@
 {-# LANGUAGE Safe #-}
 -- This module deliberately declares orphan instances:
-{-# OPTIONS_GHC -fno-warn-orphans #-}
+{-# OPTIONS_GHC -Wno-orphans #-}
 
 -----------------------------------------------------------------------------
 -- |
index 0e74bef..19192fb 100644 (file)
@@ -7,11 +7,11 @@
 {-# LANGUAGE UndecidableSuperClasses #-}
   -- Because of the type-variable superclasses for tuples
 
-{-# OPTIONS_GHC -fno-warn-unused-imports #-}
--- -fno-warn-unused-imports needed for the GHC.Tuple import below. Sigh.
+{-# OPTIONS_GHC -Wno-unused-imports #-}
+-- -Wno-unused-imports needed for the GHC.Tuple import below. Sigh.
 
-{-# OPTIONS_GHC -fno-warn-unused-top-binds #-}
--- -fno-warn-unused-top-binds is there (I hope) to stop Haddock complaining
+{-# OPTIONS_GHC -Wno-unused-top-binds #-}
+-- -Wno-unused-top-binds is there (I hope) to stop Haddock complaining
 -- about the constraint tuples being defined but not used
 
 {-# OPTIONS_HADDOCK hide #-}
index f8db8fd..dd79673 100644 (file)
@@ -32,15 +32,20 @@ SRC_CC_WARNING_OPTS += -Wno-unknown-pragmas
 
 endif
 
-SRC_HC_WARNING_OPTS_STAGE1 += -fwarn-noncanonical-monad-instances
-SRC_HC_WARNING_OPTS_STAGE2 += -fwarn-noncanonical-monad-instances
+SRC_HC_WARNING_OPTS_STAGE1 += -Wnoncanonical-monad-instances
+SRC_HC_WARNING_OPTS_STAGE2 += -Wnoncanonical-monad-instances
 
 
 ######################################################################
 # Disable some warnings in packages we use
 
+# NB: The GHC version used for bootstrapping may not support the
+# `-W`-aliases for `-f(no-)warn` flags introduced in GHC 8.0, so in
+# some cases (watch out for make-variables with a name containing
+# "boot") we need to pass the legacy `-f(no-)warn`-flags instead.
+
 # Libraries that have dubious RULES
-libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-inline-rule-shadowing
+libraries/bytestring_dist-install_EXTRA_HC_OPTS += -Wno-inline-rule-shadowing
 
 # Cabal doesn't promise to be warning-free
 utils/ghc-cabal_dist_EXTRA_HC_OPTS += -w
@@ -48,47 +53,47 @@ libraries/Cabal/Cabal_dist-boot_EXTRA_HC_OPTS += -w
 libraries/Cabal/Cabal_dist-install_EXTRA_HC_OPTS += -w
 
 # Turn off import warnings for bad unused imports
-libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
-libraries/bytestring_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
-utils/haddock_dist_EXTRA_HC_OPTS += -fno-warn-unused-imports
-libraries/vector_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
+libraries/containers_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports
+libraries/bytestring_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports
+utils/haddock_dist_EXTRA_HC_OPTS += -Wno-unused-imports
+libraries/vector_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports
 
 # haddock's attoparsec uses deprecated `inlinePerformIO`
-utils/haddock_dist_EXTRA_HC_OPTS += -fno-warn-deprecations
+utils/haddock_dist_EXTRA_HC_OPTS += -Wno-deprecations
 
 # containers uses bitSize at the moment
-libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
-libraries/containers_dist-install_EXTRA_HC_OPTS += -fno-warn-redundant-constraints
+libraries/containers_dist-install_EXTRA_HC_OPTS += -Wno-deprecations
+libraries/containers_dist-install_EXTRA_HC_OPTS += -Wno-redundant-constraints
 
 # On Windows, there are also some unused import warnings
 ifeq "$(HostOS_CPP)" "mingw32"
-libraries/time_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports -fno-warn-identities
+libraries/time_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports -Wno-identities
 endif
 
 # haskeline has warnings about deprecated use of block/unblock
-libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-deprecations
-libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
-libraries/haskeline_dist-install_EXTRA_HC_OPTS += -fno-warn-redundant-constraints
+libraries/haskeline_dist-install_EXTRA_HC_OPTS += -Wno-deprecations
+libraries/haskeline_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports
+libraries/haskeline_dist-install_EXTRA_HC_OPTS += -Wno-redundant-constraints
 
 # binary upstream has some warnings, so don't use -Werror for it
 libraries/binary_dist-boot_EXTRA_HC_OPTS += -Wwarn
 libraries/binary_dist-install_EXTRA_HC_OPTS += -Wwarn
 
 # temporarily turn off unused-imports warnings for pretty
-libraries/pretty_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
+libraries/pretty_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports
 
 # primitive has a warning about deprecated use of GHC.IOBase
-libraries/primitive_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
+libraries/primitive_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports
 
 # temporarily turn off unused-imports warnings for terminfo
 libraries/terminfo_dist-boot_EXTRA_HC_OPTS += -fno-warn-unused-imports
-libraries/terminfo_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
+libraries/terminfo_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports
 
 # vector has some unused match warnings
 libraries/vector_dist-install_EXTRA_HC_OPTS += -Wwarn
 
 # temporarily turn off unused-imports warnings for xhtml
-libraries/xhtml_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-imports
+libraries/xhtml_dist-install_EXTRA_HC_OPTS += -Wno-unused-imports
 
 libraries/dph/dph-base_dist-install_EXTRA_HC_OPTS += -Wwarn
 libraries/dph/dph-prim-interface_dist-install_EXTRA_HC_OPTS += -Wwarn
@@ -98,16 +103,16 @@ libraries/dph/dph-lifted-common-install_EXTRA_HC_OPTS += -Wwarn
 
 # transformers has unused function parameters warnings
 libraries/transformers_dist-boot_EXTRA_HC_OPTS += -fno-warn-unused-matches -fno-warn-unused-imports
-libraries/transformers_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-matches -fno-warn-unused-imports
-libraries/transformers_dist-install_EXTRA_HC_OPTS += -fno-warn-redundant-constraints
+libraries/transformers_dist-install_EXTRA_HC_OPTS += -Wno-unused-matches -Wno-unused-imports
+libraries/transformers_dist-install_EXTRA_HC_OPTS += -Wno-redundant-constraints
 
 # Turn of trustworthy-safe warning
-libraries/base_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
-libraries/ghc-prim_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
-libraries/Win32_dist-install_EXTRA_HC_OPTS += -fno-warn-trustworthy-safe
+libraries/base_dist-install_EXTRA_HC_OPTS += -Wno-trustworthy-safe
+libraries/ghc-prim_dist-install_EXTRA_HC_OPTS += -Wno-trustworthy-safe
+libraries/Win32_dist-install_EXTRA_HC_OPTS += -Wno-trustworthy-safe
 
-# We need -fno-warn-deprecated-flags to avoid failure with -Werror
-GhcLibExtraHcOpts += -fno-warn-deprecated-flags
+# We need -Wno-deprecated-flags to avoid failure with -Werror
+GhcLibExtraHcOpts += -Wno-deprecated-flags
 GhcBootLibExtraHcOpts += -fno-warn-deprecated-flags
 
 # The warning suppression flag below is a temporary kludge. While working with
@@ -116,7 +121,7 @@ GhcBootLibExtraHcOpts += -fno-warn-deprecated-flags
 # http://ghc.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#TabsvsSpaces
 # for details
 #
-GhcLibExtraHcOpts += -fno-warn-tabs
+GhcLibExtraHcOpts += -Wno-tabs
 GhcBootLibExtraHcOpts += -fno-warn-tabs