This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
RE: C99/C++ patch for /usr/include/math.h
- From: "Billinghurst, David (CRTS)" <David dot Billinghurst at riotinto dot com>
- To: "J. Johnston" <jjohnstn at redhat dot com>
- Cc: <newlib at sources dot redhat dot com>
- Date: Fri, 11 Jul 2003 08:09:32 +1000
- Subject: RE: C99/C++ patch for /usr/include/math.h
> From: J. Johnston [mailto:jjohnstn@redhat.com]
>
> I am just wondering if a fix belongs in libstdc++. There is a #undef fpclassify
> in both c/std_cmath.h and c_std/std_cmath.h. I would have expected this to
> solve the problem. Any ideas on why it is not? Is there another cmath being
> dragged in?
>
> -- Jeff J.
I think there are a few issues to work through. The #undef fpclassify in the
libstdc++-v3 headers are not active.
1. configure detects that C99 support in <math.h> is incomplete. The test
for signbit() fails. We have
#define signbit(x) \
(__extension__ ({__typeof__(x) __x = (x); \
(sizeof(__x) == sizeof(float)) ? __signbitf(__x) : __signbitd(__x);}))
but no declaration of __signbitf() or __signbitd()
I fixed this by adding to <math.h> the declarations
external int __signbitf (float x);
external int __signbitd (double x);
2. Even with this tere are problems, but I think they are in libstdc++.
The necessary macros are only active if there is more complete C99 support
than newlib provides. I think finer grained detection may be the solution.