diff: mercury_compile.m: fix unique modes error status bug

Fergus Henderson fjh at cs.mu.oz.au
Wed Dec 10 13:34:32 AEDT 1997


Fix a bug introduced during my recent change to unique mode analysis
(unique_modes.m) which made it do the same fixpoint analysis that
ordinary mode analysis (modes.m) does. 

compiler/mercury_compile.m:
	Update to reflect recent change to unique_modes.m:
	unique mode checking now returns the error status in
	the module_info, rather than in the io__state exit status.

tests/invalid/mostly_uniq1.err_exp:
tests/invalid/mostly_uniq2.err_exp:
tests/invalid/io_in_ite_cond.err_exp:
	Undo recent work-around (which didn't work anyway),
	since the bug it works around is now fixed.

Index: mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.63
diff -u -u -r1.63 mercury_compile.m
--- mercury_compile.m	1997/12/09 04:00:55	1.63
+++ mercury_compile.m	1997/12/10 02:24:27
@@ -1038,19 +1038,18 @@
 mercury_compile__check_unique_modes(HLDS0, Verbose, Stats, HLDS, FoundError) -->
 	maybe_write_string(Verbose,
 		"% Checking for backtracking over unique modes...\n"),
-	io__get_exit_status(OldStatus),
-	io__set_exit_status(0),
+	{ module_info_num_errors(HLDS0, NumErrors0) },
 	unique_modes__check_module(HLDS0, HLDS),
-	io__get_exit_status(NewStatus),
-	( { NewStatus \= 0 } ->
+	{ module_info_num_errors(HLDS, NumErrors) },
+	( { NumErrors \= NumErrors0 } ->
 		{ FoundError = yes },
 		maybe_write_string(Verbose,
-			"% Program contains unique mode error(s).\n")
+			"% Program contains unique mode error(s).\n"),
+		io__set_exit_status(1)
 	;
 		{ FoundError = no },
 		maybe_write_string(Verbose,
-			"% Program is unique-mode-correct.\n"),
-		io__set_exit_status(OldStatus)
+			"% Program is unique-mode-correct.\n")
 	),
 	maybe_report_stats(Stats).
 
Index: mostly_uniq1.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/mostly_uniq1.err_exp,v
retrieving revision 1.3
diff -u -r1.3 mostly_uniq1.err_exp
--- mostly_uniq1.err_exp	1997/12/02 14:07:55	1.3
+++ mostly_uniq1.err_exp	1997/12/10 02:28:53
@@ -2,3 +2,4 @@
 mostly_uniq1.m:018:   in argument 2 of call to predicate `io:write_int/3':
 mostly_uniq1.m:018:   mode error: variable `DCG_0' has instantiatedness `mostly_unique',
 mostly_uniq1.m:018:   expected instantiatedness was `unique'.
+For more information, try recompiling with `-E'.
Index: mostly_uniq2.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/mostly_uniq2.err_exp,v
retrieving revision 1.3
diff -u -r1.3 mostly_uniq2.err_exp
--- mostly_uniq2.err_exp	1997/12/02 14:07:57	1.3
+++ mostly_uniq2.err_exp	1997/12/10 02:28:54
@@ -2,3 +2,4 @@
 mostly_uniq2.m:012:   in argument 2 of call to predicate `io:write_int/3':
 mostly_uniq2.m:012:   mode error: variable `DCG_0' has instantiatedness `mostly_unique',
 mostly_uniq2.m:012:   expected instantiatedness was `unique'.
+For more information, try recompiling with `-E'.
Index: io_in_ite_cond.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/io_in_ite_cond.err_exp,v
retrieving revision 1.2
diff -u -r1.2 io_in_ite_cond.err_exp
--- io_in_ite_cond.err_exp	1997/12/02 14:07:52	1.2
+++ io_in_ite_cond.err_exp	1997/12/10 02:28:53
@@ -2,3 +2,4 @@
 io_in_ite_cond.m:016:   in argument 1 of call to predicate `io_in_ite_cond:foo/2':
 io_in_ite_cond.m:016:   mode error: variable `DCG_0' has instantiatedness `mostly_unique',
 io_in_ite_cond.m:016:   expected instantiatedness was `unique'.
+For more information, try recompiling with `-E'.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list