-Wunrecognised-warning-flags and -Wdeprecated-flags behave differently.
The -Wunrecognised-warning-flags
is reported used "current" state of diagnostic options, for example in
ghc -w -XOverlappingInstances -Wfoo -Wunrecognised-warning-flags -Wbar ...
Only -Wbar
is reported as unrecognised, and GHC is silent about -Wfoo
. (This is a test for #12056 (closed), so I assume it is supposed to work so).
However, with -Wdeprecated-flags
the behaviour is different:
ghc -XTypeInType -Wno-deprecated-flags ...
will not generate a warning about -XTypeInType
, as apparently only the final diagnostic options is considered.
I find this inconsistent, and cannot find any mention in the user manual that this is intentional.
The !10450 (closed) incidentally makes the behavior of both consistent, as deferring to final DiagOpts
for some warnings is tricky to plumb. One drawback is that I'd need to teach hadrian
to also prepend GHC-options. I'd argue that not bad, as we are just lucky we didn't need to prepend Wunrecognised-warning-flags
, and we might need to prepend some other flags in the future.
cc @mpickering