This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: long double (was "strtold?")


Jeff Johnston wrote:
Ken Werner wrote:
On Monday 20 April 2009 23:15:24 Howland Craig D (Craig) wrote:
Ken said:
I played with the AC_TYPE_LONG_DOUBLE_WIDER macro but there are two
things to consider. We would need to upgrade the autoconf version required by newlib and introduce something like config.h (through AC_CONFIG_HEADERS). which might pollute the name space if it get's pulled by a standard header.
Jeff said:
I think an executable test is required to accomplish this which can't be
done in newlib due to the missing library at time of configure.
Ken's former problem could easily be circumvented by writing our own
test
as he did for HAVE_LONG_DOUBLE, couldn't it?  Something like:

cat >conftest.c <<EOF
#include <float.h>
#if DBL_MANT_DIG == LDBL_MANT_DIG  &&  LDBL_MIN_EXP == DBL_MIN_EXP  &&
\
    LDBL_MAX_EXP == DBL_MAX_EXP
  #define _LDBL_EQ_DBL
 #else
  #error "LDBL != DBL"
#endif
EOF

(Of course, the #define is meaningless, but I just copied what we have
already and did a minimal amount of editing.  Maybe a declaration would
be needed in case there were any compilers that didn't like to make
empty objects.)

This is not an executable test that needs the library, as float.h comes
from the compiler.  It just takes a compile-only pass/fail.  So I think
that it is viable, should we decide on this as the best alternative.

I don't understand Ken's latter comment about name space pollution.
Could
you elaborate?

This is what I had in mind. Let's assume the generated config.h contains a define without an underscore prefix. If this gets pulled into a standard header we would have defines that are not standardized and thus not expected by the user. That might collide with user defined flags and cause side effects.
In case we write the conftest ourselfs and manually generate the header file to be included we can prepend the underscore. However, autoconf isn't my strong point. : )


This isn't a problem. Autoconf decides what the flag will be named. Craig, this makes sense.
I'll work on a patch shortly.


-- Jeff J.

Patch checked in and tested on mn10300 where _LDBL_EQ_DBL gets sets to 1.


-- Jeff J.
Craig

Ken



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]