Commit 437ebdda authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺

Start using `-W` instead of `-f(no-)warn` in some places

This replaces some occurences of `-f(no-)warn` with the new `-W`-aliases
introduced via 2206fa8c / #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
parent 2206fa8c
{-# 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
......
......@@ -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
......
......@@ -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.
......
{-# 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
-----------------------------------------------------------------------------
......
......@@ -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 #-}
-----------------------------------------------------------------------------
......
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE CPP, NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}
{-# OPTIONS_HADDOCK not-home #-}
-----------------------------------------------------------------------------
......
......@@ -4,7 +4,7 @@
, MagicHash
, UnboxedTuples
#-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}
{-# OPTIONS_HADDOCK not-home #-}
-----------------------------------------------------------------------------
......
......@@ -8,7 +8,7 @@
, StandaloneDeriving
, RankNTypes
#-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}
{-# OPTIONS_HADDOCK not-home #-}
-----------------------------------------------------------------------------
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, UnboxedTuples #-}
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
{-# OPTIONS_GHC -Wno-missing-signatures #-}
{-# OPTIONS_HADDOCK not-home #-}
-----------------------------------------------------------------------------
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE BangPatterns, NoImplicitPrelude, RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -Wno-name-shadowing #-}
module GHC.Event.IntTable
(
......
......@@ -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 #-}
-----------------------------------------------------------------------------
......
{-# 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
......
......@@ -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 #-}
......
......@@ -4,7 +4,7 @@
, RecordWildCards
, NondecreasingIndentation
#-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
-----------------------------------------------------------------------------
-- |
......
......@@ -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 #-}
-----------------------------------------------------------------------------
......
......@@ -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 #-}
-----------------------------------------------------------------------------
......
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE CPP, NoImplicitPrelude, MagicHash, UnboxedTuples, BangPatterns #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -Wno-orphans #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
......
{-# LANGUAGE Safe #-}
-- This module deliberately declares orphan instances:
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-----------------------------------------------------------------------------
-- |
......
......@@ -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 #-}
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment