This is the mail archive of the
mailing list for the newlib project.
Re: Default libm mode is XOPEN?
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: newlib at sourceware dot org
- Date: Mon, 7 Jul 2014 11:07:12 -0500
- Subject: Re: Default libm mode is XOPEN?
- Authentication-results: sourceware.org; auth=none
- References: <53B576CD dot 5070301 at arm dot com> <20140707132612 dot GB9678 at calimero dot vinschen dot de>
On 7/7/2014 8:26 AM, Corinna Vinschen wrote:
> On Jul 3 16:29, Kyrill Tkachov wrote:
>> Hi all,
>> Looking at newlib/libm/common/fdlibm.h I see the lines:
>> /* REDHAT LOCAL: Default to XOPEN_MODE. */
>> #define _XOPEN_MODE
>> Building an aarch64-none-elf compiler with newlib, the following test
>> #include <stdio.h>
>> #include <math.h>
>> main (void)
>> printf ("_LIB_VERSION: %d\n", _LIB_VERSION);
>> printf ("_XOPEN_: %d\n", _XOPEN_);
>> return 0;
>> _LIB_VERSION: 1
>> _XOPEN_: 1
>> Is this /* REDHAT LOCAL: Default to XOPEN_MODE. */ really intentional for
>> all users of newlib?
>> I thought IEEE was supposed to be the default one. Or are targets expected
>> to override this?
> It might be pretty tricky to track down why this was done. _XOPEN_MODE
> was defined in fdlibm.h since the introduction of the public CVS
> repository back in 2000. The definition doesn't show up in the
> ChangeLog at all, so this change dates back to at least 1995.
> OTOH, changing this now would potentially break a lot of targets.
> We might have to introduce some workaround if there's an actual need.
Although this is not is the oldest version of the file,
the official fdlibm source does not include this definition.
I can use the wayback machine at archive.org back to
1997 and see the same definition.
And it doesn't have the definition. That version has this at the top:
/* @(#)fdlibm.h 1.5 95/01/18 */
Which is very likely what you are looking at in the public CVS.
Digging as far back as I could easily, the newlib ftp site has
newlib 1.6 which has this version:
/* @(#)fdlibm.h 5.1 93/09/24 */
and the magical lines:
/* CYGNUS LOCAL: Default to XOPEN_MODE. */
So we can't blame this on Redhat. Where is Rob Savoye
when you need someone to poke? LOL
I agree with you that 20+ years of being in place, it is
scary to change. But I only see two references to
_XOPEN_MODE. Once to define it and another in s_lib_ver.c
to set _LIB_VERSION. I guess the question is whether this is
truth or lying about the fdlibm/newlib implementation.
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985