[m-rev.] diff: fix another bug in smart recompilation

Simon Taylor stayl at cs.mu.OZ.AU
Mon Nov 5 03:05:05 AEDT 2001



Estimated hours taken: 0.5

Fix a bug in smart recompilation which caused some interface
files to be updated even if the source file was only `touch'ed.

compiler/recompilation_version.m:
	Ignore the determinism on a predicate declaration
	when checking whether it has changed. recompilation_version.m
	splits combined predicate and mode declarations before checking
	whether the predicate's declarations have changed. The problem
	only occurred if a predicate with a separate mode declaration
	also had a determinism annotation on the `:- pred' declaration.

compiler/mercury_to_mercury.m:
	Remove the `is det' from the `:- pred' declaration
	for mercury_output_pragma_unused_args.

tests/recompilation/TESTS:
tests/recompilation/unchanged_pred_nr*:
	Test case.

Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.195
diff -u -u -r1.195 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	24 Oct 2001 13:34:23 -0000	1.195
+++ compiler/mercury_to_mercury.m	4 Nov 2001 14:59:19 -0000
@@ -156,7 +156,7 @@
 :- mode mercury_output_pragma_type_spec(in(type_spec), in, di, uo) is det.
 
 :- pred mercury_output_pragma_unused_args(pred_or_func, sym_name,
-		int, mode_num, list(int), io__state, io__state) is det.
+		int, mode_num, list(int), io__state, io__state).
 :- mode mercury_output_pragma_unused_args(in, in, in, in, in, di, uo) is det.
 
 	% Write an Aditi index specifier.
Index: compiler/recompilation_version.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_version.m,v
retrieving revision 1.6
diff -u -u -r1.6 recompilation_version.m
--- compiler/recompilation_version.m	27 Oct 2001 07:48:32 -0000	1.6
+++ compiler/recompilation_version.m	4 Nov 2001 16:01:07 -0000
@@ -564,11 +564,15 @@
 		( Item2 = nothing(A) -> yes ; no ).
 
 item_is_unchanged(Item1, Item2) = Result :-
+	% Ignore the determinism -- the modes and determinism should
+	% have been split into a separate declaration. This case
+	% can only happen if this was not a combined predicate and
+	% mode declaration. XXX We should warn about this somewhere. 
 	Item1 = pred_or_func(TVarSet1, _, ExistQVars1, PredOrFunc,
-		Name, TypesAndModes1, Detism, Cond, Purity, Constraints1),
+		Name, TypesAndModes1, _Det1, Cond, Purity, Constraints1),
 	(
 		Item2 = pred_or_func(TVarSet2, _, ExistQVars2,
-			PredOrFunc, Name, TypesAndModes2, Detism, Cond, Purity,
+			PredOrFunc, Name, TypesAndModes2, _Det2, Cond, Purity,
 			Constraints2),
 		pred_or_func_type_is_unchanged(TVarSet1, ExistQVars1,
 			TypesAndModes1, Constraints1, TVarSet2,
Index: tests/recompilation/TESTS
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/TESTS,v
retrieving revision 1.6
diff -u -u -r1.6 TESTS
--- tests/recompilation/TESTS	4 Nov 2001 14:42:59 -0000	1.6
+++ tests/recompilation/TESTS	4 Nov 2001 14:45:48 -0000
@@ -22,7 +22,8 @@
 	pred_ctor_ambiguity_r \
 	pred_overloading_r \
 	typeclass_method_pragma_r \
-	type_spec_rename_var_r"
+	type_spec_rename_var_r \
+	unchanged_pred_nr"
 
 # Parallel mmake with nested sub-modules is broken.
 # The commands to create `.c' files from the `.m' file containing the
Index: tests/recompilation/unchanged_pred_nr.err_exp.2
===================================================================
RCS file: tests/recompilation/unchanged_pred_nr.err_exp.2
diff -N tests/recompilation/unchanged_pred_nr.err_exp.2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/recompilation/unchanged_pred_nr.err_exp.2	4 Nov 2001 14:52:36 -0000
@@ -0,0 +1,2 @@
+Recompiling module `unchanged_pred_nr':
+  file `unchanged_pred_nr.used' not found.
Index: tests/recompilation/unchanged_pred_nr.exp.1
===================================================================
RCS file: tests/recompilation/unchanged_pred_nr.exp.1
diff -N tests/recompilation/unchanged_pred_nr.exp.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/recompilation/unchanged_pred_nr.exp.1	4 Nov 2001 14:52:31 -0000
@@ -0,0 +1 @@
+OK
Index: tests/recompilation/unchanged_pred_nr.exp.2
===================================================================
RCS file: tests/recompilation/unchanged_pred_nr.exp.2
diff -N tests/recompilation/unchanged_pred_nr.exp.2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/recompilation/unchanged_pred_nr.exp.2	4 Nov 2001 14:52:36 -0000
@@ -0,0 +1 @@
+OK
Index: tests/recompilation/unchanged_pred_nr.m.1
===================================================================
RCS file: tests/recompilation/unchanged_pred_nr.m.1
diff -N tests/recompilation/unchanged_pred_nr.m.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/recompilation/unchanged_pred_nr.m.1	4 Nov 2001 14:51:30 -0000
@@ -0,0 +1,16 @@
+:- module unchanged_pred_nr.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io__state::di, io__state::uo) is det.
+
+:- implementation.
+
+:- import_module unchanged_pred_nr_2.
+
+main -->
+	{ unchanged_pred("OK\n", Str) },
+	io__write_string(Str).
+
Index: tests/recompilation/unchanged_pred_nr_2.err_exp.2
===================================================================
RCS file: tests/recompilation/unchanged_pred_nr_2.err_exp.2
diff -N tests/recompilation/unchanged_pred_nr_2.err_exp.2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/recompilation/unchanged_pred_nr_2.err_exp.2	4 Nov 2001 14:52:36 -0000
@@ -0,0 +1,2 @@
+Recompiling module `unchanged_pred_nr_2':
+  file `unchanged_pred_nr_2.m' has changed.
Index: tests/recompilation/unchanged_pred_nr_2.m.1
===================================================================
RCS file: tests/recompilation/unchanged_pred_nr_2.m.1
diff -N tests/recompilation/unchanged_pred_nr_2.m.1
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/recompilation/unchanged_pred_nr_2.m.1	4 Nov 2001 14:51:47 -0000
@@ -0,0 +1,11 @@
+:- module unchanged_pred_nr_2.
+
+:- interface.
+
+:- pred unchanged_pred(string, string) is det.
+:- mode unchanged_pred(in, out) is det.
+
+:- implementation.
+
+unchanged_pred(X, X).
+
Index: tests/recompilation/unchanged_pred_nr_2.m.2
===================================================================
RCS file: tests/recompilation/unchanged_pred_nr_2.m.2
diff -N tests/recompilation/unchanged_pred_nr_2.m.2
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/recompilation/unchanged_pred_nr_2.m.2	4 Nov 2001 14:51:56 -0000
@@ -0,0 +1,11 @@
+:- module unchanged_pred_nr_2.
+
+:- interface.
+
+:- pred unchanged_pred(string, string) is det.
+:- mode unchanged_pred(in, out) is det.
+
+:- implementation.
+
+unchanged_pred(X, X).
+
--------------------------------------------------------------------------
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