[MLton] [PATCH] Review this patch and try it on other platforms, please (Kill runtime warnings)

Matthew Fluet fluet at tti-c.org
Sat Dec 1 22:10:20 PST 2007


On Mon, 26 Nov 2007, Jesper Louis Andersen wrote:
> The attached patch is a little something I toyed with over the
> weekend. The goal was
> to remove all warnings from the C runtime, so it compiles cleanly.

Thanks.

> First, there was a missing prototype decl. inside the FreeBSD #ifdef.

Good.

> Then, we throw -Wno-float-equal on Real.c in the runtime. I had preferred
> a #pragma, but it looks like gcc can't do that :/

Good.

> Another check handles gnu89-style inlines and quells warnings on libgmp.

I don't get any warnings (w/respect to inlining) with {amd64,x86}-linux 
and gcc 4.1.2 or with x86-darwin and gcc 4.0.1.  What are you 
observing?  (Also, the gcc manual doesn't explain the difference between 
gnu89 inline and C99 inline.  Does it make any difference for our use of 
inlining?)

Also, the option '-fgnu89-inline' is not recognized by gcc 4.0.1 (and 
presumably any earlier version).  So, the inclusion of the option sould be 
predicated by gcc version.

> While here hacking makefiles, add an 'etags' and 'ctags target (I just
> saw it has a wrong
> .PHONY decl. if I get a "commit it!" that will be fixed).

Fine, though probably unecessary.

> Finally, a POSIX ioctl() has a 'request' parameter which is an
> unsigned long rather than a signed long.

It is my understanding that the Single Unix Specification includes POSIX 
(IEEE 1003.1 2004); it specifies that the 'request' parameter is an 'int':
   http://www.opengroup.org/onlinepubs/009695399/functions/ioctl.html

In any event, it is the case that Linux takes an 'int' parameter, so for 
real compatability with our supported platforms, we would need a 
significantly more complicated patch than simply switching everything to 
'unsigned int'.

> There was a warning because FreeBSD is using the highest bit for
> something in there, so one
> can't just stuff it inside a signed long and hope for the best.

What was the warning?  Casting between 'signed int' and 'unsigned int' 
shouldn't change the bits; so, while gcc might flag a warning, I don't 
think it can change the meaning of a program.

> As for GCC version: FreeBSD 7 is gcc 4.2.1 + Patches. Would it be beneficial to
> define a "least version" of gcc? I would think so, since we can then
> clean up a lot of stuff in the Makefiles.

I don't see a big need.  There wouldn't be that much to change in the 
Makefile (indeed, it is only the <src>/runtime/Makefile that cares about 
the gcc version).

> The only thing I am concerned about is the
> various Linux distributions
> that might still run a 3.x version of gcc.

Mac OS 10.3 uses gcc 3.3.  And, we shouldn't unnecesarily break 
compatability.



More information about the MLton mailing list