Request: suppress specific warnings at specific places
Mike Gunter
m@ryangunter.com
21 Nov 2002 13:27:14 -0800
If the switches take affect at the line granularity there would seem
to be a straightforward implementation that's orthogonal to most
everything else: store the excluded regions in separate data structure
and check that data structure before printing a message.
mike
> > GHC's excellent warnings are very helpful. They would be somewhat
> > more so if it were possible to suppress a warning about a specific bit
> > of code. One possible syntax (to which I gave no commitment) would be
> >
> > {-# WOFF "non-exhaustive pattern matches" #-}
> > <offending code>
> > {-# WON "non-exhaustive pattern matches" #-}
> >
> > . Another would be
> >
> > {-# WOFF 523 #-}
> > <offending code>
> > {-# WON 523 #-}
> >
> > where 523 is a warning number emitted with the warning message.
> >
> > This would be particularly useful with the recently granted wish for
> > -Werror.
>
> This would be nice, but it would be tricky to implement: declarations
> have to be tagged with a list of "exceptions" to the prevailing warning
> settings. I doubt we'll do this any time soon, but patches are welcome
> as usual...
>
> (of course, the workaround is to put the offending code into a module of
> its own, and use OPTIONS to turn off the appropriate warnings).
>
> Cheers,
> SImon