This is basically the patch originally implemented by Ian Lynagh
manually forward-ported to GHC 7.10/11 (the patch wasn't mergeable anymore)
Original comment from Ian regarding this patch from Trac #4878:
I've added the beginnings of a patch for this. It needs some polishing, but basically works.
In essence, warnings are parsed in export lists, and kept in AvailInfo and then Provenance. When giving deprecation warnings, we check to see whether any provenance is warning-free, and if not then we print all the warnings.
I think we probably want to parameterise AvailInfo; in particular, rather than
addAvailInfoWarnings :: Map Name WarningTxt -> [AvailInfo] -> [AvailInfo]
we should have
addAvailInfoWarnings :: Map Name WarningTxt -> [AvailInfo Name] -> [AvailInfo NameWarn]
bestImport in extendImportMap should probably be trying to find an import without a warning, too.