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

#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

#11429: Make unrecognised `-W` flags a warning rather than an error -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: feature request | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: Design/Warnings | -------------------------------------+------------------------------------- Comment (by hvr): PS: there some circular implementation details here I'm deliberately ignoring; I'm aware this may require some special handling for this new flag, rather than being handled uniformly like the other flags. I'm more inclined to have a uniform CLI appearance to the user than a uniform implementation... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11429#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11429: Make unrecognised `-W` flags a warning rather than an error -------------------------------------+------------------------------------- Reporter: hvr | Owner: bgamari Type: feature request | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: Design/Warnings | -------------------------------------+------------------------------------- Changes (by bgamari): * owner: => bgamari -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11429#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11429: Make unrecognised `-W` flags a warning rather than an error -------------------------------------+------------------------------------- Reporter: hvr | Owner: bgamari Type: feature request | Status: patch Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1830 Wiki Page: Design/Warnings | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D1830 Comment: Implementation in Phab:D1830. Note that this flag is order dependent. That is, {{{ ghc -Wfoobar -Wno-unrecognised-warning-flag }}} will throw a warning but {{{ ghc -Wno-unrecognised-warning-flag -Wfoobar }}} will not. This, however, is already true of existing flags (e.g. see #10560). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11429#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11429: Make unrecognised `-W` flags a warning rather than an error
-------------------------------------+-------------------------------------
Reporter: hvr | Owner: bgamari
Type: feature request | Status: patch
Priority: highest | Milestone: 8.0.1
Component: Compiler | Version:
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D1830
Wiki Page: Design/Warnings |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#11429: Make unrecognised `-W` flags a warning rather than an error -------------------------------------+------------------------------------- Reporter: hvr | Owner: bgamari Type: feature request | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1830 Wiki Page: Design/Warnings | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: Merged to `master` and `ghc-8.0` (as bbd935606422ca884a680afa806164d851fd5060). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11429#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11429: Make unrecognised `-W` flags a warning rather than an error -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: feature request | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1830, Wiki Page: Design/Warnings | Phab:D1942 -------------------------------------+------------------------------------- Changes (by hvr): * owner: bgamari => * status: closed => new * differential: Phab:D1830 => Phab:D1830, Phab:D1942 * resolution: fixed => Comment: See Phab:D1492 for extending this warning to `-f(no-)warn-*` flags as well -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11429#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11429: Make unrecognised `-W` flags a warning rather than an error
-------------------------------------+-------------------------------------
Reporter: hvr | Owner:
Type: feature request | Status: new
Priority: highest | Milestone: 8.0.1
Component: Compiler | Version:
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D1830,
Wiki Page: Design/Warnings | Phab:D1942
-------------------------------------+-------------------------------------
Comment (by Herbert Valerio Riedel

#11429: Make unrecognised `-W` flags a warning rather than an error -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: feature request | Status: merge Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1830, Wiki Page: Design/Warnings | Phab:D1942 -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => merge -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11429#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11429: Make unrecognised `-W` flags a warning rather than an error -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: feature request | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1830, Wiki Page: Design/Warnings | Phab:D1942 -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged as 3d345e8f1551b21980aeef9110463ecd2ee2686f. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11429#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11429: Make unrecognised `-W` flags a warning rather than an error -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: feature request | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1830, Wiki Page: Design/Warnings | Phab:D1942 -------------------------------------+------------------------------------- Comment (by thomie): Is it by design that `-Wno-unrecognised-warning-flags` should come first on the command line? {{{ $ ghc-8.0.1 Test.hs -Wno-unrecognised-warning-flags -Wfoo # no warning, as expected $ ghc-8.0.1 Test.hs -Wfoo -Wno-unrecognised-warning-flags on the commandline: warning: unrecognised warning flag: -Wfoo }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11429#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11429: Make unrecognised `-W` flags a warning rather than an error -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: feature request | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1830, Wiki Page: Design/Warnings | Phab:D1942 -------------------------------------+------------------------------------- Comment (by thomie): This feature broke the alternative spelling suggestions for misspelled warning flags, see #11789. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11429#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC