[m-rev.] for review: get tests/invalid working in the il grade

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Nov 8 13:15:09 AEDT 2002


Estimated hours taken: 0.75
Branches: main

A few fixes to petdr's recent changes to fix test case failures for the IL
grade.

tests/invalid/purity/Mmakefile:
tests/invalid/purity/Mercury.options:
	Put --no-automatic-intermodule-optimization in MCFLAGS
	rather than in MCFLAGS-*, to be consistent with what we do
	for --no-intermodule-optimization.

tests/valid/two_pragma_c_codes.m:
	Fix a compilation error for non-IL grades:
	add a `pragma promise_pure' for a
	procedure defined with both C code and clauses.

tests/invalid/Mmakefile:
tests/invalid/purity/pragma_c_and_mercury.m:
tests/invalid/purity/pragma_c_and_mercury.err_exp:
	Add a test to check that we detect an error in the case mentioned
	above.	Currently the test is disabled, since we don't pass it
	in IL or Java grades.

Workspace: /home/ceres/fjh/mercury
Index: tests/invalid/purity/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/Mercury.options,v
retrieving revision 1.2
diff -u -d -r1.2 Mercury.options
--- tests/invalid/purity/Mercury.options	7 Nov 2002 16:17:09 -0000	1.2
+++ tests/invalid/purity/Mercury.options	8 Nov 2002 01:23:18 -0000
@@ -1,20 +0,0 @@
-MCFLAGS-impure_func_t2		= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
-MCFLAGS-impure_func_t3		= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
-MCFLAGS-impure_func_t4		= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
-MCFLAGS-impure_func_t5		= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
-MCFLAGS-impure_func_t7		= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
-MCFLAGS-impure_pred_t1		= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
-MCFLAGS-impure_pred_t2		= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
-MCFLAGS-purity			= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
-MCFLAGS-purity_nonsense		= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
-MCFLAGS-purity_type_error	= --no-intermodule-optimization \
-				--no-automatic-intermodule-optimization
Index: tests/invalid/purity/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/purity/Mmakefile,v
retrieving revision 1.5
diff -u -d -r1.5 Mmakefile
--- tests/invalid/purity/Mmakefile	26 Aug 2002 03:34:30 -0000	1.5
+++ tests/invalid/purity/Mmakefile	8 Nov 2002 01:41:40 -0000
@@ -14,6 +14,9 @@
 	purity_nonsense \
 	purity_type_error
 
+# XXX the pragma_c_and_mercury test is not enabled, 
+#     since currently we fail it in grades `il' and `java'
+
 TESTS=$(PROGS)
 SUBDIRS=
 TESTS_DIR=../..
@@ -23,7 +26,8 @@
 # because the errors get detected when creating the `.opt' file rather
 # than when compiling the main module.  So we disable intermodule optimization
 # for these tests.
-override EXTRA_MCFLAGS += --no-intermodule-optimization
+override EXTRA_MCFLAGS += \
+	--no-intermodule-optimization --no-automatic-intermodule-optimization
 
 # Module-specific options should go in Mercury.options so they
 # can be found by `mmc --make'.
Index: tests/invalid/purity/pragma_c_and_mercury.err_exp
===================================================================
RCS file: tests/invalid/purity/pragma_c_and_mercury.err_exp
diff -N tests/invalid/purity/pragma_c_and_mercury.err_exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/purity/pragma_c_and_mercury.err_exp	8 Nov 2002 01:35:03 -0000
@@ -0,0 +1,4 @@
+pragma_c_and_mercury.m:010: In predicate `pragma_c_and_mercury:c_int_unify/2':
+pragma_c_and_mercury.m:010:   purity error: predicate is impure.
+pragma_c_and_mercury.m:010:   It must be declared `impure' or promised pure.
+For more information, try recompiling with `-E'.
Index: tests/invalid/purity/pragma_c_and_mercury.m
===================================================================
RCS file: tests/invalid/purity/pragma_c_and_mercury.m
diff -N tests/invalid/purity/pragma_c_and_mercury.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/invalid/purity/pragma_c_and_mercury.m	8 Nov 2002 01:33:58 -0000
@@ -0,0 +1,23 @@
+% A test that we report an error for procedures defined with both
+% c_code and Mercury clauses, but without `pragma promise_pure'.
+
+% At the time of writing, we fail this test in IL and Java grades.
+
+:- module pragma_c_and_mercury.
+
+:- interface.
+
+:- pred c_int_unify(int, int).
+
+
+:- implementation.
+
+:- mode c_int_unify(in, out) is det.
+
+:- mode c_int_unify(out, in) is det.
+
+:- pragma(c_code, c_int_unify(Int0::in, Int::out), "Int = Int0;").
+
+:- pragma(c_code, c_int_unify(Int::out, Int0::in), "Int = Int0;").
+
+c_int_unify(X, X).
Index: tests/valid/two_pragma_c_codes.m
===================================================================
RCS file: /home/mercury1/repository/tests/valid/two_pragma_c_codes.m,v
retrieving revision 1.2
diff -u -d -r1.2 two_pragma_c_codes.m
--- tests/valid/two_pragma_c_codes.m	7 Nov 2002 12:52:59 -0000	1.2
+++ tests/valid/two_pragma_c_codes.m	8 Nov 2002 01:03:16 -0000
@@ -14,6 +14,8 @@
 
 :- mode c_int_unify(out, in) is det.
 
+:- pragma promise_pure(c_int_unify/2).
+
 :- pragma(c_code, c_int_unify(Int0::in, Int::out), "Int = Int0;").
 
 :- pragma(c_code, c_int_unify(Int::out, Int0::in), "Int = Int0;").
-- 
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