[m-rev.] for review: fix singleton variable warning problem

Simon Taylor stayl at cs.mu.OZ.AU
Fri May 31 14:21:46 AEST 2002


On 30-May-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> Estimated hours taken: 4
> Branches: main
> 
> compiler/make_hlds.m:
>     Avoid the problem with a variable with a non anonymous name in a
>     Mercury clause is renamed to an anonymous variable name by
>     interaction merging in the varset of a pragma foreign_code, and
>     hence causes spurious warnings.

Could you try that again please.

> Index: compiler/make_hlds.m
> ===================================================================
> @@ -5644,9 +5644,13 @@
>  		io__write_string("  in the argument list.\n"),
>  		io__set_exit_status(1)
>  	;
> -		% merge the varsets of the proc and the new pragma_c_code
> +		% Merge the varsets of the proc and the new foreign_proc.
> +		% Note that we discard the names of the foreign_proc as
> +		% this avoids problems with anonymous variables and
> +		% implementations in Mercury.

The comment needs to describe what the problem was.

>  		{
> -		varset__merge_subst(VarSet0, PVarSet, VarSet1, Subst),
> +		varset__merge_subst_without_names(VarSet0,
> +				PVarSet, VarSet1, Subst),
>  		map__apply_to_list(Args0, Subst, TermArgs),
>  		term__term_list_to_var_list(TermArgs, Args),

This is still treating the symptom, not the cause. Why do variables
in foreign_proc clauses need to be handled differently? Why doesn't
this problem occur with Mercury clauses?

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