[m-rev.] for review: Work around isinf() link error on Solaris.
Julien Fischer
jfischer at opturion.com
Wed May 29 16:56:27 AEST 2013
On Wed, 29 May 2013, Peter Wang wrote:
> On Wed, 29 May 2013 16:13:26 +1000 (EST), Julien Fischer <jfischer at opturion.com> wrote:
>>
>> Hi Peter,
>>
>> On Wed, 29 May 2013, Peter Wang wrote:
>>
>>> On Solaris, isinf() is detected by configure but we pass -fno-builtin
>>> for global registers on x86/x86-64, and that causes an undefined
>>> reference to `isinf' when linking.
>>
>> Or is it because the C compiler is not in C99 mode?
>
> No, the compiler links fine in hlc.gc.pregen.
>
>> (Either way, that behaviour seems pretty broken.)
>
> I wouldn't expect anything less.
>
>>> runtime/mercury_float.c:
>>> Don't use `isinf' or `isinff' on when __sun is defined.
>>>
>>> Add a better `isinf' fallback using finite().
>>
>> IIRC, finite() is a BSD'ism. (C99 provides the equivalent isfinite.)
>> You probably shouldn't be assuming that any of them are present and
>> should certainly be checking that they are before attempting to use
>> them.
>
> Oh, all right.
>
> Actually, I was hoping to get away with it, but some (older) MSVCs
> might be missing both.
As is typical with MSVC, it's called _finite.
<http://msdn.microsoft.com/en-US/library/sb8es7a8(v=vs.80).aspx>
...
> [PATCH] Work around `isinf' link error on Solaris.
>
> On Solaris, `isinf' is detected by configure but we pass -fno-builtin
> for global registers on x86/x86-64, and that causes an undefined
> reference to `isinf' when linking.
>
> configure.ac:
> runtime/mercury_conf.h.in:
> Check for existence of `finite'.
>
> runtime/mercury_conf_param.h:
> Define MR_SOLARIS if appropriate.
>
> runtime/mercury_float.c:
> Don't use `isinf' or `isinff' on Solaris.
>
> Add a better `MR_is_inf' fallback using `finite'.
That's fine. (I'll have a look at what's happening on Windows sometime
before the 13.05.1 release.)
Cheers,
Julien.
More information about the reviews
mailing list