Default libm mode is XOPEN?
Corinna Vinschen
vinschen@redhat.com
Mon Jul 7 18:19:00 GMT 2014
On Jul 7 11:07, Joel Sherrill wrote:
> 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
> >> program:
> >> #include <stdio.h>
> >> #include <math.h>
> >>
> >> int
> >> main (void)
> >> {
> >> printf ("_LIB_VERSION: %d\n", _LIB_VERSION);
> >> printf ("_XOPEN_: %d\n", _XOPEN_);
> >> return 0;
> >> }
> >>
> >> produces:
> >> _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.
>
> http://www.netlib.org/fdlibm/fdlibm.h
Yeah, I was looking for the newlib archives and ChangeLog only.
> [...]
> 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.
It's more than that. _LIB_VERSION is tested a lot throughout the code :(
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20140707/26a34300/attachment.sig>
More information about the Newlib
mailing list