[m-dev.] for review: add foreign_code tests to configure.in

Tyson Dowd trd at cs.mu.OZ.AU
Sat Jan 20 15:53:41 AEDT 2001


Hi,

This one will go on both branches -- in time we should change the latest
branch to look for foreign_proc instead.

===================================================================


Estimated hours taken: 0.5

configure.in:
	Add a configuration test for :- pragma foreign_code.
	The library uses foreign_code so we must be able to handle it to
	bootstrap.


Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.242
diff -u -r1.242 configure.in
--- configure.in	2001/01/19 04:04:17	1.242
+++ configure.in	2001/01/20 04:32:27
@@ -85,25 +85,25 @@
 		:- import_module io.
 		:- pred main(io__state::di, io__state::uo) is det.
 
-		% Check that the compiler doesn't give
-		% "determinism declaration could be tighter"
-		% warnings for type class method implementations.
-		% They will usually be spurious.
-		% The library now contains code which would
-		% trigger this spurious warning.
-		:- typeclass my_enum(T) where [[
-			func my_from_int(int) = T is semidet
-		]].
-		:- instance my_enum(int) where [[
-			my_from_int(X) = X
-		]].
-
 		:- implementation.
+	
+		% Check that we can declare foreign_code for C and MC++.
+		:- pred foo(int::out) is det.
+		:- pragma foreign_code("C",    foo(X::out),
+			[[will_not_call_mercury, thread_safe]],
+			" X = 42; ").
+		:- pragma foreign_code("MC++", foo(X::out),
+			[[will_not_call_mercury, thread_safe]],
+			" X = 42; ").
 
 		% Currently we test that mmc accepts the
 		% --fixed-user-guided-type-specialization flag.
 		main --> 
-			print("Hello, world\n").
+			( { foo(42) } ->
+				print("Hello, world\n")
+			;
+				print("Nope.\n")
+			).
 EOF
 	if
 	 	 echo $BOOTSTRAP_MC conftest >&AC_FD_CC 2>&1 &&


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list