[m-dev.] trivial diff: Minor fix for FreeBSD

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Jul 27 19:33:31 AEST 1998


On 27-Jul-1998, Andrew Bromage <bromage at cs.mu.OZ.AU> wrote:
> 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() */

I don't understand -- mercury_imp.h has already been included before
<stdio.h> and <unistd.h>, so the global registers should already have
been declared.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list