
#12056: Too aggressive `-w` option -------------------------------------+------------------------------------- Reporter: asr | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #11429, #11789 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by sgillespie): I hacked on this a bit over the weekend. The first thing I found was this: {{{ $ ghc Main.hs -Wfoo -w -Wunrecognised-warning-flags -Wbar }}} Does not print warnings, as was noted in the ticket originally. Now if I add {{{-Wdeprecated-flags}}}, I now see all unrecognised warnings: {{{ $ ghc Main.hs -Wfoo -w -Wunrecognised-warning-flags -Wdeprecated-flags -Wbar on the commandline: warning: unrecognised warning flag: -Wfoo on the commandline: warning: unrecognised warning flag: -Wbar }}} This is most likely due to the logic to show flag warnings {{{ handleFlagWarnings :: DynFlags -> [Located String] -> IO () handleFlagWarnings dflags warns = when (wopt Opt_WarnDeprecatedFlags dflags) $ do -- It would be nicer if warns :: [Located MsgDoc], but that -- has circular import problems. let bag = listToBag [ mkPlainWarnMsg dflags loc (text warn) | L loc warn <- warns ] printOrThrowWarnings dflags bag }}} So it would seem that Option 2 above is already implemented, albeit with some restrictions. The most straightforward way to fix this would be to add `Opt_UnrecognisedWarningFlags` to `handleFlagWarnings` -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12056#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler