fenv.h

Joel Sherrill joel.sherrill@oarcorp.com
Tue Oct 20 19:13:00 GMT 2015



On 10/20/2015 10:43 AM, Corinna Vinschen wrote:
> On Oct 20 17:21, Corinna Vinschen wrote:
>> On Oct 20 08:53, Joel Sherrill wrote:
>>>
>>>
>>> On 10/19/2015 8:34 AM, Corinna Vinschen wrote:
>>>> On Oct  7 18:49, Stefan Heinzmann wrote:
>>>>> Hi all,
>>>>>
>>>>> I have seen a couple of discussions about fenv.h in the past on this list,
>>>>> and there seems to be support for fenv.h in newlib for the spu target, but
>>>>> for no other. As fenv.h belongs to C99, I wonder why that is so. Is fenv.h
>>>>> support meant to be the responsibility of the C library or of the compiler
>>>>> support library? What about implementations for the more mainstream
>>>>> architectures, such as X86 or ARM?
>>>>
>>>> I guess the answer is simply that nobody provided them yet, so SPU
>>>> and Cygwin are the only ones so far.
>>>
>>> Is the Cygwin implementation general enough for x86?
>>
>> I think so.  It includes two Cygwin-specific headers winsup.h and
>> wincap.h but both includes are apparently unnecessary.
>>
>> Would you like to give it a whirl?  Just take the files
>>
>>    winsup/cygwin/fenv.cc
>>    winsup/cygwin/include/fenv.h
>>
>> and in fenv.cc change
>>
>>    #include "winsup.h"
>>    #include "fenv.h"
>>    #include "errno.h"
>>    #include "wincap.h"
>>    #include <string.h>
>>
>> to
>>
>>    #include "fenv.h"
>>    #include <errno.h>
>>    #include <string.h>
>
> There's no reason to stick to C++ either, so renaming to fenv.c should
> be fine with minor style tweaks at worst.
>
> If you think this is fine for x86 and x86_64 in general, there's no
> problem in moving the file to newlib and relicensing to BSD 2-clause.
>

Stefan asked about arm and other targets. FreeBSD appears to have
a lot of targets covered.

https://github.com/freebsd/freebsd/tree/master/lib/msun

I will look at the Cygwin version when I get a chance but FreeBSD
may be a deeper bucket to pull from.

--joel



More information about the Newlib mailing list