C99/C++ patch for /usr/include/math.h

Billinghurst, David (CRTS) David.Billinghurst@riotinto.com
Sat Jul 12 21:00:00 GMT 2003

> 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.

More information about the Newlib mailing list