trivial diff: Minor fix for FreeBSD

Andrew Bromage bromage at cs.mu.OZ.AU
Mon Jul 27 13:10:10 AEST 1998


G'day all.

This didn't seem to be posted last time (though I did get some mail from
owner-mercury-developers telling me about some weird error...), so here
goes again.

Cheers,
Andrew Bromage

Estimated hours taken: 0.1

Minor fix to make Mercury compile under FreeBSD.

runtime/mercury_context.c:
	Include stdio.h after mercury_context.h.

Index: runtime/mercury_context.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_context.c,v
retrieving revision 1.7
diff -u -r1.7 mercury_context.c
--- mercury_context.c   1998/07/13 22:44:03     1.7
+++ mercury_context.c   1998/07/27 02:09:50
@@ -12,8 +12,6 @@
 
 #include "mercury_imp.h"
 
-#include <stdio.h>
-#include <unistd.h>            /* for getpid() and fork() */
 #ifdef MR_THREAD_SAFE
   #include "mercury_thread.h"
 #endif
@@ -21,6 +19,16 @@
 #include "mercury_memory_handlers.h"
 #include "mercury_context.h"
 #include "mercury_engine.h"    /* for `memdebug' */
+
+/*
+** stdio.h must be included _after_ mercury_context.h because of an
+** incompatibility with FreeBSD (2.2.x).  FreeBSD defines an inline
+** function in stdio.h, so it cannot be included until after global
+** registers have been declared, otherwise GCC complains.
+*/
+
+#include <stdio.h>
+#include <unistd.h>            /* for getpid() and fork() */
 
 MR_Context     *MR_runqueue;
 #ifdef MR_THREAD_SAFE



More information about the developers mailing list