[m-rev.] diff: fix tests/warnings for grades java and il
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Feb 20 15:18:08 AEDT 2004
Estimated hours taken: 0.5
Branches: main
Get tests/warnings to pass in grades java and il.
tests/warnings/foreign_term_invalid.m:
Add Java and C# "pragma foreign_proc" clauses.
tests/warnings/purity_warnings.m:
tests/warnings/singleton_test.m:
Add Java "pragma foreign_proc" clauses.
tests/warnings/singleton_test.exp*:
Adjust line numbers to reflect the above changes to the source,
and also add a new .exp3 file containing the expected warnings
for grade java.
Workspace: /home/jupiter/fjh/ws-jupiter/mercury
Index: tests/warnings/foreign_term_invalid.m
===================================================================
RCS file: /home/mercury1/repository/tests/warnings/foreign_term_invalid.m,v
retrieving revision 1.1
diff -u -d -r1.1 foreign_term_invalid.m
--- tests/warnings/foreign_term_invalid.m 12 Feb 2004 03:36:17 -0000 1.1
+++ tests/warnings/foreign_term_invalid.m 20 Feb 2004 04:02:53 -0000
@@ -16,11 +16,27 @@
[will_not_call_mercury, promise_pure, thread_safe, terminates], "
X = (MR_Integer) 3;
").
+:- pragma foreign_proc("C#", test1(X::out),
+ [will_not_call_mercury, promise_pure, thread_safe, terminates], "
+ X = 3;
+").
+:- pragma foreign_proc("Java", test1(X::out),
+ [will_not_call_mercury, promise_pure, thread_safe, terminates], "
+ X = 3;
+").
:- pragma terminates(test2/1).
:- pragma foreign_proc("C", test2(X::out),
[may_call_mercury, promise_pure, thread_safe, does_not_terminate], "
X = (MR_Integer) 3;
+").
+:- pragma foreign_proc("C#", test2(X::out),
+ [may_call_mercury, promise_pure, thread_safe, does_not_terminate], "
+ X = 3;
+").
+:- pragma foreign_proc("Java", test2(X::out),
+ [may_call_mercury, promise_pure, thread_safe, does_not_terminate], "
+ X = 3;
").
:- end_module foreign_term_invalid.
Index: tests/warnings/purity_warnings.m
===================================================================
RCS file: /home/mercury1/repository/tests/warnings/purity_warnings.m,v
retrieving revision 1.1
diff -u -d -r1.1 purity_warnings.m
--- tests/warnings/purity_warnings.m 22 Jan 2003 13:44:47 -0000 1.1
+++ tests/warnings/purity_warnings.m 20 Feb 2004 04:06:54 -0000
@@ -75,16 +75,22 @@
:- pragma foreign_code("C#", "
static int x = 0;
").
+:- pragma foreign_code("Java", "
+static int x = 0;
+").
:- impure pred set_x(int::in) is det.
:- pragma c_code(set_x(X::in), will_not_call_mercury, "x=X;" ).
:- pragma foreign_proc("C#", set_x(X::in), will_not_call_mercury, "x=X;" ).
+:- pragma foreign_proc("Java", set_x(X::in), will_not_call_mercury, "x=X;" ).
:- impure pred incr_x is det.
:- pragma c_code(incr_x, will_not_call_mercury, "++x;" ).
:- pragma foreign_proc("C#", incr_x, will_not_call_mercury, "++x;" ).
+:- pragma foreign_proc("Java", incr_x, will_not_call_mercury, "++x;" ).
:- semipure pred get_x(int::out) is det.
:- pragma promise_semipure(get_x/1).
:- pragma c_code(get_x(X::out), will_not_call_mercury, "X=x;").
:- pragma foreign_proc("C#", get_x(X::out), will_not_call_mercury, "X=x;").
+:- pragma foreign_proc("Java", get_x(X::out), will_not_call_mercury, "X=x;").
Index: tests/warnings/singleton_test.exp
===================================================================
RCS file: /home/mercury1/repository/tests/warnings/singleton_test.exp,v
retrieving revision 1.9
diff -u -d -r1.9 singleton_test.exp
--- tests/warnings/singleton_test.exp 27 Oct 2003 05:23:36 -0000 1.9
+++ tests/warnings/singleton_test.exp 20 Feb 2004 04:12:25 -0000
@@ -6,10 +6,10 @@
singleton_test.m:027: warning: variable `T' occurs only once in this scope.
singleton_test.m:029: In the C code for predicate `singleton_test.my_c_pred/3':
singleton_test.m:029: warning: variable `Y' does not occur in the C code.
-singleton_test.m:037: In the C code for function `singleton_test.my_c_func/2':
-singleton_test.m:037: warning: variable `X' does not occur in the C code.
-singleton_test.m:047: In the C code for predicate `singleton_test.c_hello_world/3':
-singleton_test.m:047: warning: variable `Msg' does not occur in the C code.
+singleton_test.m:041: In the C code for function `singleton_test.my_c_func/2':
+singleton_test.m:041: warning: variable `X' does not occur in the C code.
+singleton_test.m:055: In the C code for predicate `singleton_test.c_hello_world/3':
+singleton_test.m:055: warning: variable `Msg' does not occur in the C code.
singleton_test.m:008: In function `singleton_test.my_append_func/2':
singleton_test.m:008: warning: unresolved polymorphism.
singleton_test.m:008: The variables with unbound types were:
Index: tests/warnings/singleton_test.exp2
===================================================================
RCS file: /home/mercury1/repository/tests/warnings/singleton_test.exp2,v
retrieving revision 1.1
diff -u -d -r1.1 singleton_test.exp2
--- tests/warnings/singleton_test.exp2 26 Oct 2003 12:43:34 -0000 1.1
+++ tests/warnings/singleton_test.exp2 20 Feb 2004 04:11:49 -0000
@@ -6,10 +6,10 @@
singleton_test.m:027: warning: variable `T' occurs only once in this scope.
singleton_test.m:032: In the C# code for predicate `singleton_test.my_c_pred/3':
singleton_test.m:032: warning: variable `Y' does not occur in the C# code.
-singleton_test.m:040: In the C# code for function `singleton_test.my_c_func/2':
-singleton_test.m:040: warning: variable `X' does not occur in the C# code.
-singleton_test.m:052: In the C# code for predicate `singleton_test.c_hello_world/3':
-singleton_test.m:052: warning: variable `Msg' does not occur in the C# code.
+singleton_test.m:044: In the C# code for function `singleton_test.my_c_func/2':
+singleton_test.m:044: warning: variable `X' does not occur in the C# code.
+singleton_test.m:060: In the C# code for predicate `singleton_test.c_hello_world/3':
+singleton_test.m:060: warning: variable `Msg' does not occur in the C# code.
singleton_test.m:008: In function `singleton_test.my_append_func/2':
singleton_test.m:008: warning: unresolved polymorphism.
singleton_test.m:008: The variables with unbound types were:
Index: tests/warnings/singleton_test.exp3
===================================================================
RCS file: tests/warnings/singleton_test.exp3
diff -N tests/warnings/singleton_test.exp3
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/warnings/singleton_test.exp3 20 Feb 2004 04:10:23 -0000
@@ -0,0 +1,19 @@
+singleton_test.m:022: In clause for predicate `singleton_test.my_append/3':
+singleton_test.m:022: warning: variable `L2' occurs only once in this scope.
+singleton_test.m:026: In clause for function `singleton_test.my_append_func/2':
+singleton_test.m:026: warning: variables `L1, L2' occur only once in this scope.
+singleton_test.m:027: In clause for function `singleton_test.my_append_func/2':
+singleton_test.m:027: warning: variable `T' occurs only once in this scope.
+singleton_test.m:036: In the Java code for predicate `singleton_test.my_c_pred/3':
+singleton_test.m:036: warning: variable `Y' does not occur in the Java code.
+singleton_test.m:048: In the Java code for function `singleton_test.my_c_func/2':
+singleton_test.m:048: warning: variable `X' does not occur in the Java code.
+singleton_test.m:065: In the Java code for predicate `singleton_test.c_hello_world/3':
+singleton_test.m:065: warning: variable `Msg' does not occur in the Java code.
+singleton_test.m:008: In function `singleton_test.my_append_func/2':
+singleton_test.m:008: warning: unresolved polymorphism.
+singleton_test.m:008: The variables with unbound types were:
+singleton_test.m:008: L2: V_1
+singleton_test.m:008: L1: V_1
+singleton_test.m:008: The unbound type variable(s) will be implicitly
+singleton_test.m:008: bound to the builtin type `void'.
Index: tests/warnings/singleton_test.m
===================================================================
RCS file: /home/mercury1/repository/tests/warnings/singleton_test.m,v
retrieving revision 1.6
diff -u -d -r1.6 singleton_test.m
--- tests/warnings/singleton_test.m 26 Oct 2003 12:43:34 -0000 1.6
+++ tests/warnings/singleton_test.m 20 Feb 2004 04:09:41 -0000
@@ -33,6 +33,10 @@
[promise_pure, will_not_call_mercury], "
Z = 2 * X;
").
+:- pragma foreign_proc("Java", my_c_pred(X::in, Y::in, Z::out),
+ [promise_pure, will_not_call_mercury], "
+ Z = 2 * X;
+").
:- pragma c_code(my_c_func(X::in, Y::in) = (Z::out), will_not_call_mercury, "
Z = 2 * Y;
@@ -41,6 +45,10 @@
[promise_pure, will_not_call_mercury], "
Z = 2 * Y;
").
+:- pragma foreign_proc("Java", my_c_func(X::in, Y::in) = (Z::out),
+ [promise_pure, will_not_call_mercury], "
+ Z = 2 * Y;
+").
:- pragma c_header_code("#include <stdio.h>").
@@ -52,5 +60,10 @@
:- pragma foreign_proc("C#", c_hello_world(Msg::in, IO0::di, IO::uo),
[promise_pure, will_not_call_mercury], "
System.Console.WriteLine(""Hello, world"");
+ IO = IO0;
+").
+:- pragma foreign_proc("Java", c_hello_world(Msg::in, IO0::di, IO::uo),
+ [promise_pure, will_not_call_mercury], "
+ System.out.println(""Hello, world"");
IO = IO0;
").
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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