From bb5afd3c274011c5ea302210b4c290ec1f83209c Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Thu, 25 Feb 2016 17:34:07 +0100 Subject: 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 --- testsuite/tests/ghc-api/T7478/T7478.hs | 4 ++-- testsuite/tests/ghc-api/apirecomp001/apirecomp001.stderr | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'testsuite/tests/ghc-api') diff --git a/testsuite/tests/ghc-api/T7478/T7478.hs b/testsuite/tests/ghc-api/T7478/T7478.hs index dc6edb21a8..bd6fb37d8b 100644 --- a/testsuite/tests/ghc-api/T7478/T7478.hs +++ b/testsuite/tests/ghc-api/T7478/T7478.hs @@ -41,9 +41,9 @@ compileInGhc targets handlerOutput = do TargetFile file Nothing -> file _ -> error "fileFromTarget: not a known target" - collectSrcError handlerOutput flags SevOutput _srcspan style msg + collectSrcError handlerOutput flags _ SevOutput _srcspan style msg = handlerOutput $ GHC.showSDocForUser flags (queryQual style) msg - collectSrcError _ _ _ _ _ _ + collectSrcError _ _ _ _ _ _ _ = return () main :: IO () diff --git a/testsuite/tests/ghc-api/apirecomp001/apirecomp001.stderr b/testsuite/tests/ghc-api/apirecomp001/apirecomp001.stderr index d778df2783..a943e48a3b 100644 --- a/testsuite/tests/ghc-api/apirecomp001/apirecomp001.stderr +++ b/testsuite/tests/ghc-api/apirecomp001/apirecomp001.stderr @@ -1,9 +1,9 @@ -B.hs:4:1: warning: +B.hs:4:1: warning: [-Wmissing-signatures (in -Wall)] Top-level binding with no type signature: answer_to_live_the_universe_and_everything :: Int -B.hs:5:12: warning: +B.hs:5:12: warning: [-Wtype-defaults (in -Wall)] • Defaulting the following constraints to type ‘Integer’ (Enum a0) arising from the arithmetic sequence ‘1 .. 23 * 2’ at B.hs:5:12-20 @@ -12,14 +12,14 @@ B.hs:5:12: warning: In the first argument of ‘(-)’, namely ‘length [1 .. 23 * 2]’ In the expression: length [1 .. 23 * 2] - 4 -A.hs:7:1: warning: +A.hs:7:1: warning: [-Wmissing-signatures (in -Wall)] Top-level binding with no type signature: main :: IO () -B.hs:4:1: warning: +B.hs:4:1: warning: [-Wmissing-signatures (in -Wall)] Top-level binding with no type signature: answer_to_live_the_universe_and_everything :: Int -B.hs:5:12: warning: +B.hs:5:12: warning: [-Wtype-defaults (in -Wall)] • Defaulting the following constraints to type ‘Integer’ (Enum a0) arising from the arithmetic sequence ‘1 .. 23 * 2’ at B.hs:5:12-20 @@ -28,5 +28,5 @@ B.hs:5:12: warning: In the first argument of ‘(-)’, namely ‘length [1 .. 23 * 2]’ In the expression: length [1 .. 23 * 2] - 4 -A.hs:7:1: warning: +A.hs:7:1: warning: [-Wmissing-signatures (in -Wall)] Top-level binding with no type signature: main :: IO () -- cgit v1.2.1