[m-rev.] for review: bootstrap with MSVC as C compiler.

Peter Ross pro at missioncriticalit.com
Wed Oct 23 19:58:25 AEST 2002


Hi,

For fjh to review.

The solution for mercury_trace_source.c is hacky, but I am unable
to work out how you check for the existence of Sleep (which requires the
windows.h header file to be included) in configure.  If you could inform
me how to do that I will add it to configure and then change the logic to
suit.

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


Estimated hours taken: 4
Branches: main

Bootstrap the main branch using the MS Visual C compiler.

configure.in:
	Check for the _snprintf and sleep functions.

runtime/mercury_conf.h.in:
	Add #defines for the _snprintf and sleep functions.

boehm_gc/Mmakefile:
	Compile the collector with debugging turned off so that when linking
	the debugger with the compiler you don't get duplicate definitions
	for the C std lib symbols (the debug versions and the release
	versions).

runtime/mercury_stack_trace.c:
trace/mercury_trace_internal.c:
trace/mercury_trace_spy.c:
	Use _snprintf if snprintf doesn't exist.

trace/mercury_trace.c:
	Report an error if we attempt to use the external debugger when it's
	not enabled.

trace/mercury_trace_source.c:
	Use the correct version of sleep for the environment that we are
	compiling in.

Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.331
diff -u -r1.331 configure.in
--- configure.in	23 Oct 2002 04:48:25 -0000	1.331
+++ configure.in	23 Oct 2002 09:41:54 -0000
@@ -489,11 +489,11 @@
 		sysconf getpagesize gethostname \
 		mprotect memalign memmove \
 		sigaction siginterrupt setitimer \
-		snprintf vsnprintf _vsnprintf strerror \
+		snprintf _snprintf vsnprintf _vsnprintf strerror \
 		open close dup dup2 fdopen fileno fstat stat isatty \
 		getpid setpgid fork execlp wait kill \
 		grantpt unlockpt ptsname tcgetattr tcsetattr ioctl \
