Importing cacoshl.c and its dependent methos,

Craig Howland howland@LGSInnovations.com
Wed Jun 21 15:02:00 GMT 2017


On 06/21/2017 08:04 AM, aditya upadhyay wrote:
> So ,To not rely on stdbool.h from c99,  do i have to port stdbool.h here also ?
> Otherwise we can use
>   #ifndef __cplusplus
>   typedef enum { false, true } bool;
>   #endif
>
> Thanks a lot for your suggested modification. I am applying the
> required the modification.
>
> Regards,
> Aditya Upadhyay
>
> On Wed, Jun 21, 2017 at 1:58 PM, Corinna Vinschen <vinschen@redhat.com> wrote:
>> On Jun 21 08:46, Sebastian Huber wrote:
>>> On 21/06/17 04:24, aditya upadhyay wrote:
>>>
>>>> Hello Developers,
>>>> In cacoshl.c, There is a dependency between cacoshl.c and csqrtl.c.
>>>> In ported csqrtl.c from NetBSD,  stdbool.h is there,  But i saw there
>>>> is no stdbool.h.
>>>>
>>>> So for bool data type, I have used enum. Is it a right way or not.
>>>> please suggest or do i have to use stdbool.h from gcc library ?
>>> <stdbool.h> is currently not used by Newlib. I am not sure if we should add
>>> this dependency if its only needed by csqrtl.c (in overall NetBSD libm) and
>>> not visible to the user.
>>>
>>> I would replace the #include <stdbool.h> with
>>>
>>> #ifndef __cplusplus
>>> typedef enum { false, true } bool;
>>> #endif
>>>
>>>   and keep the rest of the code unchanged.
>> Wait.  Isn't stdbool.h available in gcc for ages?  When building newlib,
>> shouldn't we be able to rely on c99 being available?
>>
>>
>> Corinna
>>
Yes, we can, and should.  That's because complex.h and stdbool.h were added in 
C99, making C99 required for these functions.  I did a quick check on some older 
cross-compiler installs that I have, and GCC 4.1.1 has stdbool.h (and 4.6.4 has 
complex.h).
Craig



More information about the Newlib mailing list