MR_warning()

Warwick Harvey wharvey at cs.monash.edu.au
Wed Aug 12 17:00:45 AEST 1998


Hi,

I had added an MR_warning() function (as per fjh's suggestion) for my 
changes to fix the MERCURY_OPTIONS problem, but since Zoltan's 
MERCURY_OPTIONS fix superseded mine before it was committed, this function 
is no longer necessary.  Still, it might be useful, so I ask if anybody 
thinks I should still commit (this part of) the change.

I also noted in an earlier post that fatal_error() did not accept a variable 
number of arguments, and offered to "fix" this too, but nobody commented, so 
I haven't done this (but will if somebody wants me to).


Estimated hours taken: 0.5

runtime/mercury_misc.[ch]:
	Added a function MR_warning(), to provide a standard way for the
	Mercury runtime to issue a (non-fatal) warning.


Index: runtime/mercury_misc.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_misc.c,v
retrieving revision 1.10
diff -u -r1.10 mercury_misc.c
--- mercury_misc.c	1998/07/29 08:55:59	1.10
+++ mercury_misc.c	1998/08/12 06:44:45
@@ -12,6 +12,7 @@
 #include	"mercury_misc.h"
 
 #include	<stdio.h>
+#include	<stdarg.h>
 
 /*--------------------------------------------------------------------*/
 
@@ -456,6 +457,18 @@
 	}
 
 	return p;
+}
+
+void
+MR_warning(const char *msg, ...)
+{
+	va_list args;
+
+	fprintf(stderr, "Mercury runtime: ");
+	va_start(args, msg);
+	vfprintf(stderr, msg, args);
+	va_end(args);
+	fprintf(stderr, "\n");
 }
 
 /*
Index: runtime/mercury_misc.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_misc.h,v
retrieving revision 1.8
diff -u -r1.8 mercury_misc.h
--- mercury_misc.h	1998/07/29 08:56:01	1.8
+++ mercury_misc.h	1998/08/12 06:44:45
@@ -59,6 +59,7 @@
 #else
 	#define NO_RETURN
 #endif
+extern	void	MR_warning(const char *msg, ...);
 extern	void	fatal_error(const char *msg) NO_RETURN;
 
 /*





More information about the developers mailing list