[m-rev.] for review: change termination analysis error reporting

Julien Fischer juliensf at students.cs.mu.OZ.AU
Thu Jan 8 18:22:23 AEDT 2004


Estimated hours taken: 0.5
Branches: main

Modify the termination analysis so that when `--check-termination'
is enabled and if there are no direct reasons (in the sense defined in
term_errors.m) for the non-termination of a procedure then the indirect
reasons are reported. (Currently indirect reasons will only be reported
if `--verbose-check-termination' is enabled.)

This should reduce occurrences of the termination analysis reporting
that termination cannot be proven for unknown reasons(s).

compiler/termination.m:
	Alter the reporting of error messages, so that if there are no
	direct cause of non-termination we report the indirect ones.

Julien.


Index: termination.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/termination.m,v
retrieving revision 1.35
diff -u -r1.35 termination.m
--- termination.m	5 Nov 2003 03:17:44 -0000	1.35
+++ termination.m	8 Jan 2004 07:05:18 -0000
@@ -451,14 +451,15 @@
 		) },
 		{ list__filter(IsNonImported, SCC, NonImportedPPIds) },
 		{ NonImportedPPIds = [_ | _] },
-
-		% Only output warnings of non-termination for
-		% direct errors, unless verbose errors are
-		% enabled.  Direct errors are errors where the
-		% compiler analysed the code and was not able to
-		% prove termination.  Indirect warnings are
-		% created when code is used/called which the
-		% compiler was unable to analyse/prove termination of.
+
+		% Only output warnings of non-termination for direct
+		% errors.  If there are no direct errors then output
+		% the indirect errors - this is better than giving
+		% no reason at all.  If verbose errors is enabled then
+		% output both sorts of error.
+		% (See term_errors.m for details of direct and indirect
+		%  errors).
+
 		{ VerboseErrors = yes ->
 			PrintErrors = Errors
 		; NormalErrors = yes ->
@@ -466,7 +467,13 @@
 				ContextError = _Context - Error,
 				\+ indirect_error(Error)
 			),
-			list__filter(IsNonSimple, Errors, PrintErrors)
+			list__filter(IsNonSimple, Errors, PrintErrors0),
+				% If there were no direct errors then use
+				% the indirect errors.
+			( if 	PrintErrors0 = []
+			  then	PrintErrors = Errors
+			  else	PrintErrors = PrintErrors0
+			)
 		;
 			fail
 		}

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list