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

Simon Taylor stayl at cs.mu.OZ.AU
Sun Jun 2 17:20:04 AEST 2002


On 02-Jun-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 01-Jun-2002, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> > Index: tests/invalid/foreign_singleton.m
> > +:- pred f(int::out, io::di, io::uo) is det.
> > +
> > +:- pragma foreign_proc("C", f(X::out, _IO0::di, _IO::uo),
> > +        [will_not_call_mercury, promise_pure], "
> > +    X = 5;
> > +").
> > +
> > +f(X) --> [].
> 
> We should also test the case where the singleton is
> in the foreign_proc pragma, rather than in the Mercury code.

Estimated hours taken: 0.1
Branches: main

tests/invalid/foreign_singleton.m:
tests/invalid/foreign_singleton.err_exp:
	Add some more tests.

Index: foreign_singleton.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/foreign_singleton.err_exp,v
retrieving revision 1.1
diff -u -u -r1.1 foreign_singleton.err_exp
--- foreign_singleton.err_exp	1 Jun 2002 13:34:43 -0000	1.1
+++ foreign_singleton.err_exp	2 Jun 2002 07:16:27 -0000
@@ -1,5 +1,9 @@
+foreign_singleton.m:021: In the C code for predicate `foreign_singleton:f/3':
+foreign_singleton.m:021:   warning: variable `IO0' does not occur in the C code.
 foreign_singleton.m:026: In clause for predicate `foreign_singleton:f/3':
 foreign_singleton.m:026:   warning: variable `X' occurs only once in this scope.
 foreign_singleton.m:030: In clause for predicate `foreign_singleton:g/3':
 foreign_singleton.m:030:   warning: variable `X' occurs only once in this scope.
+foreign_singleton.m:032: In the C code for predicate `foreign_singleton:g/3':
+foreign_singleton.m:032:   warning: variable `IO0' does not occur in the C code.
 For more information, try recompiling with `-E'.
Index: foreign_singleton.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/foreign_singleton.m,v
retrieving revision 1.1
diff -u -u -r1.1 foreign_singleton.m
--- foreign_singleton.m	1 Jun 2002 13:34:43 -0000	1.1
+++ foreign_singleton.m	2 Jun 2002 07:09:47 -0000
@@ -18,7 +18,7 @@
 
 :- pred f(int::out, io::di, io::uo) is det.
 
-:- pragma foreign_proc("C", f(X::out, _IO0::di, _IO::uo),
+:- pragma foreign_proc("C", f(X::out, IO0::di, _IO::uo),
         [will_not_call_mercury, promise_pure], "
     X = 5;
 ").
@@ -29,7 +29,7 @@
 
 g(X) --> [].
 
-:- pragma foreign_proc("C", g(X::out, _IO0::di, _IO::uo),
+:- pragma foreign_proc("C", g(X::out, IO0::di, _IO::uo),
         [will_not_call_mercury, promise_pure], "
     X = 5;
 ").
--------------------------------------------------------------------------
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