[MLton] C99 runtime problems on Darwin
Stephen Weeks
MLton@mlton.org
Wed, 22 Dec 2004 15:20:28 -0800
> > gcc -std=c99 -O2 -Wall -I. -Iplatform -D_FILE_OFFSET_BITS=64 -fomit-frame-pointer -c -o Posix/Error.o Posix/Error.c
> > In file included from /usr/include/netdb.h:86,
> > from platform/darwin.h:3,
> > from platform.h:43,
> > from Posix/Error.c:5:
> > /usr/include/sys/socket.h:77: error: parse error before "sa_family_t"
>
> Try the attached patch.
It worked, after I made the same change in the C file spit out by
lookup-constant.fun.
It seems to me it would be an improvement to put the following three
#defines at the beginning of platform.h, rather than sprinkling them
through every C file.
#define _ISOC99_SOURCE
#define _POSIX_C_SOURCE 200112L
#define _BSD_SOURCE
I don't see what we gain by including subsets of these in some files.
I like to think of platform.h as specifying the platform that the rest
of the runtime expects. That way, we can make changes in one place
instead of a hundred (as we just had to do with the above patch).