[m-rev.] diff: fix termination pragmas

Simon Taylor stayl at cs.mu.OZ.AU
Tue Jun 24 21:35:02 AEST 2003


On 24-Jun-2003, Julien Fischer <juliensf at students.cs.mu.OZ.AU> wrote:
> Estimated hours take: 5.5
> Branches: main
> 
> Fix a bug in the termination analyser that caused it to ignore
> pragma terminates/does_not_terminate declarations.

You should also remove the entry in the BUGS file.

> Index: compiler/error_util.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/error_util.m,v
> retrieving revision 1.22
> diff -u -r1.22 error_util.m
> --- compiler/error_util.m	26 May 2003 08:59:53 -0000	1.22
> +++ compiler/error_util.m	20 Jun 2003 03:24:32 -0000
> @@ -91,6 +91,9 @@
>  :- pred error_util__describe_one_pred_name(module_info::in, pred_id::in,
>  	string::out) is det.
> 
> +:- pred error_util__describe_several_pred_names(module_info::in,
> +	list(pred_id)::in, list(format_component)::out) is det.
> +
>  :- pred error_util__describe_one_proc_name(module_info::in, pred_proc_id::in,
>  	string::out) is det.
> 
> @@ -458,6 +461,10 @@
>  			"'"], Piece)
>  	).
> 
> +error_util__describe_several_pred_names(Module, PredId, Pieces) :-
> +	list__map(error_util__describe_one_pred_name(Module), PredId, Pieces0),
> +	error_util__list_to_pieces(Pieces0, Pieces).
> +
>  error_util__describe_one_proc_name(Module, proc(PredId, ProcId), Piece) :-
>  	error_util__describe_one_pred_name(Module, PredId, PredPiece),
>  	proc_id_to_int(ProcId, ProcIdInt),

The code here is pretty simple, and is only called once.
I'd suggest just putting it inline.

> @@ -471,6 +478,8 @@
>  error_util__describe_several_proc_names(Module, PPIds, Pieces) :-
>  	list__map(error_util__describe_one_proc_name(Module), PPIds, Pieces0),
>  	error_util__list_to_pieces(Pieces0, Pieces).
> +
> +
> 
>  error_util__describe_one_call_site(Module, PPId - Context, Piece) :-
>  	error_util__describe_one_proc_name(Module, PPId, ProcName),

Undo the whitespace change.

> Index: doc/reference_manual.texi
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
> retrieving revision 1.275
> diff -u -r1.275 reference_manual.texi
> --- doc/reference_manual.texi	19 May 2003 14:24:31 -0000	1.275
> +++ doc/reference_manual.texi	19 Jun 2003 07:23:22 -0000
> @@ -8331,7 +8331,9 @@
>  or function is guaranteed to terminate for any input.  This is useful
>  when the compiler cannot prove termination of some predicates or
>  functions which are in turn preventing the compiler from proving
> -termination of other predicates or functions.
> +termination of other predicates or functions.  This declaration
> +effects not only the predicate specified but also
> +any other predicates that are mutually recursive with it.

s/effects/affects/

> @@ -8340,7 +8342,8 @@
>  This declaration may be used to inform the compiler that this predicate
>  does not necessarily terminate.  This is useful for procedures defined
>  using the C interface, which the compiler assumes to terminate by
> -default.
> +default.  This declaration effects not only the predicate specified
> +but also any other predicates that are mutually recursive with it.

Here too.

Simon.
--------------------------------------------------------------------------
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