[GHC] #11429: Make unrecognised `-W` flags a warning rather than an error

GHC ghc-devs at haskell.org
Thu Jan 14 20:16:08 UTC 2016


#11429: Make unrecognised `-W` flags a warning rather than an error
-------------------------------------+-------------------------------------
           Reporter:  hvr            |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  highest        |         Milestone:  8.0.1
          Component:  Compiler       |           Version:
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:  Design/Warnings
-------------------------------------+-------------------------------------
 Currently, it's a fatal error to pass GHC a warning flag it doesn't
 recognise:

 {{{
 $ ghc-8.1.20160111 -Wfoobar -c foobar.hs
 ghc: unrecognised flag: -Wfoobar

 Usage: For basic information, try the `--help' option.
 }}}

 However, in order to gain more flexibility adding/removing warning flags
 without requiring users to carefully guard which flags a given GHC version
 supports, it was suggested to make GHC more tolerating in case of
 unrecognised warning flags (which may either have been removed, or not yet
 available in the current GHC version).

 Specifically, I propose the following:

  1. Handle `-Wno-<token>` or `-W<token>` for an unknown `<token>` as a
 warning rather than an error

  2. This warning gets its own token `unrecognised-warning-flag` (turned on
 by default), so that it can be controlled via the general warning
 facilities as well:

       - `-Wno-unrecognised-warning-flag`  turns off such warnings
       - `-Wunrecognised-warning-flag`  turns on such warnings explicitly
       - `-Werror=unrecognised-warning-flag` (once we have #11219) emulates
 the old behaviour
       - various other combinations with warning-sets, `-Werror`
 specifications

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11429>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list