[m-rev.] diff: domain checking for int__rem

Simon Taylor stayl at cs.mu.OZ.AU
Wed Nov 7 02:45:37 AEDT 2001


Estimated hours taken: 0.25
Branches: main

Finish off the change to throw exceptions for remainder by zero.

library/int.m:
	Uncomment the `:- pragma inline' for `rem/2'.

compiler/make_hlds.m:
        Re-enable `--halt-at-warn' for the warnings for clauses for builtins.

configure.in:
        Check for int__unchecked_rem/2 when checking whether the
	installed compiler is up-to-date.

Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.281
diff -u -u -r1.281 configure.in
--- configure.in	31 Oct 2001 17:53:19 -0000	1.281
+++ configure.in	6 Nov 2001 15:30:40 -0000
@@ -100,12 +100,11 @@
 		:- pred main(io__state::di, io__state::uo) is det.
 
 		:- implementation.
-		:- import_module list, std_util.
+		:- import_module int.
         
-		% Check that the functor for lists is "[[|]]/2"
-		% rather than "./2".
+		% Check for the builtin function int__unchecked_rem/2.
 		main --> 
-			( { functor([[1, 2]], "[[|]]", 2) } ->
+			( { int__unchecked_rem(3, 2) = 1 } ->
 				print("Hello, world\n")
 			;
 				print("Nope.\n")
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.389
diff -u -u -r1.389 make_hlds.m
--- compiler/make_hlds.m	6 Nov 2001 15:20:50 -0000	1.389
+++ compiler/make_hlds.m	6 Nov 2001 15:22:35 -0000
@@ -3693,10 +3693,7 @@
 		{ code_util__predinfo_is_builtin(PredInfo1) }
 	->
 		prog_out__write_context(Context),
-		% XXX Disabled while a change to add domain checking to
-		% `int__rem/2' is bootstrapped.
-		% report_warning("Warning: clause for builtin.\n"),
-		io__write_string("Warning: clause for builtin.\n"),
+		report_warning("Warning: clause for builtin.\n"),
 		{ ModuleInfo = ModuleInfo1 },
 		{ Info = Info0 }
 	;
Index: library/int.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/int.m,v
retrieving revision 1.79
diff -u -u -r1.79 int.m
--- library/int.m	3 Nov 2001 17:35:00 -0000	1.79
+++ library/int.m	6 Nov 2001 15:22:13 -0000
@@ -301,9 +301,7 @@
 		Div = unchecked_quotient(X, Y)
 	).
 
-% XXX uncomment this line when the change to make `rem' a non-builtin
-% is installed everywhere.
-%:- pragma inline(rem/2).
+:- pragma inline(rem/2).
 X rem Y = Rem :-
 	( domain_checks, Y = 0 ->
 		throw(math__domain_error("int:rem"))
--------------------------------------------------------------------------
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