-		access
+		access sleep
 
 #-----------------------------------------------------------------------------#
 MERCURY_CHECK_FOR_HEADERS( \
Index: boehm_gc/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Mmakefile,v
retrieving revision 1.22
diff -u -r1.22 Mmakefile
--- boehm_gc/Mmakefile	22 Oct 2002 14:55:17 -0000	1.22
+++ boehm_gc/Mmakefile	23 Oct 2002 09:41:54 -0000
@@ -42,7 +42,7 @@
 
 submake: force
 	MAKEFLAGS=""; export MAKEFLAGS; \
-	nmake -f NT_MAKEFILE gc.lib; \
+	nmake -f NT_MAKEFILE nodebug=1 gc.lib; \
 	cp gc.lib libgc.lib 
 
 clean_local:
Index: runtime/mercury_conf.h.in
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_conf.h.in,v
retrieving revision 1.45
diff -u -r1.45 mercury_conf.h.in
--- runtime/mercury_conf.h.in	16 Oct 2002 05:45:24 -0000	1.45
+++ runtime/mercury_conf.h.in	23 Oct 2002 09:42:04 -0000
@@ -177,6 +177,7 @@
 **	MR_HAVE_KILL		we have the kill() function.
 ** 	MR_HAVE_GETHOSTNAME	we have the gethostname() function.
 **	MR_HAVE_SNPRINTF 	we have the snprintf() function.
+**	MR_HAVE__SNPRINTF 	we have the _snprintf() function.
 **	MR_HAVE_VSNPRINTF 	we have the vsnprintf() function.
 **	MR_HAVE__VSNPRINTF 	we have the _vsnprintf() function.
 **	MR_HAVE_SYSCONF     	we have the sysconf() system call.
@@ -211,6 +212,7 @@
 **	MR_HAVE_TCSETATTR	we have the tcsetattr() function.
 **	MR_HAVE_IOCTL		we have the ioctl() function.
 **	MR_HAVE_ACCESS		we have the access() function.
+**	MR_HAVE_SLEEP		we have the sleep() function.
 */
 #undef	MR_HAVE_GETPID
 #undef	MR_HAVE_SETPGID
@@ -220,6 +222,7 @@
 #undef	MR_HAVE_KILL
 #undef	MR_HAVE_GETHOSTNAME
 #undef	MR_HAVE_SNPRINTF
+#undef	MR_HAVE__SNPRINTF
 #undef	MR_HAVE_VSNPRINTF
 #undef	MR_HAVE__VSNPRINTF
 #undef	MR_HAVE_SYSCONF
@@ -251,6 +254,7 @@
 #undef	MR_HAVE_TCSETATTR
 #undef	MR_HAVE_IOCTL
 #undef	MR_HAVE_ACCESS
+#undef	MR_HAVE_SLEEP
 
 /*
 ** We use mprotect() and signals to catch stack and heap overflows.
Index: runtime/mercury_stack_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_stack_trace.c,v
retrieving revision 1.49
diff -u -r1.49 mercury_stack_trace.c
--- runtime/mercury_stack_trace.c	11 Sep 2002 07:20:27 -0000	1.49
+++ runtime/mercury_stack_trace.c	23 Oct 2002 09:42:04 -0000
@@ -21,6 +21,10 @@
 #include "mercury_trace_base.h"
 #include <stdio.h>
 
+#if defined(MR_HAVE__SNPRINTF) && ! defined(MR_HAVE_SNPRINTF)
+  #define snprintf	_snprintf
+#endif
+
 #ifndef MR_HIGHLEVEL_CODE
 
 static  const char  *MR_step_over_nondet_frame(FILE *fp,
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.56
diff -u -r1.56 mercury_trace.c
--- trace/mercury_trace.c	22 Oct 2002 12:50:30 -0000	1.56
+++ trace/mercury_trace.c	23 Oct 2002 09:42:06 -0000
@@ -174,7 +174,8 @@
 	switch (MR_trace_ctrl.MR_trace_cmd) {
 		case MR_CMD_COLLECT:
 		  {
+#ifdef MR_USE_EXTERNAL_DEBUGGER
			MR_Event_Info	event_info;
 			MR_Word		*saved_regs = event_info.MR_saved_regs;
 			int		max_r_num;
 			const char	*path;
@@ -211,6 +212,9 @@
 				return MR_trace_event(&MR_trace_ctrl, MR_TRUE,
                                                layout, port, seqno, depth);
 			}
+#else
+			MR_fatal_error("attempt to use external debugger");
+#endif
 
 			goto check_stop_print;
 		  }	
Index: trace/mercury_trace_internal.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_internal.c,v
retrieving revision 1.144
diff -u -r1.144 mercury_trace_internal.c
--- trace/mercury_trace_internal.c	22 Oct 2002 04:36:26 -0000	1.144
+++ trace/mercury_trace_internal.c	23 Oct 2002 09:42:07 -0000
@@ -85,6 +85,10 @@
 #define	MDBRC_FILENAME		".mdbrc"
 #define	DEFAULT_MDBRC_FILENAME	"mdbrc"
 
+#if defined(MR_HAVE__SNPRINTF) && ! defined(MR_HAVE_SNPRINTF)
+  #define snprintf	_snprintf
+#endif
+
 /*
 ** XXX We should consider whether all the static variables in this module
 ** should be thread local.
Index: trace/mercury_trace_source.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_source.c,v
retrieving revision 1.6
diff -u -r1.6 mercury_trace_source.c
--- trace/mercury_trace_source.c	18 Feb 2002 07:01:31 -0000	1.6
+++ trace/mercury_trace_source.c	23 Oct 2002 09:42:07 -0000
@@ -30,6 +30,10 @@
   #include <sys/types.h>	/* for getpid() */
 #endif
 
+#ifndef MR_HAVE_SLEEP
+#include <windows.h>
+#endif
+
 #define MR_DEFAULT_SOURCE_WINDOW_COMMAND	"xterm -e"
 #define MR_DEFAULT_SOURCE_SERVER_COMMAND	"vim"
 
@@ -338,7 +342,11 @@
 		/*
 		** XXX This is an inaccurate way of keeping time.
 		*/
+#ifdef MR_HAVE_SLEEP
 		sleep(1);
+#else
+		Sleep(1000);
+#endif
 
 		msg = MR_trace_source_check_server(real_server_cmd,
 				server->server_name, verbose);
Index: trace/mercury_trace_spy.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_spy.c,v
retrieving revision 1.20
diff -u -r1.20 mercury_trace_spy.c
--- trace/mercury_trace_spy.c	18 Feb 2002 07:01:31 -0000	1.20
+++ trace/mercury_trace_spy.c	23 Oct 2002 09:42:07 -0000
@@ -21,6 +21,13 @@
 
 #include <stdlib.h>
 
+#if defined(MR_HAVE__SNPRINTF) && ! defined(MR_HAVE_SNPRINTF)
+  #define snprintf	_snprintf
+#endif
+
+#if defined(MR_HAVE_SNPRINTF) || defined(MR_HAVE__SNPRINTF)
+  #define MR_HAVE_A_SNPRINTF
+#endif
 const char		*MR_spy_when_names[] =
 {
 	"all",
@@ -409,7 +416,7 @@
 
 	if (new_size == old_size) {
 		/* there were no matching labels */
-#ifdef	MR_HAVE_SNPRINTF
+#ifdef	MR_HAVE_A_SNPRINTF
 		snprintf(MR_error_msg_buf, MR_ERROR_MSG_BUF_SIZE,
 			"there is no event at %s:%d",
 			filename, linenumber);

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