[m-rev.] diff: minor MSVC fixes

Peter Ross pro at missioncriticalit.com
Tue Sep 16 17:30:37 AEST 2008


Some minor fixes to get Mercury compiling out
of the box with MS Visual C version 6.0.

configure.in:
	Check for __int64 as providing a 64 bit integer
	when using MSVC.  Note we still first check,
	int, long and long long.

trace/mercury_event_scanner.l:
	Under windows we don't have unistd.h so include
	mercury_conf.h to check for the availability of
	unistd.h and then use that to define YY_NO_UNISTD_H.

	

Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.524
diff -u -r1.524 configure.in
--- configure.in	27 Aug 2008 01:08:04 -0000	1.524
+++ configure.in	16 Sep 2008 07:22:19 -0000
@@ -1569,6 +1569,15 @@
             exit(0);
         }
 
+    /* Check for __int64 when using MSVC */
+    #ifdef _MSCVER
+        if (sizeof(__int64) * CHAR_BIT >= 64)
+        {
+            fprintf(fp, "__int64\n");
+            exit(0);
+        }
+    #endif
+
         fprintf(fp, "unknown\n");
         exit(1);
     }],
Index: trace/mercury_event_scanner.l
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_event_scanner.l,v
retrieving revision 1.4
diff -u -r1.4 mercury_event_scanner.l
--- trace/mercury_event_scanner.l	1 May 2007 06:31:26 -0000	1.4
+++ trace/mercury_event_scanner.l	16 Sep 2008 07:22:25 -0000
@@ -29,6 +29,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include "mercury_conf.h"		/* for MR_HAVE_UNISTD_H */
 #include "mercury_misc.h"               /* for MR_fatal_error */
 #include "mercury_trace_term.h"         /* for MR_Cterm etc */
 
@@ -36,6 +37,11 @@
 #include "mercury_event_spec_missing.h"
 #include "mercury_event_parser.h"
 
+#ifndef MR_HAVE_UNISTD_H
+#define YY_NO_UNISTD_H
+#endif
+
+
 /*
 ** We should #include mercury_event_scanner.h as well, but flex puts into the
 ** header file it creates a #undef for a macro it needs, so #including
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list