From aadb6d6d40a7e8b74a482ffa3a0777dd0b754c4f Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 7 Feb 2001 16:47:25 +0000 Subject: [PATCH] [project @ 2001-02-07 16:47:25 by simonmar] Add "Warning:" to the front of warning messages. --- ghc/compiler/deSugar/Match.lhs | 4 ++-- ghc/compiler/main/ErrUtils.lhs | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ghc/compiler/deSugar/Match.lhs b/ghc/compiler/deSugar/Match.lhs index 487794f..e50d8a5 100644 --- a/ghc/compiler/deSugar/Match.lhs +++ b/ghc/compiler/deSugar/Match.lhs @@ -27,7 +27,7 @@ import Type ( splitAlgTyConApp, mkTyVarTys, Type ) import TysWiredIn ( nilDataCon, consDataCon, mkTupleTy, mkListTy, tupleCon ) import BasicTypes ( Boxity(..) ) import UniqSet -import ErrUtils ( addErrLocHdrLine, dontAddErrLoc ) +import ErrUtils ( addWarnLocHdrLine, dontAddErrLoc ) import Outputable \end{code} @@ -113,7 +113,7 @@ pp_context NoMatchContext msg rest_of_msg_fun pp_context (DsMatchContext kind pats loc) msg rest_of_msg_fun = case pp_match kind pats of (ppr_match, pref) -> - addErrLocHdrLine loc message (nest 8 (rest_of_msg_fun pref)) + addWarnLocHdrLine loc message (nest 8 (rest_of_msg_fun pref)) where message = ptext SLIT("Pattern match(es)") <+> msg <+> ppr_match <> char ':' where diff --git a/ghc/compiler/main/ErrUtils.lhs b/ghc/compiler/main/ErrUtils.lhs index ccc03ad..a566b6e 100644 --- a/ghc/compiler/main/ErrUtils.lhs +++ b/ghc/compiler/main/ErrUtils.lhs @@ -8,7 +8,7 @@ module ErrUtils ( ErrMsg, WarnMsg, Message, Messages, errorsFound, warningsFound, addShortErrLocLine, addShortWarnLocLine, - addErrLocHdrLine, dontAddErrLoc, + addErrLocHdrLine, addWarnLocHdrLine, dontAddErrLoc, printErrorsAndWarnings, pprBagOfErrors, pprBagOfWarnings, @@ -37,6 +37,7 @@ type Message = SDoc addShortErrLocLine :: SrcLoc -> Message -> ErrMsg addErrLocHdrLine :: SrcLoc -> Message -> Message -> ErrMsg +addWarnLocHdrLine :: SrcLoc -> Message -> Message -> ErrMsg addShortWarnLocLine :: SrcLoc -> Message -> WarnMsg addShortErrLocLine locn rest_of_err_msg @@ -50,6 +51,12 @@ addErrLocHdrLine locn hdr rest_of_err_msg 4 rest_of_err_msg ) +addWarnLocHdrLine locn hdr rest_of_err_msg + = ( locn + , hang (ppr locn <> colon <+> ptext SLIT("Warning:") <+> hdr) + 4 (rest_of_err_msg) + ) + addShortWarnLocLine locn rest_of_err_msg | isGoodSrcLoc locn = (locn, hang (ppr locn <> colon) 4 (ptext SLIT("Warning:") <+> rest_of_err_msg)) -- 1.7.10.4