[m-rev.] diff: CLP(R) vs lcc

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 7 16:38:30 AEDT 2002


Estimated hours taken: 3
Branches: main

extras/clpr/cfloat.m:
	Ensure that we #error if __GNUC__ is not defined,
	because it doesn't work for non-GCC C compilers,
	and #error is a lot easier to debug than a seg fault.

tools/test_mercury:
	Disable the CLP(R) tests for non-GCC C compilers.

Workspace: /home/mars/fjh/ws1/mercury
Index: extras/clpr/cfloat.m
===================================================================
RCS file: /home/mercury1/repository/clpr/cfloat.m,v
retrieving revision 1.34
diff -u -d -r1.34 cfloat.m
--- extras/clpr/cfloat.m	12 Sep 2002 11:35:48 -0000	1.34
+++ extras/clpr/cfloat.m	5 Nov 2002 09:05:05 -0000
@@ -883,7 +883,18 @@
 /*
 INIT init_cfloat_module
 */
-void init_cfloat_module(void) __attribute__((constructor)); /* XXX gcc-ism */
+/*
+** We need to ensure that CLP(R) engine gets initialized.
+** But we can't rely on the special INIT comment above,
+** since initialization functions registered using that mechanism
+** only get called in certain grades.
+** So we use GCC's `constructor' attribute.
+*/
+#ifdef __GNUC__
+  void init_cfloat_module(void) __attribute__((constructor)); /* XXX gcc-ism */
+#else
+  #error The CLP(R) interface requires GNU C
+#endif
 void init_cfloat_module(void) {
 	CLPR_init();
 }
Index: tools/test_mercury
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/test_mercury,v
retrieving revision 1.215
diff -u -d -r1.215 test_mercury
--- tools/test_mercury	28 Oct 2002 08:55:20 -0000	1.215
+++ tools/test_mercury	5 Nov 2002 14:02:46 -0000
@@ -702,17 +702,21 @@
 
 #-----------------------------------------------------------------------------#
 
-: test and install the CLPR interface
-# CLPR requires trailing, so here we only test the trailing grades.
 GRADES="`(cd $DIR/mercury && mmake echo_libgrades)`"
 case $HOST in
    hg)
    	GRADES="$GRADES asm_fast.par.gc"
 	;;
 esac
-for grade in $GRADES
-do
-	case "$grade" in *.tr*)
+
+: test and install the CLPR interface
+# CLPR requires trailing, so here we only test the trailing grades.
+# XXX The CLPR interface currently also requires GCC (see the #error in
+# extras/clpr/cfloat.m), so we test it only if we're using GCC.
+case "$C_COMPILER" in
+    gcc)
+	for grade in $GRADES; do
+	    case "$grade" in *.tr*)
 		echo "test clpr stuff for grade $grade" 1>&2
 		{
 			echo "GRADE = $grade"
@@ -739,8 +743,13 @@
 			mmake realclean $PARALLEL MMAKEFLAGS=$PARALLEL) ||
 			    set_status "trailed_update tests"
 		;;
-	esac
-done
+	    esac
+	done
+	;;
+    *)
+	echo "not testing clpr, since the CLP(R) interface requires GCC"
+	;;
+esac
 
 #-----------------------------------------------------------------------------#
 

-- 
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