diff options
author | Michael Walker <mike@barrucadu.co.uk> | 2016-02-25 17:34:07 +0100 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2016-02-25 23:44:08 +0100 |
commit | bb5afd3c274011c5ea302210b4c290ec1f83209c (patch) | |
tree | b6c2000e466e894207ce28dc65346853120f8548 /compiler/typecheck/TcClassDcl.hs | |
parent | 1badf157be3b7f604ba1ac64d2ea044d783e6e50 (diff) | |
download | haskell-bb5afd3c274011c5ea302210b4c290ec1f83209c.tar.gz |
Print which warning-flag controls an emitted warning
Both gcc and clang tell which warning flag a reported warning can be
controlled with, this patch makes ghc do the same. More generally, this
allows for annotated compiler output, where an optional annotation is
displayed in brackets after the severity.
This also adds a new flag `-f(no-)show-warning-groups` to control
whether to show which warning-group (such as `-Wall` or `-Wcompat`)
a warning belongs to. This flag is on by default.
This implements #10752
Reviewed By: quchen, bgamari, hvr
Differential Revision: https://phabricator.haskell.org/D1943
Diffstat (limited to 'compiler/typecheck/TcClassDcl.hs')
-rw-r--r-- | compiler/typecheck/TcClassDcl.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/typecheck/TcClassDcl.hs b/compiler/typecheck/TcClassDcl.hs index b1baabb963..602ef64d86 100644 --- a/compiler/typecheck/TcClassDcl.hs +++ b/compiler/typecheck/TcClassDcl.hs @@ -210,7 +210,8 @@ tcDefMeth clas tyvars this_dict binds_in hs_sig_fn prag_fn ; spec_prags <- discardConstraints $ tcSpecPrags global_dm_id prags - ; warnTc (not (null spec_prags)) + ; warnTc NoReason + (not (null spec_prags)) (text "Ignoring SPECIALISE pragmas on default method" <+> quotes (ppr sel_name)) @@ -280,7 +281,7 @@ tcClassMinimalDef _clas sigs op_info -- class ops without default methods are required, since we -- have no way to fill them in otherwise whenIsJust (isUnsatisfied (mindef `impliesAtom`) defMindef) $ - (\bf -> addWarnTc (warningMinimalDefIncomplete bf)) + (\bf -> addWarnTc NoReason (warningMinimalDefIncomplete bf)) return mindef where -- By default require all methods without a default @@ -487,7 +488,7 @@ warnMissingAT :: Name -> TcM () warnMissingAT name = do { warn <- woptM Opt_WarnMissingMethods ; traceTc "warn" (ppr name <+> ppr warn) - ; warnTc warn -- Warn only if -Wmissing-methods + ; warnTc (Reason Opt_WarnMissingMethods) warn -- Warn only if -Wmissing-methods (text "No explicit" <+> text "associated type" <+> text "or default declaration for " <+> quotes (ppr name)) } |