[project @ 2001-02-07 16:47:25 by simonmar]
authorsimonmar <unknown>
Wed, 7 Feb 2001 16:47:25 +0000 (16:47 +0000)
committersimonmar <unknown>
Wed, 7 Feb 2001 16:47:25 +0000 (16:47 +0000)
Add "Warning:" to the front of warning messages.

ghc/compiler/deSugar/Match.lhs
ghc/compiler/main/ErrUtils.lhs

index 487794f..e50d8a5 100644 (file)
@@ -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
index ccc03ad..a566b6e 100644 (file)
@@ -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))